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

namespace Exferia_EntityFramework.Script_Actualizacion
{
    class Scripts_Version_1299
    {
        public static Version G_VRS_VERSION = new Version("1.2.9.9");
        public static long G_LNG_VERSION = 1299;
        public static int G_INT_TIPO = 0;
        public static string G_STR_SCRIPT =
                                     //BORRAR campo idVendedor a la tabla COM_Pagos
                                     "IF exists " +
                                      "( " +
                                      "    SELECT * " +
                                      "    FROM INFORMATION_SCHEMA.COLUMNS " +
                                      "    WHERE COLUMN_NAME='idVendedor' AND TABLE_NAME = 'COM_Pagos' " +
                                      ") " +
                                    "BEGIN " +
                                        " ALTER TABLE COM_Pagos DROP CONSTRAINT[FK_COM_Pagos_MAE_Vendedores] " +
                                        " ALTER TABLE COM_Pagos DROP COLUMN [idVendedor] " +
                                    "END " +
                                     //BORRAR campo idEmpresa a la tabla COM_RemesasAcumulados
                                     "IF exists " +
                                      "( " +
                                      "    SELECT * " +
                                      "    FROM INFORMATION_SCHEMA.COLUMNS " +
                                      "    WHERE COLUMN_NAME='idEmpresa' AND TABLE_NAME = 'COM_RemesasAcumulados' " +
                                      ") " +
                                    "BEGIN " +
                                        " ALTER TABLE COM_RemesasAcumulados DROP CONSTRAINT[FK_COM_RemesasAcumulados_GEN_Empresas] " +
                                        " ALTER TABLE COM_RemesasAcumulados DROP COLUMN [idEmpresa] " +
                                    "END " +
                                     //BORRAR campo resumen_AcumularNegativos a la tabla COM_RemesasCabecera
                                     "IF exists " +
                                      "( " +
                                      "    SELECT * " +
                                      "    FROM INFORMATION_SCHEMA.COLUMNS " +
                                      "    WHERE COLUMN_NAME='resumen_AcumularNegativos' AND TABLE_NAME = 'COM_RemesasCabecera' " +
                                      ") " +
                                    "BEGIN " +
                                        " ALTER TABLE COM_RemesasCabecera DROP COLUMN [resumen_AcumularNegativos] " +
                                    "END " +
                                     //BORRAR campo norma_Tipo a la tabla COM_RemesasCabecera
                                     "IF exists " +
                                      "( " +
                                      "    SELECT * " +
                                      "    FROM INFORMATION_SCHEMA.COLUMNS " +
                                      "    WHERE COLUMN_NAME='norma_Tipo' AND TABLE_NAME = 'COM_RemesasCabecera' " +
                                      ") " +
                                    "BEGIN " +
                                        " ALTER TABLE COM_RemesasCabecera DROP COLUMN [norma_Tipo] " +
                                    "END " +
                                     //AÑADIR campo tipoPago a la tabla COM_RemesasCabecera
                                     "IF not exists " +
                                      "( " +
                                      "    SELECT * " +
                                      "    FROM INFORMATION_SCHEMA.COLUMNS " +
                                      "    WHERE COLUMN_NAME='tipoPago' AND TABLE_NAME = 'COM_RemesasCabecera' " +
                                      ") " +
                                    "BEGIN " +
                                        " ALTER TABLE [COM_RemesasCabecera]ADD[tipoPago] int NULL  " +
                                    "END ";









    }
}
