summaryrefslogtreecommitdiff
path: root/ironic/db/sqlalchemy/alembic/versions/5ea1b0d310e_added_port_group_table_and_altered_ports.py
blob: 7b1eacbe0739ddf9973a3d30d076b4f12eedda16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#    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.

"""Added portgroups table and altered ports

Revision ID: 5ea1b0d310e
Revises: 48d6c242bb9b
Create Date: 2015-06-30 14:14:26.972368

"""

from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = '5ea1b0d310e'
down_revision = '48d6c242bb9b'


def upgrade():
    op.create_table('portgroups',
                    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('node_id', sa.Integer(), nullable=True),
                    sa.Column('address', sa.String(length=18), nullable=True),
                    sa.Column('extra', sa.Text(), nullable=True),
                    sa.ForeignKeyConstraint(['node_id'], ['nodes.id'], ),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('uuid', name='uniq_portgroups0uuid'),
                    sa.UniqueConstraint('address',
                                        name='uniq_portgroups0address'),
                    sa.UniqueConstraint('name', name='uniq_portgroups0name'),
                    mysql_engine='InnoDB',
                    mysql_charset='UTF8MB3')
    op.add_column(u'ports', sa.Column('local_link_connection', sa.Text(),
                                      nullable=True))
    op.add_column(u'ports', sa.Column('portgroup_id', sa.Integer(),
                                      nullable=True))
    op.add_column(u'ports', sa.Column('pxe_enabled', sa.Boolean(),
                                      default=True))
    op.create_foreign_key('fk_portgroups_ports', 'ports', 'portgroups',
                          ['portgroup_id'], ['id'])