# Generated by Django 3.2.14 on 2022-07-11 06:24

from django.db import migrations


class Migration(migrations.Migration):
    create_views = '''
CREATE VIEW TASK_CONFIG_V as
    SELECT concat(CATEGORY_TYPE, '-', CATEGORY_TYPE, '-', TASK) as CATEGORY_TYPE_CATEGORY_TYPE_TASK, CATEGORY_TYPE, PROCESS_TYPE, TASK, SRC_PATH, TARGET_PATH, FILE_FORMAT, VERSION, ENCODING, TRANS_CHINESE_DATE from TASK_CONFIG;

CREATE VIEW TO_CONFIG_V as
    SELECT concat(FROM_PARTY_ID, '-', PARTY_ID) as FROM_PARTY_ID_PARTY_ID, PARTY_ID, PARTY_DESCRIPTION, ROUTING_ID, ROUTING_DESCRIPTION, FROM_PARTY_ID from TO_CONFIG;

CREATE VIEW TURNKEY_MESSAGE_LOG_V as
    SELECT concat(SEQNO, '-', SUBSEQNO) as SEQNO_SUBSEQNO, SEQNO, SUBSEQNO, UUID, MESSAGE_TYPE, CATEGORY_TYPE, PROCESS_TYPE, FROM_PARTY_ID, TO_PARTY_ID, MESSAGE_DTS, CHARACTER_COUNT, STATUS, IN_OUT_BOUND, FROM_ROUTING_ID, TO_ROUTING_ID, INVOICE_IDENTIFIER from TURNKEY_MESSAGE_LOG;

CREATE VIEW TURNKEY_MESSAGE_LOG_DETAIL_V as
    SELECT concat(SEQNO, '-', SUBSEQNO, '-', TASK) as SEQNO_SUBSEQNO_TASK, SEQNO, SUBSEQNO, PROCESS_DTS, TASK, STATUS, FILENAME, UUID from TURNKEY_MESSAGE_LOG_DETAIL;
'''

    dependencies = [
        ('turnkey_wrapper', '0001_initial'),
    ]

    operations = [
        migrations.RunSQL(create_views)
    ]
