
from sqlalchemy import *


meta = MetaData()

compute_nodes = Table("compute_nodes", meta, Column("id", Integer(),
        primary_key=True, nullable=False))

hypervisor_hostname = Column("hypervisor_hostname", String(255))


def upgrade(migrate_engine):
    meta.bind = migrate_engine
    compute_nodes.create_column(hypervisor_hostname)


def downgrade(migrate_engine):
    meta.bind = migrate_engine
    compute_nodes.drop_column(hypervisor_hostname)


from sqlalchemy import Column, MetaData, String, Table


def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine
    compute_nodes = Table("compute_nodes", meta, autoload=True)
    hypervisor_hostname = Column("hypervisor_hostname", String(255))
    compute_nodes.create_column(hypervisor_hostname)


def downgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine
    compute_nodes = Table("compute_nodes", meta, autoload=True)
    compute_nodes.drop_column('hypervisor_hostname')

Use sqlalchemy reflection in migration 080
Use sqlalchemy reflection in migration 080

Change-Id: If2a0e59461d108d59c6e9907d3db053ba2b44f57

  
+ from sqlalchemy import Column, MetaData, String, Table
- from sqlalchemy import *
- 
- 
- meta = MetaData()
- 
- compute_nodes = Table("compute_nodes", meta, Column("id", Integer(),
-         primary_key=True, nullable=False))
- 
- hypervisor_hostname = Column("hypervisor_hostname", String(255))
  
  
  def upgrade(migrate_engine):
+     meta = MetaData()
      meta.bind = migrate_engine
+     compute_nodes = Table("compute_nodes", meta, autoload=True)
+     hypervisor_hostname = Column("hypervisor_hostname", String(255))
      compute_nodes.create_column(hypervisor_hostname)
  
  
  def downgrade(migrate_engine):
+     meta = MetaData()
      meta.bind = migrate_engine
+     compute_nodes = Table("compute_nodes", meta, autoload=True)
-     compute_nodes.drop_column(hypervisor_hostname)
+     compute_nodes.drop_column('hypervisor_hostname')
  
Use sqlalchemy reflection in migration 080
## Code Before:

from sqlalchemy import *


meta = MetaData()

compute_nodes = Table("compute_nodes", meta, Column("id", Integer(),
        primary_key=True, nullable=False))

hypervisor_hostname = Column("hypervisor_hostname", String(255))


def upgrade(migrate_engine):
    meta.bind = migrate_engine
    compute_nodes.create_column(hypervisor_hostname)


def downgrade(migrate_engine):
    meta.bind = migrate_engine
    compute_nodes.drop_column(hypervisor_hostname)

## Instruction:
Use sqlalchemy reflection in migration 080
## Code After:

from sqlalchemy import Column, MetaData, String, Table


def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine
    compute_nodes = Table("compute_nodes", meta, autoload=True)
    hypervisor_hostname = Column("hypervisor_hostname", String(255))
    compute_nodes.create_column(hypervisor_hostname)


def downgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine
    compute_nodes = Table("compute_nodes", meta, autoload=True)
    compute_nodes.drop_column('hypervisor_hostname')
