#269 SQL migration 1.10->1.11 can fail (container_sane)
Closed: Fixed 5 years ago Opened 5 years ago by tkopecek.

Quote from e-mail:

I'm trying to upgrade a koji installation from 1.6 to 1.11. The database migrate scripts work all the way up to 1.10, but schema-upgrade-1.10-1.11.sql errors out when trying to add the "container_sane" constraint to the "buildroot" table.

I think what's going on is:
- the constraint is to make sure container_type and container_arch are either both NULL or neither NULL
- the container_type column is new in 1.11, so when the migration script adds it, all the values are NULL
- the container_arch column is a renaming of the arch column, where arch (for us) is either "i386" or "x86_64", never NULL

We probably at least should add some docs how to set default values for new column. Would it be safe to run following?

UPDATE buildroot SET container_type = 'chroot' WHERE container_arch IS NOT NULL;

I think it probably could be a problem, nevertheless working for most users. So this (or similar) step could be mentioned as optional in migrating_to_1.11.rst ?

Note: It will work correctly if user don't use any container-specific plugin.


Yes, this is a bug in the migration script. It looks like the initial schema-update-cgen* scripts did not include either the cg_sane or container_sane constraints. There were a lot of early adopters that used those to migrate data before 1.11 was finalized.

Probably also need to add AND container_type IS NULL to that to be safe.

Filed PR #272

@mikem changed the status to Closed

5 years ago

Metadata Update from @tkopecek:
- Issue set to the milestone: 1.12

5 years ago

Login to comment on this ticket.

Metadata