Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ruby on rails rake db:migrate error

i'm starting to learn ruby on rails using this guide : getting_started , i created my project and database but when i run rake db:migrate i get this error:

@mona-Extensa-5230:~/rubyDev/Sites/blog# rake db:migrate
(in /home/mona/rubyDev/Sites/blog)
== CreatePosts: migrating ==================================================== -- create_table(:posts)
rake aborted!
An error has occurred, this and all later migrations canceled:
private method `String' called for#
ActiveRecord::ConnectionAdapters::TableDefinition:0xb7540f30>

thanks.

like image 712
Mouna Cheikhna Avatar asked Oct 23 '10 11:10

Mouna Cheikhna


People also ask

How do I migrate a database in Ruby on Rails?

Go to db/migrate subdirectory of your application and edit each file one by one using any simple text editor. The ID column will be created automatically, so don't do it here as well. The method self. up is used when migrating to a new version, self.

How can I check my rails migration status?

To check for status, run rails db:migrate:status . Then you'll have a good view of the migrations you want to remove. Then, run rails db:rollback to revert the changes one by one.

How do I reset migration in rails?

just use rake db:reset , that will drop your database (same as undoing all migrations) and reset to the last schema. UPDATE: a more correct approach will be using rake db:migrate:reset . That will drop the database, create it again and run all the migrations, instead of resetting to the latest schema.

How do I revert a rails migration in DBS?

You must rollback the migration (for example with bin/rails db:rollback ), edit your migration, and then run bin/rails db:migrate to run the corrected version.


1 Answers

Looks like you have a line like this in one of your migrations:

t.String

Note that the s needs to be in lowercase (t.string)

like image 183
Vijay Dev Avatar answered Oct 14 '22 07:10

Vijay Dev