# Generated by Django 3.2.20 on 2023-10-01 22:06

from django.db import migrations
from django.conf import settings


class Migration(migrations.Migration):

    dependencies = [
        ('payment', '0006_missing_fields_OP-1560'),
    ]

    operations = [
        migrations.RunSQL(sql="""
            CREATE SEQUENCE IF NOT EXISTS tblpayment_paymentid_seq;

            SELECT setval('tblpayment_paymentid_seq', COALESCE((SELECT MAX("PaymentID") FROM "tblPayment"), 0) + 1, false);

            ALTER TABLE public."tblPayment"
            ALTER COLUMN "PaymentID" SET DEFAULT nextval('tblpayment_paymentid_seq');

            ALTER SEQUENCE tblpayment_paymentid_seq OWNED BY public."tblPayment"."PaymentID";
        """, reverse_sql=""),
        migrations.RunSQL(sql="""
            CREATE SEQUENCE IF NOT EXISTS tblpaymentdetails_paymentdetailsid_seq;
            
            SELECT setval('tblpaymentdetails_paymentdetailsid_seq', COALESCE((SELECT MAX("PaymentDetailsID") FROM "tblPaymentDetails"), 0) + 1, false);
            
            ALTER TABLE public."tblPaymentDetails"
            ALTER COLUMN "PaymentDetailsID" SET DEFAULT nextval('tblpaymentdetails_paymentdetailsid_seq');
            
            ALTER SEQUENCE tblpaymentdetails_paymentdetailsid_seq OWNED BY public."tblPaymentDetails"."PaymentDetailsID";
        """, reverse_sql=""),
    ] if not settings.MSSQL else [
    ]


