我无法解决此错误:
SQLSTATE [HY000]:一般错误:1没有这样的表: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)",
},
迁移状态:
+ ------ + --------------------------------------- --------- +
|然? |迁移|
+ ------ + --------------------------------------- --------- +
| Y | 2014_10_12_000000_create_users_table |
| Y | 2014_10_12_100000_create_password_resets_table |
| Y | 2018_01_08_174209_create_events_table |
答案 0 :(得分:1)
它的发生是因为我重命名了架构。我将模式名称恢复为原始名称,然后重置迁移,然后进行迁移,并将其备份并运行。我重新命名的原因导致了另一个问题。