On Wednesday, September 25, 2019 at 5:31:03 AM UTC-7, D-lev wrote:
>
> It seems that I didn't explain the use case correctly.
>
> We support a backup and restore of our DB (postgres) via native dump tool.
>
> V - We do copy migration files from engine to main application.  
> engine/db/migration/*201700000000*_add_expiration
> V - Also we rename (re-date) those migration files before migrator, 
> main/db/migration/*201800000000*_add_expiration
>
> now, when user run backup & restore in new DB - timestamp meta table will 
> hold filename:  *201800000000*_add_expiration
>
> When application code do the same flow
> V - copy migration files from engine to main application.  
> engine/db/migration/*201700000000*_add_expiration
> V - Also we rename (re-date) those migration files before migrator, 
> main/db/migration/*201900000000*_add_expiration
>

Here is the issue.  You need to use the timestamp you used when running the 
migration initially.  Alternatively, don't rename the migration file at all.
 

> Running rake db:migrate we get an error, since in the schema_migration 
> meta table expecting exactly filename: *201800000000*_add_expiration
> and we have *201900000000*_add_expiration on our filesystem.
>
> The re-date thing only run on physical file system files and not changing 
> the meta table record to be correlated.
> If Sequel will compared only "add_expiration" without version & scope when 
> running db:migrate, it will be OK since the file and it's content are the 
> same, just the version&scope changed.
>

This would require changing the metadata format, which would not be 
backwards compatible.  If you really want to keep the same process you are 
using, you'll need to update the database table holding the migration 
filenames to handle the file rename.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/8c9ff2f6-75e1-4f4b-938a-83acaaae4980%40googlegroups.com.

Reply via email to