diff --git a/keystone/common/sql/migrate_repo/versions/102_drop_domain_table.py b/keystone/common/sql/migrate_repo/versions/102_drop_domain_table.py new file mode 100644 index 0000000000..85eb8e104b --- /dev/null +++ b/keystone/common/sql/migrate_repo/versions/102_drop_domain_table.py @@ -0,0 +1,21 @@ +# 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. + +import sqlalchemy as sql + + +def upgrade(migrate_engine): + meta = sql.MetaData() + meta.bind = migrate_engine + + domain_table = sql.Table('domain', meta, autoload=True) + domain_table.drop() diff --git a/keystone/resource/backends/sql.py b/keystone/resource/backends/sql.py index 4d771adfff..a3bb5c769e 100644 --- a/keystone/resource/backends/sql.py +++ b/keystone/resource/backends/sql.py @@ -219,16 +219,6 @@ class Resource(base.ResourceDriverV9): query.delete(synchronize_session=False) -class Domain(sql.ModelBase, sql.DictBase): - __tablename__ = 'domain' - attributes = ['id', 'name', 'enabled'] - id = sql.Column(sql.String(64), primary_key=True) - name = sql.Column(sql.String(64), nullable=False) - enabled = sql.Column(sql.Boolean, default=True, nullable=False) - extra = sql.Column(sql.JsonBlob()) - __table_args__ = (sql.UniqueConstraint('name'),) - - class Project(sql.ModelBase, sql.DictBase): # NOTE(henry-nash): From the manager and above perspective, the domain_id # is nullable. However, to ensure uniqueness in multi-process diff --git a/keystone/tests/unit/test_backend_sql.py b/keystone/tests/unit/test_backend_sql.py index 069954df81..466969c910 100644 --- a/keystone/tests/unit/test_backend_sql.py +++ b/keystone/tests/unit/test_backend_sql.py @@ -165,13 +165,6 @@ class SqlModels(SqlTests): ('extra', sql.JsonBlob, None)) self.assertExpectedSchema('group', cols) - def test_domain_model(self): - cols = (('id', sql.String, 64), - ('name', sql.String, 64), - ('enabled', sql.Boolean, True), - ('extra', sql.JsonBlob, None)) - self.assertExpectedSchema('domain', cols) - def test_project_model(self): cols = (('id', sql.String, 64), ('name', sql.String, 64), diff --git a/keystone/tests/unit/test_sql_banned_operations.py b/keystone/tests/unit/test_sql_banned_operations.py index e62d3b90ff..3b1907f583 100644 --- a/keystone/tests/unit/test_sql_banned_operations.py +++ b/keystone/tests/unit/test_sql_banned_operations.py @@ -126,7 +126,15 @@ class KeystoneMigrationsCheckers(test_migrations.WalkVersionsMixin): # http://docs.openstack.org/developer/keystone/developing.html#online-migration exceptions = [ - # NOTE(xek): Reviewers: DO NOT ALLOW THINGS TO BE ADDED HERE + # NOTE(xek): Reviewers: DO NOT ALLOW THINGS TO BE ADDED HERE UNLESS + # JUSTIFICATION CAN BE PROVIDED AS TO WHY THIS WILL NOT CAUSE + # PROBLEMS FOR ROLLING UPGRADES. + + # Migration 102 drops the domain table in the Newton release. All + # code that referenced the domain table was removed in the Mitaka + # release, hence this migration will not cause problems when + # running a mixture of Mitaka and Newton versions of keystone. + 102 ] # NOTE(xek): We start requiring things be additive in Newton, so diff --git a/keystone/tests/unit/test_sql_upgrade.py b/keystone/tests/unit/test_sql_upgrade.py index 7a42a31ce2..7f6d8324f6 100644 --- a/keystone/tests/unit/test_sql_upgrade.py +++ b/keystone/tests/unit/test_sql_upgrade.py @@ -1156,6 +1156,12 @@ class SqlUpgradeTests(SqlMigrateBase): self.assertFalse(self.does_constraint_exist('role', 'ixu_role_name')) + def test_drop_domain_table(self): + self.upgrade(101) + self.assertTableExists('domain') + self.upgrade(102) + self.assertTableDoesNotExist('domain') + class MySQLOpportunisticUpgradeTestCase(SqlUpgradeTests): FIXTURE = test_base.MySQLOpportunisticFixture