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
This commit is contained in:
Juan Antonio Osorio Robles 2016-03-31 17:33:56 +03:00
parent d1c370ed6d
commit e84a8103d1

View File

@ -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'),