Set all LockVersion columns to default to 0
What does this MR do?
In !18418 (merged) we're removing a middleware that makes lock_version
behave properly when we it has nil
values, but before that we should already be making sure we minimize the amount of nil
s in our database.
This sets a default value of 0
to all the tables that have a lock_version
column.
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Database
Migration output:
== 20200203025400 DefaultLockVersionToZeroForMergeRequests: migrating =========
-- change_column_default(:merge_requests, :lock_version, {:from=>nil, :to=>0})
-> 0.0141s
== 20200203025400 DefaultLockVersionToZeroForMergeRequests: migrated (0.0142s)
== 20200203025602 DefaultLockVersionToZeroForIssues: migrating ================
-- change_column_default(:issues, :lock_version, {:from=>nil, :to=>0})
-> 0.0054s
== 20200203025602 DefaultLockVersionToZeroForIssues: migrated (0.0056s) =======
== 20200203025619 DefaultLockVersionToZeroForEpics: migrating =================
-- change_column_default(:epics, :lock_version, {:from=>nil, :to=>0})
-> 0.0050s
== 20200203025619 DefaultLockVersionToZeroForEpics: migrated (0.0051s) ========
== 20200203025744 DefaultLockVersionToZeroForCiBuilds: migrating ==============
-- change_column_default(:ci_builds, :lock_version, {:from=>nil, :to=>0})
-> 0.0053s
== 20200203025744 DefaultLockVersionToZeroForCiBuilds: migrated (0.0054s) =====
== 20200203025801 DefaultLockVersionToZeroForCiStages: migrating ==============
-- change_column_default(:ci_stages, :lock_version, {:from=>nil, :to=>0})
-> 0.0046s
== 20200203025801 DefaultLockVersionToZeroForCiStages: migrated (0.0047s) =====
== 20200203025821 DefaultLockVersionToZeroForCiPipelines: migrating ===========
-- change_column_default(:ci_pipelines, :lock_version, {:from=>nil, :to=>0})
-> 0.0048s
== 20200203025821 DefaultLockVersionToZeroForCiPipelines: migrated (0.0049s) ==