using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Exferia_EntityFramework.Script_Actualizacion
{
    class Scripts_Version_1412
    {
        public static Version G_VRS_VERSION = new Version("1.4.1.2");
        public static long G_LNG_VERSION = 1412;
        public static int G_INT_TIPO = 0;
        public static string G_STR_SCRIPT =
                                    //CREAR TABLA SGA_SoportesCabecera
                                    $@"IF exists 
                                      (
                                        SELECT *
                                            FROM INFORMATION_SCHEMA.COLUMNS
                                            WHERE COLUMN_NAME='importeSSAE' AND TABLE_NAME = '{nameof(MAE_Empleados)}'
                                      )
                                    BEGIN
                                        ALTER TABLE [{nameof(MAE_Empleados)}] DROP COLUMN importeSSAE
                                    END

                                    IF not exists 
                                      (
                                        SELECT *
                                            FROM INFORMATION_SCHEMA.COLUMNS
                                            WHERE COLUMN_NAME='idMayor_ImporteSSAE' AND TABLE_NAME = '{nameof(MAE_Empleados)}'
                                      )
                                    BEGIN
                                        ALTER TABLE [{nameof(MAE_Empleados)}] ADD [idMayor_ImporteSSAE]  [bigint] NULL
                                        ALTER TABLE [{nameof(MAE_Empleados)}] WITH CHECK ADD CONSTRAINT [FK_MAE_Empleados_CTA_Mayor_IMPORTE] FOREIGN KEY([idMayor_ImporteSSAE]) REFERENCES CTA_Mayor ([id])
                                    END
                                    ";
    }
}
