[英]Rake db:migrate aborted! Ghost development database using MySQL2?
OK, I just re-installed MySQL Servers 5.5(32bit to 64bit) on my Windows 7 64-bit machine. 好的,我只是在Windows 7 64位计算机上重新安装了MySQL Servers 5.5(32位至64位)。 I then took the steps to use mysql2 for rails:
然后,我采取了将mysql2用于rails的步骤:
gem 'mysql2', '0.2.6'
gem 'rails', '3.0.7'
Step 1: 第1步:
rake db:drop
Couldn't drop store_development : #<Mysql2::Error: Unknown database 'store_development'>
Strange because in the MySQL Workbench I only see the test database up. 奇怪,因为在MySQL Workbench中我只能看到测试数据库。
Step 2: 第2步:
$ rake db:migrate
rake aborted!
Unknown database 'store_development'
No idea why I get this error so I try to reset the database now. 不知道为什么会收到此错误,所以我现在尝试重置数据库。
Step 3: 第三步:
rake db:reset
(in C:/store)
Couldn't drop store_development : #<Mysql2::Error: Unknown database 'store_development'>
store_test already exists
-- create_table("business_online_stores", {:force=>true})
-> 0.1110s
-- create_table("business_retail_stores", {:force=>true})
-> 0.0740s
-- create_table("businesses", {:force=>true})
-> 0.0900s
-- create_table("products", {:force=>true})
-> 0.0810s
-- create_table("user_prices", {:force=>true})
-> 0.0720s
-- create_table("users", {:force=>true})
-> 0.1810s
-- initialize_schema_migrations_table()
-> 0.2800s
-- assume_migrated_upto_version(0, "db/migrate")
-> 0.0320s
You have 6 pending migrations:
20110909175650 DeviseCreateUsers
20110929161120 CreateUserPrices
20111004023516 CreateProducts
20111007023521 CreateBusinesses
20111009215120 CreateBusinessRetailStores
20111009215419 CreateBusinessOnlineStores
Run "rake db:migrate" to update your database then try again.
Yes, the Test database does already exist but where is this Ghost development database at? 是的,Test数据库已经存在,但是此Ghost开发数据库在哪里? How does it reset the migrations, yet tell me to migrate them again.
如何重置迁移,但告诉我再次迁移。 Ok, ill do as it says now:
好吧,现在做错了:
Step 4: 第四步:
$ rake db:migrate
(in C:/store)
== DeviseCreateUsers: migrating ==============================================
-- create_table(:users)
rake aborted!
An error has occurred, all later migrations canceled:
Mysql2::Error: Table 'users' already exists: CREATE TABLE `users`
Step 5: 步骤5:
$ rake db:migrate
rake aborted!
Unknown database 'store_development'
Impossible, I went inside of my MySQL Workbench and dropped the test and development databases by right-clicking them and going through the necessary steps so nothing exist even when I refresh it, yet I get this error about a database that doesn't exist. 不可能,我进入MySQL Workbench,通过右键单击测试和开发数据库并执行必要的步骤来删除测试和开发数据库,因此即使在刷新数据库时也不存在任何内容,但是却遇到关于不存在的数据库的错误。
How do I fix this problem? 我该如何解决这个问题?
Note: 0.2.7
Gives me the same issues. 注意:
0.2.7
给我同样的问题。
Note: These are my first 2 migration files just encase anyone wanted to see them: https://gist.github.com/1341682 注意:这些是我的前2个迁移文件,只是用来封装任何想查看它们的人: https : //gist.github.com/1341682
Just a thought, but does Users
already have entries in the email column? 只是一个想法,但是
Users
在电子邮件栏中是否已经有条目? I wonder if an existing duplicate entry would prevent the addition of the validation :unique=>true
我不知道现有的重复条目是否会阻止添加验证
:unique=>true
And just to check, did you want to do?: 只是检查一下,您想做什么?:
add_column :users, :email, :string
instead of add_index? 而不是add_index?
我知道解决此问题的唯一方法是重新创建整个应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.