小编use*_*956的帖子

Rake db:migrate错误,表已存在

我无意间创建了一个不需要的迁移,所以我删除了文件,并在尝试运行rake db:migrate时创建了一个新的迁移,但我一直收到此错误。我正在使用SQlite3 gem和Ruby on Rails 4

StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: table "categories" already exists: CREATE TABLE "categories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "category_name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NO
T NULL) D:/muse/db/migrate/20150830113519_create_categories.rb:3:in `change'
D:in `migrate'
ActiveRecord::StatementInvalid: SQLite3::SQLException: table "categories" already exists: CREATE TABLE "categories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "category_name" varchar, "created_at" datetime NO
T NULL, "updated_at" datetime NOT NULL)
D:/muse/db/migrate/20150830113519_create_categories.rb:3:in `change'
D:in `migrate'
SQLite3::SQLException: table …
Run Code Online (Sandbox Code Playgroud)

sqlite dbmigrate ruby-on-rails-4

2
推荐指数
2
解决办法
4268
查看次数

标签 统计

dbmigrate ×1

ruby-on-rails-4 ×1

sqlite ×1