ManageIQ / manageiq-schema

SQL schema and database migrations for ManageIQ
Apache License 2.0
20 stars 125 forks source link

Document the migration "rules" #4

Closed Fryguy closed 3 years ago

Fryguy commented 7 years ago
lpichler commented 7 years ago
Fryguy commented 7 years ago
lpichler commented 7 years ago
Fryguy commented 7 years ago
miq-bot commented 6 years ago

This issue has been automatically marked as stale because it has not been updated for at least 6 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions!

lpichler commented 6 years ago

@miq-bot remove_label stale

Fryguy commented 6 years ago
Fryguy commented 6 years ago

Migrations should not create new rows if rows didn't previously exist...that is, an empty database migrated should still be empty in the end, particularly for test reasons. Data migrations of existing data can transform into new rows if necessary.

bdunne commented 6 years ago

Be region-aware in data migrations. When a data migration runs in the global region, you probably only want to update records for your region (especially when the data migration is complicated). Updating records for other regions is a waste of time since the migration will be run in the remote region and it will push the changes up.

lpichler commented 5 years ago

Use ActiveRecord::Base for models in migrations.

Part of the advantage of ApplicationRecord is that we can leave AR::Base unmolested, which is exactly what migrations want: a plain ordinary AR object with no app-code-of-the-day surprises.

taken from https://github.com/ManageIQ/manageiq/pull/7312/files#r56356275