data-migrate | Migrate and update data alongside your database structure | Data Migration library
kandi X-RAY | data-migrate Summary
kandi X-RAY | data-migrate Summary
Run data migrations alongside schema migrations. Data migrations are stored in db/data. They act like schema migrations, except they should be reserved for data migrations. For instance, if you realize you need to titleize all your titles, this is the place to do it.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Move the given migration .
- Returns a list of migration files
- Generate all migrations .
- Define a new version table .
- Inserts a migration to the given table .
- returns a list of migrations for this migration
- Outputs a list of available migrations
- Down the migration .
- Returns the versions of the migration .
- Record the version of the version
data-migrate Key Features
data-migrate Examples and Code Snippets
Community Discussions
Trending Discussions on data-migrate
QUESTION
I have a Rails 6 application used in production. When I upgrade my app, I add migrations for new tables and/or columns.
What is the best way if I have to add new default datas ?
I use seed file for initial datas, but is there something like migrations (incremental) to add datas ? I know I can add datas in migrations but I would prefer another place for that.
[EDIT] Do someone know this gem : https://github.com/ilyakatz/data-migrate ? It seems to do what I am looking for.
...ANSWER
Answered 2021-Apr-13 at 11:10In some projects we use to put data updates into db/data-updates/_add_thing.rb
. We created an own generator for those, called by rails generate data_update AddThing
to create a migration calling / executing the contents from the corresponding update file.
Based on that you can put those default datas into db/default-data
with similar logic for your new defaults.
You don't need to call them by mirgrations, you also may run them as rails runner db/default-data/123_xyz.rb
in your differnt environments.
But if the new defaults are mandatory for your busines logic you should keep them as close as possible to the inventing migration!
QUESTION
I'm just wondering is it possible to define each block in rails gem data-migrate
to avoid repetition like below?
ANSWER
Answered 2019-Nov-13 at 15:57maybe create array with this values? For example:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install data-migrate
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page