Disallow `NULL` values for `geo_nodes.primary`
What does this MR do?
Adds a post deployment migration to make geo_nodes.primary
non-null (while replacing existing NULL
s with false
). Also adds a default value of false
.
To understand why a post deployment migration is required, check this out.
Fixes #12061 (closed)
Migration output
== 20190616000519 UpdateGeoNodesPrimary: migrating ============================
-- change_column_default(:geo_nodes, :primary, false)
-> 0.0034s
-- change_column_null(:geo_nodes, :primary, false, false)
-> 0.0021s
== 20190616000519 UpdateGeoNodesPrimary: migrated (0.0056s) ===================
Database checklist
-
Conforms to the database guides
When adding migrations:
-
Updated db/schema.rb
-
Added a down
method so the migration can be reverted -
Added the output of the migration(s) to the MR body -
Added tests for the migration in spec/migrations
if necessary (e.g. when migrating data)
When adding or modifying queries to improve performance:
-
Included data that shows the performance improvement, preferably in the form of a benchmark -
Included the output of EXPLAIN (ANALYZE, BUFFERS)
of the relevant queries
When adding foreign keys to existing tables:
-
Included a migration to remove orphaned rows in the source table before adding the foreign key -
Removed any instances of dependent: ...
that may no longer be necessary
When adding tables:
-
Ordered columns based on the Ordering Table Columns guidelines -
Added foreign keys to any columns pointing to data in other tables -
Added indexes for fields that are used in statements such as WHERE, ORDER BY, GROUP BY, and JOINs
When removing columns, tables, indexes or other structures:
-
Removed these in a post-deployment migration -
Made sure the application no longer uses (or ignores) these structures
General checklist
-
Changelog entry added, if necessary -
Documentation created/updated -
Tests added for this feature/bug -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides