def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # add column:
    instances = Table('instances', meta, autoload=True)
    instances.create_column(Column('deleted', Boolean()))
    instances.create_column(Column('deleted_at', DateTime()))
def downgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # drop column:
    instances = Table('instances', meta, autoload=True)
    instances.drop_column('deleted')
    instances.drop_column('deleted_at')
def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # add column:
    instances = Table('instances', meta, autoload=True)
    instances.create_column(Column('tenant_id', String(36), nullable=True))
    instances.create_column(Column('server_status', String(64)))
def downgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # drop column:
    instances = Table('instances', meta, autoload=True)

    instances.drop_column('tenant_id')
    instances.drop_column('server_status')
def downgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # drop column:
    instances = Table('instances', meta, autoload=True)

    instances.drop_column('flavor_id')
    instances.drop_column('volume_size')
Esempio n. 6
0
def upgrade(migrate_engine):
    meta.bind = migrate_engine
    instances = Table(
        'instances',
        meta,
        autoload=True,
    )
    create_tables([security_groups, security_group_rules,
                   security_group_instance_associations])
def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # add column:
    instances = Table('instances', meta, autoload=True)
    volume_size = Column('volume_size', Integer())
    flavor_id = Column('flavor_id', String(36))

    instances.create_column(flavor_id)
    instances.create_column(volume_size)
Esempio n. 8
0
from reddwarf.db.sqlalchemy.migrate_repo.schema import DateTime
from reddwarf.db.sqlalchemy.migrate_repo.schema import drop_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import Float
from reddwarf.db.sqlalchemy.migrate_repo.schema import String
from reddwarf.db.sqlalchemy.migrate_repo.schema import Table
from reddwarf.db.sqlalchemy.migrate_repo.schema import Boolean

meta = MetaData()

backups = Table('backups', meta,
                Column('id', String(36), primary_key=True, nullable=False),
                Column('name', String(255), nullable=False),
                Column('description', String(512)),
                Column('location', String(1024)),
                Column('backup_type', String(32)), Column('size', Float()),
                Column('tenant_id', String(36)),
                Column('state', String(32), nullable=False),
                Column('instance_id', String(36)),
                Column('checksum', String(32)),
                Column('backup_timestamp', DateTime()),
                Column('deleted', Boolean()), Column('created', DateTime()),
                Column('updated', DateTime()), Column('deleted_at',
                                                      DateTime()))


def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([
        backups,
    ])

from reddwarf.db.sqlalchemy.migrate_repo.schema import Boolean
from reddwarf.db.sqlalchemy.migrate_repo.schema import create_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import DateTime
from reddwarf.db.sqlalchemy.migrate_repo.schema import drop_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import Integer
from reddwarf.db.sqlalchemy.migrate_repo.schema import BigInteger
from reddwarf.db.sqlalchemy.migrate_repo.schema import String
from reddwarf.db.sqlalchemy.migrate_repo.schema import Table


meta = MetaData()

service_statuses = Table(
    'service_statuses',
    meta,
    Column('id', String(36), primary_key=True, nullable=False),
    Column('instance_id', String(36), nullable=False),
    Column('status_id', Integer(), nullable=False),
    Column('status_description', String(64), nullable=False),
    Column('updated_at', DateTime()))


def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([service_statuses])


def downgrade(migrate_engine):
    meta.bind = migrate_engine
    drop_tables([service_statuses])
Esempio n. 10
0
from reddwarf.db.sqlalchemy.migrate_repo.schema import create_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import DateTime
from reddwarf.db.sqlalchemy.migrate_repo.schema import drop_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import Integer
from reddwarf.db.sqlalchemy.migrate_repo.schema import String
from reddwarf.db.sqlalchemy.migrate_repo.schema import Table


meta = MetaData()

quotas = Table('quotas', meta,
               Column('id', String(36),
                      primary_key=True, nullable=False),
               Column('created', DateTime()),
               Column('updated', DateTime()),
               Column('tenant_id', String(36)),
               Column('resource', String(length=255), nullable=False),
               Column('hard_limit', Integer()),
               UniqueConstraint('tenant_id', 'resource'))

quota_usages = Table('quota_usages', meta,
                     Column('id', String(36),
                            primary_key=True, nullable=False),
                     Column('created', DateTime()),
                     Column('updated', DateTime()),
                     Column('tenant_id', String(36)),
                     Column('in_use', Integer(), default=0),
                     Column('reserved', Integer(), default=0),
                     Column('resource', String(length=255), nullable=False),
                     UniqueConstraint('tenant_id', 'resource'))
Esempio n. 11
0
from sqlalchemy.schema import UniqueConstraint

from reddwarf.db.sqlalchemy.migrate_repo.schema import Boolean
from reddwarf.db.sqlalchemy.migrate_repo.schema import create_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import DateTime
from reddwarf.db.sqlalchemy.migrate_repo.schema import drop_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import Integer
from reddwarf.db.sqlalchemy.migrate_repo.schema import BigInteger
from reddwarf.db.sqlalchemy.migrate_repo.schema import String
from reddwarf.db.sqlalchemy.migrate_repo.schema import Table


meta = MetaData()

agent_heartbeats = Table(
    'agent_heartbeats',
    meta,
    Column('id', String(36), primary_key=True, nullable=False),
    Column('instance_id', String(36), nullable=False),
    Column('updated_at', DateTime()))


def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([agent_heartbeats])


def downgrade(migrate_engine):
    meta.bind = migrate_engine
    drop_tables([agent_heartbeats])
Esempio n. 12
0
from sqlalchemy import ForeignKey
from sqlalchemy.schema import Column
from sqlalchemy.schema import MetaData
from sqlalchemy.schema import UniqueConstraint

from reddwarf.db.sqlalchemy.migrate_repo.schema import Boolean
from reddwarf.db.sqlalchemy.migrate_repo.schema import create_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import DateTime
from reddwarf.db.sqlalchemy.migrate_repo.schema import drop_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import Integer
from reddwarf.db.sqlalchemy.migrate_repo.schema import BigInteger
from reddwarf.db.sqlalchemy.migrate_repo.schema import String
from reddwarf.db.sqlalchemy.migrate_repo.schema import Table

meta = MetaData()

service_images = Table(
    'service_images', meta,
    Column('id', String(36), primary_key=True, nullable=False),
    Column('service_name', String(255)), Column('image_id', String(255)))


def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([service_images])


def downgrade(migrate_engine):
    meta.bind = migrate_engine
    drop_tables([service_images])
Esempio n. 13
0
#    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.

from sqlalchemy import ForeignKey
from sqlalchemy.schema import Column
from sqlalchemy.schema import MetaData
from sqlalchemy.schema import UniqueConstraint

from reddwarf.db.sqlalchemy.migrate_repo.schema import Table
from reddwarf.db.sqlalchemy.migrate_repo.schema import create_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import drop_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import String

meta = MetaData()

dns_records = Table('dns_records', meta,
                    Column('name', String(length=255), primary_key=True),
                    Column('record_id', String(length=64)))


def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([dns_records])


def downgrade(migrate_engine):
    meta.bind = migrate_engine
    drop_tables([dns_records])
from reddwarf.db.sqlalchemy.migrate_repo.schema import drop_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import Boolean
from reddwarf.db.sqlalchemy.migrate_repo.schema import Integer
from reddwarf.db.sqlalchemy.migrate_repo.schema import String
from reddwarf.db.sqlalchemy.migrate_repo.schema import DateTime
from reddwarf.db.sqlalchemy.migrate_repo.schema import Table

meta = MetaData()

security_groups = Table(
    'security_groups',
    meta,
    Column('id', String(length=36), primary_key=True, nullable=False),
    Column('name', String(length=255)),
    Column('description', String(length=255)),
    Column('user', String(length=255)),
    Column('tenant_id', String(length=255)),
    Column('created', DateTime()),
    Column('updated', DateTime()),
    Column('deleted', Boolean(), default=0),
    Column('deleted_at', DateTime()),
)

security_group_instance_associations = Table(
    'security_group_instance_associations',
    meta,
    Column('id', String(length=36), primary_key=True, nullable=False),
    Column(
        'security_group_id', String(length=36),
        ForeignKey('security_groups.id',
                   ondelete="CASCADE",
Esempio n. 15
0
from reddwarf.db.sqlalchemy.migrate_repo.schema import Boolean
from reddwarf.db.sqlalchemy.migrate_repo.schema import create_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import DateTime
from reddwarf.db.sqlalchemy.migrate_repo.schema import drop_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import Integer
from reddwarf.db.sqlalchemy.migrate_repo.schema import BigInteger
from reddwarf.db.sqlalchemy.migrate_repo.schema import String
from reddwarf.db.sqlalchemy.migrate_repo.schema import Table

meta = MetaData()

instances = Table('instances', meta,
                  Column('id', String(36), primary_key=True, nullable=False),
                  Column('created', DateTime()), Column('updated', DateTime()),
                  Column('name', String(255)), Column('hostname', String(255)),
                  Column('compute_instance_id', String(36)),
                  Column('task_id', Integer()),
                  Column('task_description', String(32)),
                  Column('task_start_time', DateTime()),
                  Column('volume_id', String(36)))


def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([instances])


def downgrade(migrate_engine):
    meta.bind = migrate_engine
    drop_tables([instances])
Esempio n. 16
0
from sqlalchemy.schema import Column
from sqlalchemy.schema import MetaData
from sqlalchemy.schema import UniqueConstraint

from reddwarf.db.sqlalchemy.migrate_repo.schema import create_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import DateTime
from reddwarf.db.sqlalchemy.migrate_repo.schema import drop_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import Integer
from reddwarf.db.sqlalchemy.migrate_repo.schema import String
from reddwarf.db.sqlalchemy.migrate_repo.schema import Table

meta = MetaData()

usage_events = Table(
    'usage_events', meta,
    Column('id', String(36), primary_key=True, nullable=False),
    Column('instance_name', String(36)), Column('tenant_id', String(36)),
    Column('nova_instance_id', String(36)), Column('instance_size', Integer()),
    Column('nova_volume_id', String(36)), Column('volume_size', Integer()),
    Column('end_time', DateTime()), Column('updated', DateTime()))


def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([usage_events])


def downgrade(migrate_engine):
    meta.bind = migrate_engine
    drop_tables([usage_events])
Esempio n. 17
0
from sqlalchemy import ForeignKey
from sqlalchemy.schema import Column
from sqlalchemy.schema import MetaData
from sqlalchemy.schema import UniqueConstraint

from reddwarf.db.sqlalchemy.migrate_repo.schema import create_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import DateTime
from reddwarf.db.sqlalchemy.migrate_repo.schema import drop_tables
from reddwarf.db.sqlalchemy.migrate_repo.schema import String
from reddwarf.db.sqlalchemy.migrate_repo.schema import Table

meta = MetaData()

root_enabled_history = Table(
    'root_enabled_history',
    meta,
    Column('id', String(36), primary_key=True, nullable=False),
    Column('user', String(length=255)),
    Column('created', DateTime()),
)


def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([root_enabled_history])


def downgrade(migrate_engine):
    meta.bind = migrate_engine
    drop_tables([root_enabled_history])