ilyakatz / data-migrate

Migrate and update data alongside your database structure.
MIT License
1.4k stars 192 forks source link

`rails db:schema:load:with_data` doesn't load data schema unless DATA_SCHEMA defined #266

Closed abhinavc closed 1 year ago

abhinavc commented 1 year ago

Hi, I'm using version 10.0.2 of the gem. And I noticed that when I try to recreate my local database (as follows)

$>rails db:drop
$>rails db:create 
$>rails db:schema:load:with_data 

then schema migrations are loaded - but data migrations aren't.

After looking into the code (please see attached screenshot), I noticed references to DATA_SCHEMA environment variable.

Screenshot 2023-06-16 at 9 35 21 PM

And so, I tried doing the following instead. And it worked. $>DATA_SCHEMA='db/data_schema.rb' rails db:schema:load:with_data

So, either

  1. the documentation needs to be updated to let users know how to invoke rails db:schema:load:with_data, or
  2. the second argument to load_schema_current needs to be ENV['DATA_SCHEMA'] || <something>
wildmaples commented 1 year ago

Hi @abhinavc, thanks for reporting this issue.

I believe this was a bug that was introduced in v10.0.x and that version has now been yanked. We're currently in the middle of reworking the gem to be more stable. I recommend downgrading to v9.0.0 for the time being and following this issue: https://github.com/ilyakatz/data-migrate/issues/268