**** CubicPower OpenStack Study ****
def upgrade(migrate_engine):
"""Creates the default domain."""
meta = sql.MetaData()
meta.bind = migrate_engine
domain_table = sql.Table('domain', meta, autoload=True)
domain = {
'id': CONF.identity.default_domain_id,
'name': 'Default',
'enabled': True,
'extra': json.dumps({
'description': 'Owns users and tenants (i.e. projects) available '
'on Identity API v2.'})}
session = orm.sessionmaker(bind=migrate_engine)()
insert = domain_table.insert()
insert.execute(domain)
session.commit()
**** CubicPower OpenStack Study ****
def downgrade(migrate_engine):
"""Delete the default domain."""
meta = sql.MetaData()
meta.bind = migrate_engine
sql.Table('domain', meta, autoload=True)
session = orm.sessionmaker(bind=migrate_engine)()
session.execute(
'DELETE FROM domain WHERE id=:id',
{'id': CONF.identity.default_domain_id})
session.commit()