Migrate `container_repository_registry.state` column to integer
In !93690 (merged) we migrated ContainerRepository to SSF and we preserved the type of state
column:
We currently use
state:string
column in theContainerRepositoryRegsitry
while Geo SSF requires us to havestate:integer
and this doesn't let us create the state column for SSF in parallel to the old one as we always did. To manage this issue I decided to add a special logic that allows SSF to work with the old column as well as with the new one. The type of the column is preserved. When this MR is merged we can create a new one that will migrate old data and then will change the type of the column to integer from the string. So 'pending' will be changed to '0' in one step and in the second step we change the column's type to the integer with a special type-cast function.
The scope of this issue:
- Migrate records from the old way of recording the state to a new way (example: 'pending' to '0')
- Change the type of the column from string to integer(See https://docs.gitlab.com/ee/development/database/avoiding_downtime_in_migrations.html#casting-data-to-a-new-type)
- Set NOT NULL
This has to be implemented after we make the feature flag geo_container_repository_replication
true by default.