一区在线电影,国产在线首页,中文字幕精,天天爽天天射,夜色99,日韩国产成人av,伊人久久综合视频

威勢網(wǎng)絡,為您的企業(yè)和團隊注入互聯(lián)網(wǎng)活力!
服務熱線:138-9741-0341

SQLite Error 1: 'no such table: AspNetUser'.

發(fā)布日期:2023/4/6 作者: 瀏覽:1280

    在用下面的命令重新創(chuàng)建數(shù)據(jù)庫

>   drop-database

> add-migration Init

然后VS自動創(chuàng)建生成遷移類,里面明顯可以看到有創(chuàng)建表的語句

         migrationBuilder.CreateTable(
                name: "AspNetUsers",
                columns: table => new
                {
                    Id = table.Column<string>(type: "TEXT", nullable: false),
                    Sex = table.Column<string>(type: "TEXT", maxLength: 1, nullable: true),
                    NickName = table.Column<string>(type: "TEXT", maxLength: 10, nullable: true),
                    IsLocal = table.Column<bool>(type: "INTEGER", nullable: false),
                    IP = table.Column<string>(type: "TEXT", maxLength: 46, nullable: false),
                    RegTime = table.Column<DateTime>(type: "TEXT", nullable: false),
                    UserName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    NormalizedUserName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    Email = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    NormalizedEmail = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
                    EmailConfirmed = table.Column<bool>(type: "INTEGER", nullable: false),
                    PasswordHash = table.Column<string>(type: "TEXT", nullable: true),
                    SecurityStamp = table.Column<string>(type: "TEXT", nullable: true),
                    ConcurrencyStamp = table.Column<string>(type: "TEXT", nullable: true),
                    PhoneNumber = table.Column<string>(type: "TEXT", nullable: true),
                    PhoneNumberConfirmed = table.Column<bool>(type: "INTEGER", nullable: false),
                    TwoFactorEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
                    LockoutEnd = table.Column<DateTimeOffset>(type: "TEXT", nullable: true),
                    LockoutEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
                    AccessFailedCount = table.Column<int>(type: "INTEGER", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetUsers", x => x.Id);
                });
但是 執(zhí)行完 

>update-database

的時候,發(fā)現(xiàn)表里面除了__EFMigrationsHistory 表之外,一個表也沒有創(chuàng)建成功,程序還報 SQLite Error 1: 'no such table: AspNetUser'. 的錯誤。


試了好幾遍都不行,以前都是用這三句重新生成的,也沒有發(fā)現(xiàn)問題。如上圖所示,從回文長度來看也不正常。后來經(jīng)過多次嘗試,發(fā)現(xiàn)用以下命令代替上面的命令可以成功創(chuàng)建表,也不知道是啥原因

    /*
    PM>Drop-Database
    PM> Add-Migration InitialCreate
    PM> Update-Database
     */


    >add-migration Init -c AppDbContext -o Data/AppDb 

    >Update-Database -Context AppDbContext

把上面的三句換成下面的命令,成功創(chuàng)建數(shù)據(jù)表。記錄一下,也希望幫到別人。


下拉加載更多評論
最新評論
暫無!