Shopify

Safely Adding NOT NULL Columns to Your Database Tables - Shopify

Oct 4, 2022
Safely Adding NOT NULL Columns to Your Database Tables - Shopify
SummaryAI, from the source post

This post details an investigation into the safety of adding NOT NULL columns to MySQL tables using the Large Hadron Migrator (LHM) gem. It outlines the LHM shadow-table mechanism and defines schema change safety in terms of backward compatibility and data loss. The investigation focuses on the impact of DEFAULT values, UNIQUE indexes, and MySQL's strict/non-strict modes on the safety of adding NOT NULL columns. A results matrix is presented, concluding that adding NOT NULL columns without a DEFAULT value should be avoided, and caution is advised when adding UNIQUE indexes due to the risk of data loss.

More from the Data Store Selection and Usage trail