Skip to content

Geo: Change group_wiki_repository_registry.last_sync_failure from text to string

What does this MR do?

So that new installations have a limit on group_wiki_repository_registry.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.

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
== 20210312051153 ChangeGroupWikiRepositoryRegistryLastSyncFailureToString: reverting 
-- column_exists?(:group_wiki_repository_registry, :last_sync_failure)
   -> 0.0026s
-- remove_column(:group_wiki_repository_registry, :last_sync_failure)
   -> 0.0013s
-- add_column(:group_wiki_repository_registry, :last_sync_failure, :text)
   -> 0.0011s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE group_wiki_repository_registry\nADD CONSTRAINT check_983ee0d9c3\nCHECK ( char_length(last_sync_failure) <= 255 )\nNOT VALID;\n")
   -> 0.0010s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE group_wiki_repository_registry VALIDATE CONSTRAINT check_983ee0d9c3;")
   -> 0.0013s
== 20210312051153 ChangeGroupWikiRepositoryRegistryLastSyncFailureToString: reverted (0.0172s) 

== 20210312051153 ChangeGroupWikiRepositoryRegistryLastSyncFailureToString: migrating 
-- remove_column(:group_wiki_repository_registry, :last_sync_failure)
   -> 0.0015s
-- add_column(:group_wiki_repository_registry, :last_sync_failure, :string, {:limit=>255})
   -> 0.0013s
== 20210312051153 ChangeGroupWikiRepositoryRegistryLastSyncFailureToString: migrated (0.0029s) 

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Michael Kozono

Merge request reports