From e84a8103d1245967dc8ed6df70cf2210c20f53b5 Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Robles Date: Thu, 31 Mar 2016 17:33:56 +0300 Subject: [PATCH] Fix URL length for alembic migrations So, even though this was the initial state of the database. Having the URL as 500 makes the creation of the database break in InnoDB databases. This is because InnoDB databases have the hard limit that indexes should be of a length of 767 bytes maximum. Now, the 'values_index' index is of 36 (container_id) + 255 (name) + 500 (URL) which is bigger than 767 (791 in total actually). So this CR sets that as 255, to avoid that. The reason of choosing 255 as the length of the URL, is because that is the value that the model has currently. So that value appears both in the current model [1] and a migration script [2]. [1] https://github.com/openstack/barbican/blob/master/barbican/model/models.py#L795 [2] https://github.com/openstack/barbican/blob/master/barbican/model/migration/alembic_migrations/versions/d2780d5aa510_change_url_length.py#L21 Change-Id: I1ee1e1834506007b8744e0eeba2dc4c317d39297 --- .../model/migration/alembic_migrations/container_init_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barbican/model/migration/alembic_migrations/container_init_ops.py b/barbican/model/migration/alembic_migrations/container_init_ops.py index cccdce00c..d8b22f905 100644 --- a/barbican/model/migration/alembic_migrations/container_init_ops.py +++ b/barbican/model/migration/alembic_migrations/container_init_ops.py @@ -49,7 +49,7 @@ def upgrade(): sa.Column('status', sa.String(length=20), nullable=False), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('container_id', sa.String(length=36), nullable=False), - sa.Column('URL', sa.String(length=500), nullable=True), + sa.Column('URL', sa.String(length=255), nullable=True), sa.Column('data_hash', sa.CHAR(64), nullable=True), sa.ForeignKeyConstraint(['container_id'], ['containers.id'],), sa.PrimaryKeyConstraint('id'),