From 64fda46806410d562bfa94d4561ecc004762299f Mon Sep 17 00:00:00 2001 From: Stan Lagun Date: Mon, 28 Dec 2015 14:04:16 +0300 Subject: [PATCH] user_id column was widened to support domain users The length of keystone domain users is 64 chars length but the columns that hold user_id were VARCHAR(36) Change-Id: Idcbdd49b71ff3c88cf1801362b2f51d6cb22464e Closes-Bug: #1521104 --- .../versions/012_support_domain_users.py | 44 +++++++++++++++++++ murano/db/models.py | 4 +- 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 murano/db/migration/alembic_migrations/versions/012_support_domain_users.py diff --git a/murano/db/migration/alembic_migrations/versions/012_support_domain_users.py b/murano/db/migration/alembic_migrations/versions/012_support_domain_users.py new file mode 100644 index 000000000..bea0e4129 --- /dev/null +++ b/murano/db/migration/alembic_migrations/versions/012_support_domain_users.py @@ -0,0 +1,44 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Change sizes of columns that hold keystone user ID to support domain users +which are 64 characters long. + +Revision ID: 012 +Revises: table session, table package + +""" + +# revision identifiers, used by Alembic. +revision = '012' +down_revision = '011' + +from alembic import op +import sqlalchemy as sa + + +MYSQL_ENGINE = 'InnoDB' +MYSQL_CHARSET = 'utf8' + + +def upgrade(): + op.alter_column('session', 'user_id', type_=sa.String(64), nullable=False) + op.alter_column('package', 'owner_id', type_=sa.String(64), nullable=False) + # end Alembic commands # + + +def downgrade(): + op.alter_column('package', 'owner_id', type_=sa.String(36), nullable=False) + op.alter_column('session', 'user_id', type_=sa.String(36), nullable=False) + # end Alembic commands # diff --git a/murano/db/models.py b/murano/db/models.py index 2aef5b934..9f1c0dc90 100644 --- a/murano/db/models.py +++ b/murano/db/models.py @@ -114,7 +114,7 @@ class Session(Base, TimestampMixin): default=uuidutils.generate_uuid) environment_id = sa.Column(sa.String(255), sa.ForeignKey('environment.id')) - user_id = sa.Column(sa.String(36), nullable=False) + user_id = sa.Column(sa.String(64), nullable=False) state = sa.Column(sa.String(36), nullable=False) description = sa.Column(st.JsonBlob(), nullable=False) version = sa.Column(sa.BigInteger, nullable=False, default=0) @@ -251,7 +251,7 @@ class Package(Base, TimestampMixin): cascade='save-update, merge', lazy='joined') logo = sa.Column(st.LargeBinary(), nullable=True) - owner_id = sa.Column(sa.String(36), nullable=False) + owner_id = sa.Column(sa.String(64), nullable=False) ui_definition = sa.Column(sa.Text) supplier_logo = sa.Column(sa.LargeBinary, nullable=True) categories = sa_orm.relationship("Category",