Skip to content

Geo: Change lfs_object_registry.last_sync_failure from text to string

What does this MR do?

So that new installations have a limit on last_sync_failure.

Part of #324274 (closed)

Note that I'm not following https://docs.gitlab.com/ee/development/what_requires_downtime.html#dropping-columns because I don't think it applies to this case, since the column was originally added in the same release in a post-deployment migration.

Also note that changing column type is a thing, but I'm assuming that drop column then add column is faster and requires less hoops to jump through? https://docs.gitlab.com/ee/development/what_requires_downtime.html#changing-column-types And the column is not yet in-use, so there is no data to worry about in it.

Migration output

$ bin/rake geo:db:migrate:redo
== 20210312042626 ChangeLfsObjectRegistryLastSyncFailureToString: reverting ===
-- column_exists?(:lfs_object_registry, :last_sync_failure)
   -> 0.0028s
-- remove_column(:lfs_object_registry, :last_sync_failure)
   -> 0.0014s
-- add_column(:lfs_object_registry, :last_sync_failure, :text)
   -> 0.0011s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE lfs_object_registry\nADD CONSTRAINT check_c41d57c1dc\nCHECK ( char_length(last_sync_failure) <= 255 )\nNOT VALID;\n")
   -> 0.0047s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE lfs_object_registry VALIDATE CONSTRAINT check_c41d57c1dc;")
   -> 0.0018s
== 20210312042626 ChangeLfsObjectRegistryLastSyncFailureToString: reverted (0.0275s) 

== 20210312042626 ChangeLfsObjectRegistryLastSyncFailureToString: migrating ===
-- remove_column(:lfs_object_registry, :last_sync_failure)
   -> 0.0014s
-- add_column(:lfs_object_registry, :last_sync_failure, :string, {:limit=>255})
   -> 0.0015s
== 20210312042626 ChangeLfsObjectRegistryLastSyncFailureToString: migrated (0.0037s) 

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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
Edited by Michael Kozono

Merge request reports