Skip to content
Snippets Groups Projects
Verified Commit ee451ea5 authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Mention add_column_with_default in downtime guide

[ci skip]
parent fd3a2cf7
No related branches found
No related tags found
No related merge requests found
Loading
@@ -31,6 +31,14 @@ operation, even when using `ALGORITHM=INPLACE` and `LOCK=NONE`. This means
Loading
@@ -31,6 +31,14 @@ operation, even when using `ALGORITHM=INPLACE` and `LOCK=NONE`. This means
downtime _may_ be required when modifying large tables as otherwise the downtime _may_ be required when modifying large tables as otherwise the
operation could potentially take hours to complete. operation could potentially take hours to complete.
   
Adding a column with a default value _can_ be done without requiring downtime
when using the migration helper method
`Gitlab::Database::MigrationHelpers#add_column_with_default`. This method works
similar to `add_column` except it updates existing rows in batches without
blocking access to the table being modified. See ["Adding Columns With Default
Values"](migration_style_guide.html#adding-columns-with-default-values) for more
information on how to use this method.
## Dropping Columns ## Dropping Columns
   
On PostgreSQL you can safely remove an existing column without the need for On PostgreSQL you can safely remove an existing column without the need for
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment