Dan
Dan

Reputation: 946

SQLSTATE[HY000]: General error: 1 no such table

I'm unable to fix this error:

SQLSTATE[HY000]: General error: 1 no such table: event_entries (SQL: select * from "event_entries")

I have looked at other similar questions but no luck.

I am using sqlite. I can not find any reference to the table in question in my code or through command line. I have done migration rollback, reset and refresh, re seeded, and finally tried adding this code:

if (Schema::hasTable('event_entries')) {
           Schema::drop('event_entries');

...to the events table migration. But no success and I have no clue what to try next.

In tinker it shows:

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)",
     },

Migrate status:

+------+------------------------------------------------+

| Ran? | Migration |

+------+------------------------------------------------+

| 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 |

Upvotes: 2

Views: 5550

Answers (2)

LOwens1931
LOwens1931

Reputation: 33

For this error you can do php artisan migrate. Then try your form again

Upvotes: 0

Dan
Dan

Reputation: 946

Its happening because I renamed the schema. I put the schema name back to original name and did the migrate reset and then migrate, and its back up and running. Reason I renamed it is cause for a different question.

Upvotes: 3

Related Questions