Is there a new command to load the schema in rails 6?
It is rails db:schema:load
, run rails -T
to list all the available tasks.
Complains that users table already exists
[response inline]
You can run rails db:reset then
What would that do to my data
[response inline]
You were trying to reload the schema, db:schema:load requires an empty database, I guessed you were OK with removing the data. db:reset it’s just a shortcut for drop > create > schema:load > seed.
Why do you want to load the schema if you already have data and you don’t want to lose it? that makes no sense, if you already have data then you already have the schema loaded.
Yes right There’s no data I was just curious about the db:reset command because I never heard of it before I thought there’s no possiblity for an error in schema.rb How can I have an error in my schema.rb I’m thinking maybe there’s a new way to load the schema in rails 6 I created the database and tried to load the schema
What do you mean that you have an error en your schema.rb? When you run a migration, rails dumps the current database schema (rails db:schema:dump). Maybe you have some merge conflict if you are using source control and someone fixed the conflict wrong, but the file shouldn’t have errors since it’s just a dump of the actual running database’s schema.
You have all the db: tasks (run `rails -T | grep ‘db:’ to list all) including running the migrations, those are the only commands to change your database schema using rails.
I was developing on a laptop and the screen stopped working so I took the app over to my desktop and can’t load the schema I’m gonna try some different mysql2 versions It’s all these associations in my models now causing the errors like “can’t update parent row” I’ll go through all of them and comment out lines so I can load the schema