我无法修复此错误:
SQLSTATE[HY000]: General error: 1 no such table: event_entries (SQL: select * from "event_entries")
我看过其他类似的问题,但没有运气。
我正在使用sqlite。我在代码中或通过命令行找不到任何对相关表的引用。我已经完成了迁移回滚、重置和刷新、重新播种,最后尝试添加以下代码:
if (Schema::hasTable('event_entries')) {
Schema::drop('event_entries');
...到事件表迁移。但没有成功,我不知道下一步该尝试什么。
在修补程序中显示:
DB::select('select * from sqlite_master where type="table"')
=> [
{#746
+"type": "table",
+"name": "migrations",
+"tbl_name": "migrations",
+"rootpage": "2",
+"sql": "CREATE TABLE "migrations" ("id" integer not null primary key autoincrement, "migration" varchar not null, "batch" integer not null)",
},
{#748
+"type": "table",
+"name": "sqlite_sequence",
+"tbl_name": "sqlite_sequence",
+"rootpage": "3",
+"sql": "CREATE TABLE sqlite_sequence(name,seq)",
},
{#749
+"type": "table",
+"name": "users",
+"tbl_name": "users",
+"rootpage": "4",
+"sql": "CREATE TABLE "users" ("id" integer not null primary key autoincrement, "name" varchar not null, "email" varchar not null, "password" varchar not null, "remember_token" varchar null, "created_at" datetime null, "updated_at" datetime null)",
},
{#750
+"type": "table",
+"name": "password_resets",
+"tbl_name": "password_resets",
+"rootpage": "6",
+"sql": "CREATE TABLE "password_resets" ("email" varchar not null, "token" varchar not null, "created_at" datetime null)",
},
{#751
+"type": "table",
+"name": "events_table",
+"tbl_name": "events_table",
+"rootpage": "8",
+"sql": "CREATE TABLE "events_table" ("id" integer not null primary key autoincrement, "title" varchar not null, "address" varchar not null, "description" varchar not null, "lat" varchar not null, "lng" varchar not null, "event_date" datetime not null, "created_at" datetime null, "updated_at" datetime null)",
},
迁移状态:
+------+---------------------------------------- ---------+
|兰? |迁移 |
+------+---------------------------------------- ---------+
|是 | 2014_10_12_000000_create_users_table |
|是 | 2014_10_12_100000_create_password_resets_table |
|是 | 2018_01_08_174209_create_events_table |
最佳答案
它的发生是因为我重命名了架构。我将架构名称恢复为原始名称,并进行了迁移重置,然后进行迁移,并且其备份并运行。我重命名它的原因是引起不同的问题。
关于SQLSTATE[HY000] : General error: 1 no such table,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48160499/