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

namespace Exferia_EntityFramework.Script_Actualizacion
{
    class Scripts_Version_1378
    {
        public static Version G_VRS_VERSION = new Version("1.3.7.8");
        public static long G_LNG_VERSION = 1378;
        public static int G_INT_TIPO = 0;
        public static string G_STR_SCRIPT =
                                     //AÑADIR campo tipoCodigoBarrasUbicacion a la tabla GEN_ControlSGA
                                     "IF not exists " +
                                      "( " +
                                      "    SELECT * " +
                                      "    FROM INFORMATION_SCHEMA.COLUMNS " +
                                      "    WHERE COLUMN_NAME='tipoCodigoBarrasUbicacion' AND TABLE_NAME = 'GEN_ControlSGA' " +
                                      ") " +
                                    "BEGIN " +
                                        " ALTER TABLE [GEN_ControlSGA]ADD[tipoCodigoBarrasUbicacion] varchar(1) NULL  " +
                                    "END " +
                                     //AÑADIR campo tipoCodigoBarrasUnidadLogistica a la tabla GEN_ControlSGA
                                     "IF not exists " +
                                      "( " +
                                      "    SELECT * " +
                                      "    FROM INFORMATION_SCHEMA.COLUMNS " +
                                      "    WHERE COLUMN_NAME='tipoCodigoBarrasUnidadLogistica' AND TABLE_NAME = 'GEN_ControlSGA' " +
                                      ") " +
                                    "BEGIN " +
                                        " ALTER TABLE [GEN_ControlSGA]ADD[tipoCodigoBarrasUnidadLogistica] varchar(1) NULL  " +
                                    "END " +
                                    //MODIFICAR CAMPO codigo en MAE_Ubicaciones
                                    " IF exists " +
                                       " ( " +
                                       "     SELECT * " +
                                       "     FROM INFORMATION_SCHEMA.COLUMNS " +
                                       "     WHERE COLUMN_NAME = 'codigo' AND TABLE_NAME = 'MAE_Ubicaciones' and CHARACTER_MAXIMUM_LENGTH = 13 " +
                                       " ) " +
                                    " BEGIN " +
                                       //Modificar Columna
                                       " ALTER TABLE[MAE_Ubicaciones] ALTER COLUMN[codigo] VARCHAR(20) NOt NULL " +
                                    " END ";





    }
}
