fae86fcfd306_upgrade_table_reklame.py 5.75 KB
"""upgrade table reklame

Revision ID: fae86fcfd306
Revises: cc1cac32d25f
Create Date: 2023-03-31 14:50:41.452509

"""

# revision identifiers, used by Alembic.
revision = 'fae86fcfd306'
down_revision = 'cc1cac32d25f'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
    schema = 'pad'
    context = op.get_context()
    helpers = context.opts['helpers']
    # if not helpers.table_has_column('pad_rk_nilai_lokasi', 'status_id', schema):
    #     op.add_column('pad_rk_nilai_lokasi',
    #                   sa.Column('status_id', sa.Integer), schema=schema)
    # if not helpers.table_has_column('pad_rk_nilai_lokasi', 'other_score', schema):
    #     op.add_column('pad_rk_nilai_lokasi',
    #                   sa.Column('other_score', sa.Integer), schema=schema)
    # if not helpers.table_has_column('pad_rk_nilai_kelas_jalan', 'status_id', schema):
    #     op.add_column('pad_rk_nilai_kelas_jalan',
    #                   sa.Column('status_id', sa.Integer), schema=schema)
    # if not helpers.table_has_column('pad_rk_nilai_kelas_jalan', 'other_score', schema):
    #     op.add_column('pad_rk_nilai_kelas_jalan',
    #                   sa.Column('other_score', sa.Integer), schema=schema)
    # if not helpers.table_has_column('pad_rk_nilai_sudut_pandang', 'status_id', schema):
    #     op.add_column('pad_rk_nilai_sudut_pandang',
    #                   sa.Column('status_id', sa.Integer), schema=schema)
    # if not helpers.table_has_column('pad_rk_nilai_sudut_pandang', 'other_score', schema):
    #     op.add_column('pad_rk_nilai_sudut_pandang',
    #                   sa.Column('other_score', sa.Integer), schema=schema)
    # if not helpers.table_has_column('pad_rk_ketinggian', 'status_id', schema):
    #     op.add_column('pad_rk_ketinggian',
    #                   sa.Column('status_id', sa.Integer), schema=schema)
        
    if not helpers.table_has_column('pad_customer_usaha', 'status_id', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('status_id', sa.Integer), schema=schema)
    if not helpers.table_has_column('pad_customer_usaha', 'pajak_id', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('pajak_id', sa.Integer), schema=schema)
    if not helpers.table_has_column('pad_customer_usaha', 'cahaya_id', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('cahaya_id', sa.Integer), schema=schema)
    if not helpers.table_has_column('pad_customer_usaha', 'pasang_id', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('pasang_id', sa.Integer), schema=schema)
    if not helpers.table_has_column('pad_customer_usaha', 'bahan', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('bahan', sa.String(256)), schema=schema)
    if not helpers.table_has_column('pad_customer_usaha', 'letak_reklame_id', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('letak_reklame_id', sa.Integer), schema=schema)

    if not helpers.table_has_column('pad_customer_usaha', 'produk_reklame_id', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('produk_reklame_id', sa.Integer), schema=schema)

    if not helpers.table_has_column('pad_customer_usaha', 'sudut_pandang_id', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('sudut_pandang_id', sa.Integer), schema=schema)

    if not helpers.table_has_column('pad_customer_usaha', 'lokasi_id', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('lokasi_id', sa.Integer), schema=schema)

    if not helpers.table_has_column('pad_customer_usaha', 'kelas_jalan_id', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('kelas_jalan_id', sa.Integer), schema=schema)

    if not helpers.table_has_column('pad_customer_usaha', 'panjang', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('panjang', sa.Float), schema=schema)
    if not helpers.table_has_column('pad_customer_usaha', 'lebar', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('lebar', sa.Float), schema=schema)
    if not helpers.table_has_column('pad_customer_usaha', 'luas', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('luas', sa.Float), schema=schema)
    if not helpers.table_has_column('pad_customer_usaha', 'tinggi', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('tinggi', sa.Float), schema=schema)
        
    if not helpers.table_has_column('pad_customer_usaha', 'muka', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('muka', sa.Integer), schema=schema)
    if not helpers.table_has_column('pad_customer_usaha', 'banyak', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('banyak', sa.Integer), schema=schema)
    if not helpers.table_has_column('pad_customer_usaha', 'njopr', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('njopr', sa.Float), schema=schema)
        
    if not helpers.table_has_column('pad_customer_usaha', 'nspr', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('nspr', sa.Float), schema=schema)
        
    if not helpers.table_has_column('pad_customer_usaha', 'nsr', schema):
        op.add_column('pad_customer_usaha',
                      sa.Column('nsr', sa.Float), schema=schema)
        
    if not helpers.table_has_column('pad_rek_lokasi_pasang', 'lahan', schema):
        op.add_column('pad_rek_lokasi_pasang',
                      sa.Column('lahan', sa.String(50)), schema=schema)
        
def downgrade():
    pass