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.
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.
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.
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.
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.
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
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With