Create build_data table

- Create alembic revision to add build_data table
- Create table schema

Change-Id: I45a4bb2a3d85856cee1638e0600ba8631e334a17
This commit is contained in:
Scott Hussey 2017-12-15 21:20:37 -06:00
parent 22b574c9b8
commit c9a3ab3d90
2 changed files with 55 additions and 3 deletions

View File

@ -0,0 +1,24 @@
"""create build_data table
Revision ID: 4a5bef3702b
Revises: 9593a123e7c5
Create Date: 2017-12-15 21:15:17.884404
"""
# revision identifiers, used by Alembic.
revision = '4a5bef3702b'
down_revision = '9593a123e7c5'
branch_labels = None
depends_on = None
from alembic import op
from drydock_provisioner.statemgmt.db import tables
def upgrade():
op.create_table(tables.BuildData.__tablename__, *tables.BuildData.__schema__)
def downgrade():
op.drop_table(tables.BuildData.__tablename__)

View File

@ -1,7 +1,20 @@
# Copyright 2017 AT&T Intellectual Property. All other rights reserved.
#
# 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.
"""Definitions for Drydock database tables."""
from sqlalchemy.schema import Table, Column
from sqlalchemy.types import Boolean, DateTime, String, Integer
from sqlalchemy.types import Boolean, DateTime, String, Integer, Text
from sqlalchemy.dialects import postgresql as pg
@ -89,10 +102,25 @@ class BootActionStatus(ExtendTable):
__tablename__ = 'boot_action_status'
__schema__ = [
Column('node_name', String(32)),
Column('node_name', String(32), index=True),
Column('action_id', pg.BYTEA(16), primary_key=True),
Column('action_name', String(64)),
Column('task_id', pg.BYTEA(16)),
Column('task_id', pg.BYTEA(16), index=True),
Column('identity_key', pg.BYTEA(32)),
Column('action_status', String(32)),
]
class BuildData(ExtendTable):
"""Table for persisting node build data."""
__tablename__ = 'build_data'
__schema__ = [
Column('node_name', String(32), index=True),
Column('task_id', pg.BYTEA(16), index=True),
Column('collected_date', DateTime),
Column('generator', String(256)),
Column('format', String(32)),
Column('data_element', Text),
]