You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I am working on getting our brillo process working again, and I am running into an issue, although I might be misunderstanding something.
When I run the scrub with recreate_db: false, the scrub only contains SQL insert statements as expected. To refresh my local DB, I perform the following, and everything works:
db:drop
db:create
db:schema:load (which creates the structure in the DB)
db:load (which only runs the insert statements)
However when I run the scrub with recreate_db: true, the scrub also contains the schema at the top of the file. To refresh my local DB, I should only have to run rake db:load as this should drop, create, and load both the schema + data. What I am seeing is that this process never does a db:schema:load so the tables are never getting created in the local DB. When it loads the data, the DB is empty so the insert statements aren't really doing anything. If I run db:schema:load and then db:load, it drops the DB (given the logic in recreate_db) so there is no way to db:schema:load before this process.
Am I missing something here?
The text was updated successfully, but these errors were encountered:
Additionally, it seems that recreate_db is true by default, which means that this doesn't work by default until you disable recreate_db. I am also confused on why including the schema in the dump is helpful, since running db:schema:load would pull from your local codebase anyways.
Aha, it does a db:structure:dumphere, not a db:schema:dump. This is supposed to export the schema as sql, but because of this deprecation in rails, the process is including the rails schema in the file instead of sql, thus explaining why its not loading the schema properly. I'll try to make a PR that sets the schema_format before running db:structure:dump so that it outputs properly.
Until then, it seems the only way to get this process to work correctly is to set recreate_db: false and load the schema manually like I did in my initial attempt.
matttarantino
changed the title
Question on recreate_db not loading schema
db:structure:dump is exporting the rails schema, not sql
May 18, 2023
Hello! I am working on getting our brillo process working again, and I am running into an issue, although I might be misunderstanding something.
When I run the scrub with
recreate_db: false
, the scrub only contains SQL insert statements as expected. To refresh my local DB, I perform the following, and everything works:However when I run the scrub with
recreate_db: true
, the scrub also contains the schema at the top of the file. To refresh my local DB, I should only have to runrake db:load
as this should drop, create, and load both the schema + data. What I am seeing is that this process never does adb:schema:load
so the tables are never getting created in the local DB. When it loads the data, the DB is empty so the insert statements aren't really doing anything. If I rundb:schema:load
and thendb:load
, it drops the DB (given the logic in recreate_db) so there is no way todb:schema:load
before this process.Am I missing something here?
The text was updated successfully, but these errors were encountered: