lundi 30 novembre 2015

rake db:migrate issue duplicate but doesn't exist

I have tried db:setup db:rollback db:drop db:migrate VERSION="0" and practically everything I could think of, but I can't figure out this error. I even attempted to run it and drop the tables before initializing the create method. Even when I create a new one, like a products db, it's telling me that it's there but then it's telling me that it doesn't exist when I try to drop it. I've spent 2 days going through forums and videos to figure out what's occurring. This happens with both sqlite and mysql.

E:\RailsApplications\Blog>rake db:migrate
== 20151130191336 CreateTablenames: migrating =================================
-- create_table(:tablenames)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: duplicate column name: ID: CREATE TABLE "tablenames" ("id
" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "ID" varchar, "col1" varchar, "col
2" varchar, "col3" varchar, "created_at" datetime NOT NULL, "updated_at" datetim
e NOT NULL) E:/RailsApplications/Blog/db/migrate/20151130191336_create_tablename
s.rb:3:in `change'
C:in `migrate'
ActiveRecord::StatementInvalid: SQLite3::SQLException: duplicate column name: ID
: CREATE TABLE "tablenames" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "I
D" varchar, "col1" varchar, "col2" varchar, "col3" varchar, "created_at" datetim
e NOT NULL, "updated_at" datetime NOT NULL)
E:/RailsApplications/Blog/db/migrate/20151130191336_create_tablenames.rb:3:in `c
hange'
C:in `migrate'
SQLite3::SQLException: duplicate column name: ID
E:/RailsApplications/Blog/db/migrate/20151130191336_create_tablenames.rb:3:in `c
hange'
C:in `migrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

E:\RailsApplications\Blog>rake db:migrate
== 20151130191336 CreateTablenames: migrating =================================
-- drop_table(:tablenames)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: no such table: tablenames: DROP TABLE "tablenames"E:/Rail
sApplications/Blog/db/migrate/20151130191336_create_tablenames.rb:3:in `change'
C:in `migrate'
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: tablenames
: DROP TABLE "tablenames"
E:/RailsApplications/Blog/db/migrate/20151130191336_create_tablenames.rb:3:in `c
hange'
C:in `migrate'
SQLite3::SQLException: no such table: tablenames
E:/RailsApplications/Blog/db/migrate/20151130191336_create_tablenames.rb:3:in `c
hange'
C:in `migrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Aucun commentaire:

Enregistrer un commentaire