Merge "Add replication controller to magnum db"

This commit is contained in:
Jenkins 2014-12-31 14:38:45 +00:00 committed by Gerrit Code Review
commit a4482c53d3
2 changed files with 34 additions and 0 deletions

View File

@ -116,6 +116,21 @@ def upgrade():
mysql_ENGINE='InnoDB',
mysql_DEFAULT_CHARSET='UTF8'
)
op.create_table(
'replicationcontroller',
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('uuid', sa.String(length=36), nullable=True),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('bay_uuid', sa.String(length=36), nullable=True),
sa.Column('images', sa.Text(), nullable=False),
sa.Column('selector', sa.Text(), nullable=True),
sa.Column('replicas', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id'),
mysql_ENGINE='InnoDB',
mysql_DEFAULT_CHARSET='UTF8'
)
# end Alembic commands
@ -126,6 +141,7 @@ def downgrade():
op.drop_table('node')
op.drop_table('service')
op.drop_table('pod')
op.drop_table('replicationcontroller')
# We should probably remove the drops later ;-)
# raise NotImplementedError(('Downgrade from initial migration is'
# ' unsupported.'))

View File

@ -207,3 +207,21 @@ class Service(Base):
selector = Column(JSONEncodedDict)
ip = Column(String(36))
port = Column(Integer())
class ReplicationController(Base):
"""Represents a pod replication controller."""
__tablename__ = 'replicationcontroller'
__table_args__ = (
schema.UniqueConstraint('uuid',
name='uniq_replicationcontroller0uuid'),
table_args()
)
id = Column(Integer, primary_key=True)
uuid = Column(String(36))
name = Column(String(255))
bay_uuid = Column(String(36))
images = Column(JSONEncodedList)
selector = Column(JSONEncodedDict)
replicas = Column(Integer())