Skip to main content

Migration Checklist

[ ] General [ ] If you run a migration on existing Apps, use update with skip_screenshot: true or you will generate millions of screenshots [ ] If you are adding, removing and/or indexing column/table, please make sure to deactivate auto-deploy, let your migration complete and re-activate it. [ ] use column_exists? index_exists? and table_exists? as appropriate to avoid any existence issues

[ ] Adding New Column [ ] If defaults are necessary, then do the migration in 3 parts (create column, add default, backfill data)

[ ] Indexes [ ] Add algorithm: :concurrently to avoid any table locks when adding indexes (not necessary for removing indexes) [ ] Add disable_ddl_transaction! when using algorithm: :concurrently

[ ] Do not put heavy database manipulation scripts into migration [ ] rake task seems to be good choice, or sql script if u r guru. [ ] Some steps before running database changing scripts

    1. Use followers db to check how many rows will be affected (is it 100? or million?)
2. Ask Ivan and Puru to review your script (asking Yerassyl is also a good idea :joy:)
3. Consider running script in a small portion of records first, only then proceed to all records)
4. Think of what you will do if u brake db :joy: (although after carefull review chances are very low)