IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_UpdateRuta_UpdateVersion_idModulo]') AND parent_object_id = OBJECT_ID(N'[dbo].[UpdateRuta]'))
ALTER TABLE [dbo].[UpdateRuta] DROP CONSTRAINT [FK_UpdateRuta_UpdateVersion_idModulo]
GO
/****** Object:  Table [dbo].[UpdateVersion]    Script Date: 29/01/2020 16:56:04:pm ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UpdateVersion]') AND type in (N'U'))
DROP TABLE [dbo].[UpdateVersion]
GO
/****** Object:  Table [dbo].[UpdateRuta]    Script Date: 29/01/2020 16:56:04:pm ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UpdateRuta]') AND type in (N'U'))
DROP TABLE [dbo].[UpdateRuta]
GO
/****** Object:  Table [dbo].[UpdateRuta]    Script Date: 29/01/2020 16:56:04:pm ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[UpdateRuta](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[idModulo] [int] NOT NULL,
	[ruta] [varchar](250) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[UpdateVersion]    Script Date: 29/01/2020 16:56:04:pm ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[UpdateVersion](
	[Id] [int] NOT NULL,
	[Modulo] [varchar](30) NOT NULL,
	[versionModulo] [int] 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) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[UpdateRuta] ON 
GO
INSERT [dbo].[UpdateRuta] ([Id], [idModulo], [ruta]) VALUES (1, 1, NULL)
GO
INSERT [dbo].[UpdateRuta] ([Id], [idModulo], [ruta]) VALUES (2, 2, NULL)
GO
INSERT [dbo].[UpdateRuta] ([Id], [idModulo], [ruta]) VALUES (3, 3, NULL)
GO
INSERT [dbo].[UpdateRuta] ([Id], [idModulo], [ruta]) VALUES (4, 4, NULL)
GO
INSERT [dbo].[UpdateRuta] ([Id], [idModulo], [ruta]) VALUES (5, 5, NULL)
GO
SET IDENTITY_INSERT [dbo].[UpdateRuta] OFF
GO
INSERT [dbo].[UpdateVersion] ([Id], [Modulo], [versionModulo]) VALUES (1, N'Syscom30', NULL)
GO
INSERT [dbo].[UpdateVersion] ([Id], [Modulo], [versionModulo]) VALUES (2, N'Syscom40', NULL)
GO
INSERT [dbo].[UpdateVersion] ([Id], [Modulo], [versionModulo]) VALUES (3, N'TransporteEspecial', NULL)
GO
INSERT [dbo].[UpdateVersion] ([Id], [Modulo], [versionModulo]) VALUES (4, N'SysParking', NULL)
GO
INSERT [dbo].[UpdateVersion] ([Id], [Modulo], [versionModulo]) VALUES (5, N'Pimag', NULL)
GO
ALTER TABLE [dbo].[UpdateRuta]  WITH CHECK ADD  CONSTRAINT [FK_UpdateRuta_UpdateVersion_idModulo] FOREIGN KEY([idModulo])
REFERENCES [dbo].[UpdateVersion] ([Id])
GO
ALTER TABLE [dbo].[UpdateRuta] CHECK CONSTRAINT [FK_UpdateRuta_UpdateVersion_idModulo]
GO