IF NOT EXISTS (SELECT * FROM sysobjects WHERE Name='AR_PAGOTIC_WS_Configuracion' AND xtype='U')
BEGIN
	CREATE TABLE AR_PAGOTIC_WS_Configuracion
	(
		Id_Configuracion			INT NOT NULL IDENTITY(0,1),
		Descripcion					VARCHAR(100),
		Activo						TINYINT,
		Fecha_Alta					DATETIME,
		Fecha_Baja					DATETIME,
		Username					VARCHAR(50),
		Password					VARCHAR(50),
		Client_Id					VARCHAR(100),
		Client_Secret				VARCHAR(100),
		Url_WebService				VARCHAR(255),
		Fecha_Ult_Solicitud_Token	DATETIME,
		Fecha_Expiracion_Token		DATETIME,
		Access_Token				VARCHAR(8000),
		Refresh_Token				VARCHAR(8000),
		Token_Type					VARCHAR(10),
		Session_State				VARCHAR(50)
	)
END
GO

IF EXISTS (SELECT * FROM sysobjects WHERE Name='AR_PAGOTIC_WS_Configuracion' AND xtype='U')
BEGIN
	ALTER TABLE AR_PAGOTIC_WS_Configuracion ADD CONSTRAINT PK_APTWCC_PorId PRIMARY KEY CLUSTERED (Id_Configuracion)	
END
GO

IF EXISTS (SELECT * FROM sysobjects WHERE Name='AR_PAGOTIC_WS_Configuracion' AND xtype='U')
BEGIN
	CREATE INDEX IX_APTWCC_PorDescrip ON AR_PAGOTIC_WS_Configuracion (Descripcion)
END
GO

