mssql_script7.py 5.2 KB
import pyodbc

hil_sql = """
    ALTER TABLE hil_ca_compare_result ADD version nvarchar(8), comments nvarchar(max);
    ALTER TABLE hil_se_compare_result ADD version nvarchar(8), comments nvarchar(max);
    
    create table hil_se_compare_result_record
    (
       id int identity primary key,
       application_id nvarchar(64) not null,
       is_finish bit default 0 not null,
       compare_count smallint default 0 not null,
       failed_count smallint default 0 not null,
       reason1_count smallint default 0 not null,
       reason2_count smallint default 0 not null,
       reason3_count smallint default 0 not null,
       reason4_count smallint default 0 not null,
       reason5_count smallint default 0 not null,
       reason6_count smallint default 0 not null,
       reason7_count smallint default 0 not null,
       reason8_count smallint default 0 not null,
       reason9_count smallint default 0 not null,
       reason10_count smallint default 0 not null,
       result nvarchar(max),
       comments nvarchar(max),
       create_time datetime not null
    );
    
    create index hil_se_compare_result_record_application_id_index
       on hil_se_compare_result_record (application_id);
    
    create index hil_se_compare_result_record_create_time_index
        on hil_se_compare_result_record (create_time);
        
    create table hil_ca_compare_result_record
    (
       id int identity primary key,
       application_id nvarchar(64) not null,
       is_finish bit default 0 not null,
       compare_count smallint default 0 not null,
       failed_count smallint default 0 not null,
       reason1_count smallint default 0 not null,
       reason2_count smallint default 0 not null,
       reason3_count smallint default 0 not null,
       reason4_count smallint default 0 not null,
       reason5_count smallint default 0 not null,
       reason6_count smallint default 0 not null,
       reason7_count smallint default 0 not null,
       reason8_count smallint default 0 not null,
       reason9_count smallint default 0 not null,
       reason10_count smallint default 0 not null,
       result nvarchar(max),
       comments nvarchar(max),
       create_time datetime not null
    );
    
    create index hil_ca_compare_result_record_application_id_index
       on hil_ca_compare_result_record (application_id);
    
    create index hil_ca_compare_result_record_create_time_index
        on hil_ca_compare_result_record (create_time);
"""

afc_sql = """
    ALTER TABLE afc_ca_compare_result ADD version nvarchar(8), comments nvarchar(max);
    ALTER TABLE afc_se_compare_result ADD version nvarchar(8), comments nvarchar(max);
    
    create table afc_se_compare_result_record
    (
       id int identity primary key,
       application_id nvarchar(64) not null,
       is_finish bit default 0 not null,
       compare_count smallint default 0 not null,
       failed_count smallint default 0 not null,
       reason1_count smallint default 0 not null,
       reason2_count smallint default 0 not null,
       reason3_count smallint default 0 not null,
       reason4_count smallint default 0 not null,
       reason5_count smallint default 0 not null,
       reason6_count smallint default 0 not null,
       reason7_count smallint default 0 not null,
       reason8_count smallint default 0 not null,
       reason9_count smallint default 0 not null,
       reason10_count smallint default 0 not null,
       result nvarchar(max),
       comments nvarchar(max),
       create_time datetime not null
    );
    
    create index afc_se_compare_result_record_application_id_index
       on afc_se_compare_result_record (application_id);
    
    create index afc_se_compare_result_record_create_time_index
        on afc_se_compare_result_record (create_time);
        
    create table afc_ca_compare_result_record
    (
       id int identity primary key,
       application_id nvarchar(64) not null,
       is_finish bit default 0 not null,
       compare_count smallint default 0 not null,
       failed_count smallint default 0 not null,
       reason1_count smallint default 0 not null,
       reason2_count smallint default 0 not null,
       reason3_count smallint default 0 not null,
       reason4_count smallint default 0 not null,
       reason5_count smallint default 0 not null,
       reason6_count smallint default 0 not null,
       reason7_count smallint default 0 not null,
       reason8_count smallint default 0 not null,
       reason9_count smallint default 0 not null,
       reason10_count smallint default 0 not null,
       result nvarchar(max),
       comments nvarchar(max),
       create_time datetime not null
    );
    
    create index afc_ca_compare_result_record_application_id_index
       on afc_ca_compare_result_record (application_id);
    
    create index afc_ca_compare_result_record_create_time_index
        on afc_ca_compare_result_record (create_time);
"""

hil_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True)

hil_cursor = hil_cnxn.cursor()
hil_cursor.execute(hil_sql)

hil_cursor.close()
hil_cnxn.close()

afc_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True)

afc_cursor = afc_cnxn.cursor()
afc_cursor.execute(afc_sql)

afc_cursor.close()
afc_cnxn.close()