CREATE DATABASE [CONTROLDESK]
GO

USE [CONTROLDESK]
GO
/****** Object:  Table [dbo].[BasesDeDatos]    Script Date: 3/14/2025 8:36:46 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BasesDeDatos](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[NodoSubNodo] [varchar](50) NOT NULL,
	[Activo] [int] NOT NULL,
	[RFC] [varchar](20) NULL,
	[Nombre] [varchar](100) NULL,
	[Sucursal] [varchar](100) NULL,
	[CorreoNotificacion] [varchar](100) NULL,
	[ServerName] [varchar](255) NOT NULL,
	[BDName] [varchar](255) NOT NULL,
	[SQLUser] [varchar](255) NULL,
	[SQLPassword] [varchar](255) NULL,
 CONSTRAINT [PK__BasesDeD__3214EC279D778C42] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Bitacora]    Script Date: 3/14/2025 8:36:46 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Bitacora](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Fecha] [nvarchar](10) NOT NULL,
	[Hora] [nvarchar](16) NOT NULL,
	[HoraSalida] [nvarchar](16) NULL,
	[TiempoTranscurrido] [varchar](255) NULL,
	[IDOperador] [int] NOT NULL,
	[IDNodoSubNodo] [int] NOT NULL,
	[Descripcion] [text] NOT NULL,
	[NombPagina] [varchar](75) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CambioEstadoBitacora]    Script Date: 3/14/2025 8:36:46 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CambioEstadoBitacora](
	[BitacoraID] [int] IDENTITY(1,1) NOT NULL,
	[UsuarioID] [int] NOT NULL,
	[EstadoNuevo] [int] NOT NULL,
	[FechaHoraCambio] [datetime] NOT NULL,
	[UsuarioResponsable] [nvarchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[BitacoraID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CorreosAdicionales]    Script Date: 3/14/2025 8:36:46 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CorreosAdicionales](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[NodoSubNodo] [varchar](50) NOT NULL,
	[correo] [varchar](255) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SetConfig]    Script Date: 3/14/2025 8:36:46 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SetConfig](
	[ID_Nodo] [int] NOT NULL,
	[NodoSubNodo] [varchar](50) NOT NULL,
	[LimEnt] [int] NOT NULL,
	[YearEnt] [int] NULL,
	[LimSal] [int] NOT NULL,
	[YearSal] [int] NULL,
	[LimAcf] [int] NOT NULL,
	[YearAct] [int] NULL,
	[LimMut] [int] NOT NULL,
	[YearMut] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID_Nodo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Usuarios]    Script Date: 3/14/2025 8:36:46 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Usuarios](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[IDNodoSubNodo] [int] NOT NULL,
	[ClienteAutoridad] [int] NOT NULL,
	[Nombre] [varchar](100) NULL,
	[Usuario] [varchar](50) NOT NULL,
	[Password] [varchar](8000) NOT NULL,
	[BD_Shelter] [varchar](100) NULL,
 CONSTRAINT [PK__Usuarios__3214EC2763B6A042] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BasesDeDatos] ADD  CONSTRAINT [DF__BasesDeDa__Activ__412EB0B6]  DEFAULT ((0)) FOR [Activo]
GO
ALTER TABLE [dbo].[Bitacora] ADD  DEFAULT ((0)) FOR [IDOperador]
GO
ALTER TABLE [dbo].[Bitacora] ADD  DEFAULT ((0)) FOR [IDNodoSubNodo]
GO
ALTER TABLE [dbo].[CambioEstadoBitacora] ADD  DEFAULT (getdate()) FOR [FechaHoraCambio]
GO
ALTER TABLE [dbo].[Usuarios] ADD  CONSTRAINT [DF__Usuarios__IDNodo__44FF419A]  DEFAULT ((0)) FOR [IDNodoSubNodo]
GO
ALTER TABLE [dbo].[Usuarios] ADD  CONSTRAINT [DF__Usuarios__Client__45F365D3]  DEFAULT ((0)) FOR [ClienteAutoridad]
GO
