untitled notebook

node v8.14.0
version: 1.0.0
endpointsharetweet
/* ==Scripting Parameters== Source Server Version : SQL Server 2016 (13.0.4206) Source Database Engine Edition : Microsoft SQL Server Enterprise Edition Source Database Engine Type : Standalone SQL Server Target Server Version : SQL Server 2017 Target Database Engine Edition : Microsoft SQL Server Standard Edition Target Database Engine Type : Standalone SQL Server */ USE [RealState] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Usuarios]') AND type in (N'U')) ALTER TABLE [dbo].[Usuarios] DROP CONSTRAINT IF EXISTS [FK_Usuarios_Preguntas] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Usuarios]') AND type in (N'U')) ALTER TABLE [dbo].[Usuarios] DROP CONSTRAINT IF EXISTS [FK_Usuarios_MunicipiosCiudades] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Publicaciones]') AND type in (N'U')) ALTER TABLE [dbo].[Publicaciones] DROP CONSTRAINT IF EXISTS [FK_Publicaciones_Usuarios] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Publicaciones]') AND type in (N'U')) ALTER TABLE [dbo].[Publicaciones] DROP CONSTRAINT IF EXISTS [FK_Publicaciones_GruposGeograficos] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Propiedades]') AND type in (N'U')) ALTER TABLE [dbo].[Propiedades] DROP CONSTRAINT IF EXISTS [FK_Propiedades_Usuarios] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Propiedades]') AND type in (N'U')) ALTER TABLE [dbo].[Propiedades] DROP CONSTRAINT IF EXISTS [FK_Propiedades_TiposTransaccion] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Propiedades]') AND type in (N'U')) ALTER TABLE [dbo].[Propiedades] DROP CONSTRAINT IF EXISTS [FK_Propiedades_TiposPropiedad] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Propiedades]') AND type in (N'U')) ALTER TABLE [dbo].[Propiedades] DROP CONSTRAINT IF EXISTS [FK_Propiedades_MunicipiosCiudades] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Propiedades]') AND type in (N'U')) ALTER TABLE [dbo].[Propiedades] DROP CONSTRAINT IF EXISTS [FK_Propiedades_EstadosPropiedad] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Propiedades]') AND type in (N'U')) ALTER TABLE [dbo].[Propiedades] DROP CONSTRAINT IF EXISTS [FK_Propiedades_Contactos] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Plantillas]') AND type in (N'U')) ALTER TABLE [dbo].[Plantillas] DROP CONSTRAINT IF EXISTS [FK_Plantillas_Usuarios] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Plantillas]') AND type in (N'U')) ALTER TABLE [dbo].[Plantillas] DROP CONSTRAINT IF EXISTS [FK_Plantillas_TiposPlantillas] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Notificaciones]') AND type in (N'U')) ALTER TABLE [dbo].[Notificaciones] DROP CONSTRAINT IF EXISTS [FK_Notificaciones_Usuarios] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Notificaciones]') AND type in (N'U')) ALTER TABLE [dbo].[Notificaciones] DROP CONSTRAINT IF EXISTS [FK_Notificaciones_TiposNotificaciones] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MunicipiosCiudades]') AND type in (N'U')) ALTER TABLE [dbo].[MunicipiosCiudades] DROP CONSTRAINT IF EXISTS [FK_MunicipiosCiudades_DepartamentoEstado] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Mensajes]') AND type in (N'U')) ALTER TABLE [dbo].[Mensajes] DROP CONSTRAINT IF EXISTS [FK_Mensajes_Usuarios_idUsuarioRecive] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Mensajes]') AND type in (N'U')) ALTER TABLE [dbo].[Mensajes] DROP CONSTRAINT IF EXISTS [FK_Mensajes_Usuarios_idUsuarioEnvia] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Match]') AND type in (N'U')) ALTER TABLE [dbo].[Match] DROP CONSTRAINT IF EXISTS [FK_Match_Usuarios] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Match]') AND type in (N'U')) ALTER TABLE [dbo].[Match] DROP CONSTRAINT IF EXISTS [FK_Match_TiposPropiedad] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Match]') AND type in (N'U')) ALTER TABLE [dbo].[Match] DROP CONSTRAINT IF EXISTS [FK_Match_TiposMatch] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Match]') AND type in (N'U')) ALTER TABLE [dbo].[Match] DROP CONSTRAINT IF EXISTS [FK_Match_Contactos] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GruposGeograficos]') AND type in (N'U')) ALTER TABLE [dbo].[GruposGeograficos] DROP CONSTRAINT IF EXISTS [FK_GruposGeograficos_Usuarios] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GruposGeograficos]') AND type in (N'U')) ALTER TABLE [dbo].[GruposGeograficos] DROP CONSTRAINT IF EXISTS [FK_GruposGeograficos_DepartamentoEstado] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FiltrosTipoPropiedad]') AND type in (N'U')) ALTER TABLE [dbo].[FiltrosTipoPropiedad] DROP CONSTRAINT IF EXISTS [FK_FiltrosTipoPropiedad_TiposPropiedad] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FiltrosTipoPropiedad]') AND type in (N'U')) ALTER TABLE [dbo].[FiltrosTipoPropiedad] DROP CONSTRAINT IF EXISTS [FK_FiltrosTipoPropiedad_Filtros] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FiltrosBusqueda]') AND type in (N'U')) ALTER TABLE [dbo].[FiltrosBusqueda] DROP CONSTRAINT IF EXISTS [FK_FiltrosBusqueda_Busquedas] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Eventos]') AND type in (N'U')) ALTER TABLE [dbo].[Eventos] DROP CONSTRAINT IF EXISTS [FK_Eventos_Usuarios] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Eventos]') AND type in (N'U')) ALTER TABLE [dbo].[Eventos] DROP CONSTRAINT IF EXISTS [FK_Eventos_TiposEvento] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Eventos]') AND type in (N'U')) ALTER TABLE [dbo].[Eventos] DROP CONSTRAINT IF EXISTS [FK_Eventos_Contactos] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DepartamentoEstado]') AND type in (N'U')) ALTER TABLE [dbo].[DepartamentoEstado] DROP CONSTRAINT IF EXISTS [FK_DepartamentoEstado_Paises] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Contactos]') AND type in (N'U')) ALTER TABLE [dbo].[Contactos] DROP CONSTRAINT IF EXISTS [FK_Contactos_Usuarios] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Contactos]') AND type in (N'U')) ALTER TABLE [dbo].[Contactos] DROP CONSTRAINT IF EXISTS [FK_Contactos_TiposContactos1] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Contactos]') AND type in (N'U')) ALTER TABLE [dbo].[Contactos] DROP CONSTRAINT IF EXISTS [FK_Contactos_MunicipiosCiudades] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ComodinesPlantilla]') AND type in (N'U')) ALTER TABLE [dbo].[ComodinesPlantilla] DROP CONSTRAINT IF EXISTS [FK_ComodinesPlantilla_TiposComodin] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Calificaciones]') AND type in (N'U')) ALTER TABLE [dbo].[Calificaciones] DROP CONSTRAINT IF EXISTS [FK_Calificaciones_Usuarios_idUsuarioRecive] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Calificaciones]') AND type in (N'U')) ALTER TABLE [dbo].[Calificaciones] DROP CONSTRAINT IF EXISTS [FK_Calificaciones_Usuarios_idUsuarioEnvia] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Calificaciones]') AND type in (N'U')) ALTER TABLE [dbo].[Calificaciones] DROP CONSTRAINT IF EXISTS [FK_Calificaciones_Propiedades] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Calificaciones]') AND type in (N'U')) ALTER TABLE [dbo].[Calificaciones] DROP CONSTRAINT IF EXISTS [FK_Calificaciones_CriteriosCalificacion] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Busquedas]') AND type in (N'U')) ALTER TABLE [dbo].[Busquedas] DROP CONSTRAINT IF EXISTS [FK_Busquedas_Usuarios] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Alianzas]') AND type in (N'U')) ALTER TABLE [dbo].[Alianzas] DROP CONSTRAINT IF EXISTS [FK_Alianzas_Usuarios_idUsuarioPropiedad] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Alianzas]') AND type in (N'U')) ALTER TABLE [dbo].[Alianzas] DROP CONSTRAINT IF EXISTS [FK_Alianzas_Usuarios_idUsuarioAlianza] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Alianzas]') AND type in (N'U')) ALTER TABLE [dbo].[Alianzas] DROP CONSTRAINT IF EXISTS [FK_Alianzas_Propiedades] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Alianzas]') AND type in (N'U')) ALTER TABLE [dbo].[Alianzas] DROP CONSTRAINT IF EXISTS [FK_Alianzas_EstadosAlianza] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Usuarios]') AND type in (N'U')) ALTER TABLE [dbo].[Usuarios] DROP CONSTRAINT IF EXISTS [DF_Usuarios_esAgente] GO /****** Object: Table [dbo].[Usuarios] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Usuarios] GO /****** Object: Table [dbo].[TiposTransaccion] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[TiposTransaccion] GO /****** Object: Table [dbo].[TiposPropiedad] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[TiposPropiedad] GO /****** Object: Table [dbo].[TiposPlantillas] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[TiposPlantillas] GO /****** Object: Table [dbo].[TiposNotificaciones] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[TiposNotificaciones] GO /****** Object: Table [dbo].[TiposMatch] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[TiposMatch] GO /****** Object: Table [dbo].[TiposEvento] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[TiposEvento] GO /****** Object: Table [dbo].[TiposContactos] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[TiposContactos] GO /****** Object: Table [dbo].[TiposComodin] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[TiposComodin] GO /****** Object: Table [dbo].[Publicaciones] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Publicaciones] GO /****** Object: Table [dbo].[Propiedades] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Propiedades] GO /****** Object: Table [dbo].[Preguntas] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Preguntas] GO /****** Object: Table [dbo].[Plantillas] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Plantillas] GO /****** Object: Table [dbo].[Paises] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Paises] GO /****** Object: Table [dbo].[Notificaciones] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Notificaciones] GO /****** Object: Table [dbo].[MunicipiosCiudades] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[MunicipiosCiudades] GO /****** Object: Table [dbo].[Mensajes] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Mensajes] GO /****** Object: Table [dbo].[Match] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Match] GO /****** Object: Table [dbo].[GruposGeograficos] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[GruposGeograficos] GO /****** Object: Table [dbo].[FiltrosTipoPropiedad] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[FiltrosTipoPropiedad] GO /****** Object: Table [dbo].[FiltrosBusqueda] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[FiltrosBusqueda] GO /****** Object: Table [dbo].[Filtros] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Filtros] GO /****** Object: Table [dbo].[Eventos] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Eventos] GO /****** Object: Table [dbo].[EstadosPropiedad] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[EstadosPropiedad] GO /****** Object: Table [dbo].[EstadosAlianza] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[EstadosAlianza] GO /****** Object: Table [dbo].[DepartamentoEstado] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[DepartamentoEstado] GO /****** Object: Table [dbo].[CriteriosCalificacion] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[CriteriosCalificacion] GO /****** Object: Table [dbo].[Contactos] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Contactos] GO /****** Object: Table [dbo].[ComodinesPlantilla] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[ComodinesPlantilla] GO /****** Object: Table [dbo].[Calificaciones] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Calificaciones] GO /****** Object: Table [dbo].[Busquedas] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Busquedas] GO /****** Object: Table [dbo].[Alianzas] Script Date: 8/8/2018 06:44:24 ******/ DROP TABLE IF EXISTS [dbo].[Alianzas] GO /****** Object: Table [dbo].[Alianzas] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Alianzas]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Alianzas]( [codigo] [int] IDENTITY(1,1) NOT NULL, [idUsuarioPropiedad] [int] NOT NULL, [idUsuarioAlianza] [int] NOT NULL, [idEstadoAlianza] [int] NOT NULL, [idPropiedad] [int] NOT NULL, [fecha] [datetime] NOT NULL, [comicion] [decimal](3, 2) NOT NULL, CONSTRAINT [PK_Alianzas] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Busquedas] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Busquedas]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Busquedas]( [codigo] [int] IDENTITY(1,1) NOT NULL, [idUsuario] [int] NOT NULL, [fecha] [datetime] NOT NULL, CONSTRAINT [PK_Busquedas] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Calificaciones] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Calificaciones]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Calificaciones]( [codigo] [int] IDENTITY(1,1) NOT NULL, [idUsuarioEnvia] [int] NOT NULL, [idUsuarioRecibe] [int] NOT NULL, [idPropiedad] [int] NOT NULL, [idCriterio] [int] NOT NULL, [valor] [int] NOT NULL, [fecha] [datetime] NOT NULL, CONSTRAINT [PK_Calificaciones] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[ComodinesPlantilla] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ComodinesPlantilla]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[ComodinesPlantilla]( [codigo] [int] IDENTITY(1,1) NOT NULL, [tag] [varchar](80) NOT NULL, [idTipoComodin] [int] NOT NULL, CONSTRAINT [PK_ComodinesPlantilla] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Contactos] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Contactos]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Contactos]( [codigo] [int] IDENTITY(1,1) NOT NULL, [idUsuario] [int] NOT NULL, [idTipoContacto] [int] NOT NULL, [nombre] [varchar](80) NOT NULL, [telefono] [varchar](25) NOT NULL, [direccion] [varchar](256) NULL, [ciudadMunicipio] [int] NOT NULL, [sexo] [int] NOT NULL, [fechaNacimiento] [date] NULL, CONSTRAINT [PK_Contactos] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[CriteriosCalificacion] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CriteriosCalificacion]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[CriteriosCalificacion]( [codigo] [int] IDENTITY(1,1) NOT NULL, [descripcion] [varchar](80) NOT NULL, CONSTRAINT [PK_CriteriosCalificacion] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[DepartamentoEstado] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DepartamentoEstado]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DepartamentoEstado]( [codigo] [int] IDENTITY(1,1) NOT NULL, [nombre] [varchar](50) NOT NULL, [idPais] [int] NOT NULL, CONSTRAINT [PK_DepartamentoEstado] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[EstadosAlianza] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EstadosAlianza]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[EstadosAlianza]( [codigo] [int] IDENTITY(1,1) NOT NULL, [descripcion] [varchar](80) NOT NULL, CONSTRAINT [PK_EstadosAlianza] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[EstadosPropiedad] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EstadosPropiedad]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[EstadosPropiedad]( [codigo] [int] IDENTITY(1,1) NOT NULL, [descripcion] [varchar](80) NOT NULL, CONSTRAINT [PK_EstadosPropiedad] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Eventos] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Eventos]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Eventos]( [codigo] [int] IDENTITY(1,1) NOT NULL, [idTipoEvento] [int] NOT NULL, [idUsuario] [int] NOT NULL, [nota] [varchar](128) NULL, [idContacto] [int] NOT NULL, [fecha] [datetime] NOT NULL, CONSTRAINT [PK_Eventos] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Filtros] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Filtros]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Filtros]( [codigo] [int] NOT NULL, [descripcion] [varchar](80) NOT NULL, [tipo] [varchar](25) NOT NULL, CONSTRAINT [PK_Filtros] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[FiltrosBusqueda] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FiltrosBusqueda]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[FiltrosBusqueda]( [codigo] [int] IDENTITY(1,1) NOT NULL, [idBusqueda] [int] NOT NULL, [idFiltro] [int] NOT NULL, [valor] [varchar](80) NOT NULL, CONSTRAINT [PK_FiltrosBusqueda] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[FiltrosTipoPropiedad] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FiltrosTipoPropiedad]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[FiltrosTipoPropiedad]( [codigo] [int] NOT NULL, [idFiltro] [int] NOT NULL, [idTipoPropiedad] [int] NOT NULL, [activo] [char](1) NOT NULL, CONSTRAINT [PK_FiltrosTipoPropiedad] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[GruposGeograficos] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GruposGeograficos]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[GruposGeograficos]( [codigo] [int] IDENTITY(1,1) NOT NULL, [idDepartamentoEstado] [int] NOT NULL, [idUsuario] [int] NOT NULL, CONSTRAINT [PK_GruposGeograficos] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Match] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Match]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Match]( [codigo] [int] IDENTITY(1,1) NOT NULL, [idUsuario] [int] NOT NULL, [idContacto] [int] NOT NULL, [idTipoPropiedad] [int] NOT NULL, [idTipoMatch] [int] NOT NULL, [fecha] [datetime] NOT NULL, CONSTRAINT [PK_Match] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Mensajes] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Mensajes]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Mensajes]( [codigo] [int] IDENTITY(1,1) NOT NULL, [idUsuarioEnvia] [int] NOT NULL, [idUsuarioRecibe] [int] NOT NULL, [texto] [varchar](256) NOT NULL, [fecha] [datetime] NOT NULL, CONSTRAINT [PK_Mensajes] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[MunicipiosCiudades] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MunicipiosCiudades]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MunicipiosCiudades]( [codigo] [int] IDENTITY(1,1) NOT NULL, [idDepartamentoEstado] [int] NOT NULL, [nombre] [varchar](80) NOT NULL, CONSTRAINT [PK_MunicipiosCiudades] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Notificaciones] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Notificaciones]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Notificaciones]( [codigo] [int] IDENTITY(1,1) NOT NULL, [idUsuario] [int] NOT NULL, [fecha] [datetime] NOT NULL, [idTipoNotificacion] [int] NOT NULL, [url] [varchar](128) NOT NULL, [estado] [char](1) NOT NULL, [descripcion] [varchar](128) NOT NULL, CONSTRAINT [PK_Notificaciones] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Paises] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Paises]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Paises]( [codigo] [int] IDENTITY(1,1) NOT NULL, [nombre] [varchar](50) NOT NULL, [codigoISO] [char](2) NOT NULL, CONSTRAINT [PK_Paises] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Plantillas] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Plantillas]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Plantillas]( [codigo] [int] IDENTITY(1,1) NOT NULL, [idTipoPlantilla] [int] NOT NULL, [texto] [varchar](512) NOT NULL, [idUsuario] [int] NOT NULL, CONSTRAINT [PK_Plantillas] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Preguntas] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Preguntas]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Preguntas]( [codigo] [int] IDENTITY(1,1) NOT NULL, [descripcion] [varchar](128) NOT NULL, CONSTRAINT [PK_Preguntas] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Propiedades] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Propiedades]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Propiedades]( [codigo] [int] IDENTITY(1,1) NOT NULL, [idUsuario] [int] NOT NULL, [idContacto] [int] NOT NULL, [idTipoTransaccion] [int] NOT NULL, [ubicaconesGPS] [varchar](80) NOT NULL, [idMunicipioCiudad] [int] NOT NULL, [idEstadoPropiedad] [int] NOT NULL, [precio] [decimal](9, 2) NOT NULL, [idTipoPropiedad] [int] NOT NULL, [areaConstruccion] [decimal](9, 2) NOT NULL, [areaNoConstrucion] [decimal](9, 2) NULL, [cantidadDormitorios] [int] NULL, [agua] [char](2) NULL, [luz] [char](2) NULL, [descripcionLibre] [varchar](500) NULL, CONSTRAINT [PK_Propiedades] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Publicaciones] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Publicaciones]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Publicaciones]( [codigo] [int] IDENTITY(1,1) NOT NULL, [texto] [varchar](256) NOT NULL, [idUsuario] [int] NOT NULL, [idGrupoGeografico] [int] NOT NULL, [fecha] [datetime] NOT NULL, CONSTRAINT [PK_Publicaciones] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[TiposComodin] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TiposComodin]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[TiposComodin]( [codigo] [int] IDENTITY(1,1) NOT NULL, [descripcion] [varchar](128) NOT NULL, CONSTRAINT [PK_TiposComodin] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[TiposContactos] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TiposContactos]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[TiposContactos]( [codigo] [int] IDENTITY(1,1) NOT NULL, [nombre] [varchar](80) NOT NULL, CONSTRAINT [PK_TiposContactos] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[TiposEvento] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TiposEvento]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[TiposEvento]( [codigo] [int] IDENTITY(1,1) NOT NULL, [descripcion] [varchar](80) NOT NULL, CONSTRAINT [PK_TiposEvento] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[TiposMatch] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TiposMatch]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[TiposMatch]( [codigo] [int] IDENTITY(1,1) NOT NULL, [descripcion] [varchar](128) NOT NULL, CONSTRAINT [PK_TiposMatch] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[TiposNotificaciones] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TiposNotificaciones]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[TiposNotificaciones]( [codigo] [int] IDENTITY(1,1) NOT NULL, [descripcion] [varchar](128) NOT NULL, CONSTRAINT [PK_TiposNotificaciones] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[TiposPlantillas] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TiposPlantillas]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[TiposPlantillas]( [codigo] [int] IDENTITY(1,1) NOT NULL, [descripcion] [varchar](80) NOT NULL, CONSTRAINT [PK_TiposPlantillas] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[TiposPropiedad] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TiposPropiedad]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[TiposPropiedad]( [codigo] [int] IDENTITY(1,1) NOT NULL, [descripcion] [varchar](80) NOT NULL, CONSTRAINT [PK_TiposPropiedad] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[TiposTransaccion] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TiposTransaccion]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[TiposTransaccion]( [codigo] [int] IDENTITY(1,1) NOT NULL, [descripcion] [varchar](80) NOT NULL, CONSTRAINT [PK_TiposTransaccion] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO /****** Object: Table [dbo].[Usuarios] Script Date: 8/8/2018 06:44:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Usuarios]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[Usuarios]( [codigo] [int] IDENTITY(1,1) NOT NULL, [nombres] [varchar](50) NOT NULL, [apellidos] [varchar](50) NOT NULL, [telefono] [varchar](25) NULL, [direccion] [varchar](250) NULL, [ciudadMunicipio] [int] NULL, [sexo] [char](1) NULL, [fechaNacimiento] [date] NULL, [usuario] [varchar](50) NOT NULL, [clave] [varchar](100) NULL, [pregunta] [int] NULL, [respuesta] [varchar](50) NULL, [esAgente] [int] NOT NULL, [activo] [bit] NULL, CONSTRAINT [PK_Usuarios] PRIMARY KEY CLUSTERED ( [codigo] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] END GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF_Usuarios_esAgente]') AND type = 'D') BEGIN ALTER TABLE [dbo].[Usuarios] ADD CONSTRAINT [DF_Usuarios_esAgente] DEFAULT ((0)) FOR [esAgente] END GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Alianzas_EstadosAlianza]') AND parent_object_id = OBJECT_ID(N'[dbo].[Alianzas]')) ALTER TABLE [dbo].[Alianzas] WITH CHECK ADD CONSTRAINT [FK_Alianzas_EstadosAlianza] FOREIGN KEY([idEstadoAlianza]) REFERENCES [dbo].[EstadosAlianza] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Alianzas_EstadosAlianza]') AND parent_object_id = OBJECT_ID(N'[dbo].[Alianzas]')) ALTER TABLE [dbo].[Alianzas] CHECK CONSTRAINT [FK_Alianzas_EstadosAlianza] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Alianzas_Propiedades]') AND parent_object_id = OBJECT_ID(N'[dbo].[Alianzas]')) ALTER TABLE [dbo].[Alianzas] WITH CHECK ADD CONSTRAINT [FK_Alianzas_Propiedades] FOREIGN KEY([idPropiedad]) REFERENCES [dbo].[Propiedades] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Alianzas_Propiedades]') AND parent_object_id = OBJECT_ID(N'[dbo].[Alianzas]')) ALTER TABLE [dbo].[Alianzas] CHECK CONSTRAINT [FK_Alianzas_Propiedades] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Alianzas_Usuarios_idUsuarioAlianza]') AND parent_object_id = OBJECT_ID(N'[dbo].[Alianzas]')) ALTER TABLE [dbo].[Alianzas] WITH CHECK ADD CONSTRAINT [FK_Alianzas_Usuarios_idUsuarioAlianza] FOREIGN KEY([idUsuarioAlianza]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Alianzas_Usuarios_idUsuarioAlianza]') AND parent_object_id = OBJECT_ID(N'[dbo].[Alianzas]')) ALTER TABLE [dbo].[Alianzas] CHECK CONSTRAINT [FK_Alianzas_Usuarios_idUsuarioAlianza] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Alianzas_Usuarios_idUsuarioPropiedad]') AND parent_object_id = OBJECT_ID(N'[dbo].[Alianzas]')) ALTER TABLE [dbo].[Alianzas] WITH CHECK ADD CONSTRAINT [FK_Alianzas_Usuarios_idUsuarioPropiedad] FOREIGN KEY([idUsuarioPropiedad]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Alianzas_Usuarios_idUsuarioPropiedad]') AND parent_object_id = OBJECT_ID(N'[dbo].[Alianzas]')) ALTER TABLE [dbo].[Alianzas] CHECK CONSTRAINT [FK_Alianzas_Usuarios_idUsuarioPropiedad] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Busquedas_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Busquedas]')) ALTER TABLE [dbo].[Busquedas] WITH CHECK ADD CONSTRAINT [FK_Busquedas_Usuarios] FOREIGN KEY([idUsuario]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Busquedas_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Busquedas]')) ALTER TABLE [dbo].[Busquedas] CHECK CONSTRAINT [FK_Busquedas_Usuarios] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Calificaciones_CriteriosCalificacion]') AND parent_object_id = OBJECT_ID(N'[dbo].[Calificaciones]')) ALTER TABLE [dbo].[Calificaciones] WITH CHECK ADD CONSTRAINT [FK_Calificaciones_CriteriosCalificacion] FOREIGN KEY([idCriterio]) REFERENCES [dbo].[CriteriosCalificacion] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Calificaciones_CriteriosCalificacion]') AND parent_object_id = OBJECT_ID(N'[dbo].[Calificaciones]')) ALTER TABLE [dbo].[Calificaciones] CHECK CONSTRAINT [FK_Calificaciones_CriteriosCalificacion] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Calificaciones_Propiedades]') AND parent_object_id = OBJECT_ID(N'[dbo].[Calificaciones]')) ALTER TABLE [dbo].[Calificaciones] WITH CHECK ADD CONSTRAINT [FK_Calificaciones_Propiedades] FOREIGN KEY([idPropiedad]) REFERENCES [dbo].[Propiedades] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Calificaciones_Propiedades]') AND parent_object_id = OBJECT_ID(N'[dbo].[Calificaciones]')) ALTER TABLE [dbo].[Calificaciones] CHECK CONSTRAINT [FK_Calificaciones_Propiedades] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Calificaciones_Usuarios_idUsuarioEnvia]') AND parent_object_id = OBJECT_ID(N'[dbo].[Calificaciones]')) ALTER TABLE [dbo].[Calificaciones] WITH CHECK ADD CONSTRAINT [FK_Calificaciones_Usuarios_idUsuarioEnvia] FOREIGN KEY([idUsuarioEnvia]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Calificaciones_Usuarios_idUsuarioEnvia]') AND parent_object_id = OBJECT_ID(N'[dbo].[Calificaciones]')) ALTER TABLE [dbo].[Calificaciones] CHECK CONSTRAINT [FK_Calificaciones_Usuarios_idUsuarioEnvia] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Calificaciones_Usuarios_idUsuarioRecive]') AND parent_object_id = OBJECT_ID(N'[dbo].[Calificaciones]')) ALTER TABLE [dbo].[Calificaciones] WITH CHECK ADD CONSTRAINT [FK_Calificaciones_Usuarios_idUsuarioRecive] FOREIGN KEY([idUsuarioRecibe]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Calificaciones_Usuarios_idUsuarioRecive]') AND parent_object_id = OBJECT_ID(N'[dbo].[Calificaciones]')) ALTER TABLE [dbo].[Calificaciones] CHECK CONSTRAINT [FK_Calificaciones_Usuarios_idUsuarioRecive] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_ComodinesPlantilla_TiposComodin]') AND parent_object_id = OBJECT_ID(N'[dbo].[ComodinesPlantilla]')) ALTER TABLE [dbo].[ComodinesPlantilla] WITH CHECK ADD CONSTRAINT [FK_ComodinesPlantilla_TiposComodin] FOREIGN KEY([idTipoComodin]) REFERENCES [dbo].[TiposComodin] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_ComodinesPlantilla_TiposComodin]') AND parent_object_id = OBJECT_ID(N'[dbo].[ComodinesPlantilla]')) ALTER TABLE [dbo].[ComodinesPlantilla] CHECK CONSTRAINT [FK_ComodinesPlantilla_TiposComodin] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Contactos_MunicipiosCiudades]') AND parent_object_id = OBJECT_ID(N'[dbo].[Contactos]')) ALTER TABLE [dbo].[Contactos] WITH CHECK ADD CONSTRAINT [FK_Contactos_MunicipiosCiudades] FOREIGN KEY([ciudadMunicipio]) REFERENCES [dbo].[MunicipiosCiudades] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Contactos_MunicipiosCiudades]') AND parent_object_id = OBJECT_ID(N'[dbo].[Contactos]')) ALTER TABLE [dbo].[Contactos] CHECK CONSTRAINT [FK_Contactos_MunicipiosCiudades] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Contactos_TiposContactos1]') AND parent_object_id = OBJECT_ID(N'[dbo].[Contactos]')) ALTER TABLE [dbo].[Contactos] WITH CHECK ADD CONSTRAINT [FK_Contactos_TiposContactos1] FOREIGN KEY([idTipoContacto]) REFERENCES [dbo].[TiposContactos] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Contactos_TiposContactos1]') AND parent_object_id = OBJECT_ID(N'[dbo].[Contactos]')) ALTER TABLE [dbo].[Contactos] CHECK CONSTRAINT [FK_Contactos_TiposContactos1] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Contactos_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Contactos]')) ALTER TABLE [dbo].[Contactos] WITH CHECK ADD CONSTRAINT [FK_Contactos_Usuarios] FOREIGN KEY([idUsuario]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Contactos_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Contactos]')) ALTER TABLE [dbo].[Contactos] CHECK CONSTRAINT [FK_Contactos_Usuarios] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_DepartamentoEstado_Paises]') AND parent_object_id = OBJECT_ID(N'[dbo].[DepartamentoEstado]')) ALTER TABLE [dbo].[DepartamentoEstado] WITH CHECK ADD CONSTRAINT [FK_DepartamentoEstado_Paises] FOREIGN KEY([idPais]) REFERENCES [dbo].[Paises] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_DepartamentoEstado_Paises]') AND parent_object_id = OBJECT_ID(N'[dbo].[DepartamentoEstado]')) ALTER TABLE [dbo].[DepartamentoEstado] CHECK CONSTRAINT [FK_DepartamentoEstado_Paises] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Eventos_Contactos]') AND parent_object_id = OBJECT_ID(N'[dbo].[Eventos]')) ALTER TABLE [dbo].[Eventos] WITH CHECK ADD CONSTRAINT [FK_Eventos_Contactos] FOREIGN KEY([idContacto]) REFERENCES [dbo].[Contactos] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Eventos_Contactos]') AND parent_object_id = OBJECT_ID(N'[dbo].[Eventos]')) ALTER TABLE [dbo].[Eventos] CHECK CONSTRAINT [FK_Eventos_Contactos] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Eventos_TiposEvento]') AND parent_object_id = OBJECT_ID(N'[dbo].[Eventos]')) ALTER TABLE [dbo].[Eventos] WITH CHECK ADD CONSTRAINT [FK_Eventos_TiposEvento] FOREIGN KEY([idTipoEvento]) REFERENCES [dbo].[TiposEvento] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Eventos_TiposEvento]') AND parent_object_id = OBJECT_ID(N'[dbo].[Eventos]')) ALTER TABLE [dbo].[Eventos] CHECK CONSTRAINT [FK_Eventos_TiposEvento] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Eventos_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Eventos]')) ALTER TABLE [dbo].[Eventos] WITH CHECK ADD CONSTRAINT [FK_Eventos_Usuarios] FOREIGN KEY([idUsuario]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Eventos_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Eventos]')) ALTER TABLE [dbo].[Eventos] CHECK CONSTRAINT [FK_Eventos_Usuarios] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_FiltrosBusqueda_Busquedas]') AND parent_object_id = OBJECT_ID(N'[dbo].[FiltrosBusqueda]')) ALTER TABLE [dbo].[FiltrosBusqueda] WITH CHECK ADD CONSTRAINT [FK_FiltrosBusqueda_Busquedas] FOREIGN KEY([idBusqueda]) REFERENCES [dbo].[Busquedas] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_FiltrosBusqueda_Busquedas]') AND parent_object_id = OBJECT_ID(N'[dbo].[FiltrosBusqueda]')) ALTER TABLE [dbo].[FiltrosBusqueda] CHECK CONSTRAINT [FK_FiltrosBusqueda_Busquedas] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_FiltrosTipoPropiedad_Filtros]') AND parent_object_id = OBJECT_ID(N'[dbo].[FiltrosTipoPropiedad]')) ALTER TABLE [dbo].[FiltrosTipoPropiedad] WITH CHECK ADD CONSTRAINT [FK_FiltrosTipoPropiedad_Filtros] FOREIGN KEY([idFiltro]) REFERENCES [dbo].[Filtros] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_FiltrosTipoPropiedad_Filtros]') AND parent_object_id = OBJECT_ID(N'[dbo].[FiltrosTipoPropiedad]')) ALTER TABLE [dbo].[FiltrosTipoPropiedad] CHECK CONSTRAINT [FK_FiltrosTipoPropiedad_Filtros] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_FiltrosTipoPropiedad_TiposPropiedad]') AND parent_object_id = OBJECT_ID(N'[dbo].[FiltrosTipoPropiedad]')) ALTER TABLE [dbo].[FiltrosTipoPropiedad] WITH CHECK ADD CONSTRAINT [FK_FiltrosTipoPropiedad_TiposPropiedad] FOREIGN KEY([idTipoPropiedad]) REFERENCES [dbo].[TiposPropiedad] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_FiltrosTipoPropiedad_TiposPropiedad]') AND parent_object_id = OBJECT_ID(N'[dbo].[FiltrosTipoPropiedad]')) ALTER TABLE [dbo].[FiltrosTipoPropiedad] CHECK CONSTRAINT [FK_FiltrosTipoPropiedad_TiposPropiedad] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_GruposGeograficos_DepartamentoEstado]') AND parent_object_id = OBJECT_ID(N'[dbo].[GruposGeograficos]')) ALTER TABLE [dbo].[GruposGeograficos] WITH CHECK ADD CONSTRAINT [FK_GruposGeograficos_DepartamentoEstado] FOREIGN KEY([idDepartamentoEstado]) REFERENCES [dbo].[DepartamentoEstado] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_GruposGeograficos_DepartamentoEstado]') AND parent_object_id = OBJECT_ID(N'[dbo].[GruposGeograficos]')) ALTER TABLE [dbo].[GruposGeograficos] CHECK CONSTRAINT [FK_GruposGeograficos_DepartamentoEstado] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_GruposGeograficos_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[GruposGeograficos]')) ALTER TABLE [dbo].[GruposGeograficos] WITH CHECK ADD CONSTRAINT [FK_GruposGeograficos_Usuarios] FOREIGN KEY([idUsuario]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_GruposGeograficos_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[GruposGeograficos]')) ALTER TABLE [dbo].[GruposGeograficos] CHECK CONSTRAINT [FK_GruposGeograficos_Usuarios] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Match_Contactos]') AND parent_object_id = OBJECT_ID(N'[dbo].[Match]')) ALTER TABLE [dbo].[Match] WITH CHECK ADD CONSTRAINT [FK_Match_Contactos] FOREIGN KEY([idContacto]) REFERENCES [dbo].[Contactos] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Match_Contactos]') AND parent_object_id = OBJECT_ID(N'[dbo].[Match]')) ALTER TABLE [dbo].[Match] CHECK CONSTRAINT [FK_Match_Contactos] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Match_TiposMatch]') AND parent_object_id = OBJECT_ID(N'[dbo].[Match]')) ALTER TABLE [dbo].[Match] WITH CHECK ADD CONSTRAINT [FK_Match_TiposMatch] FOREIGN KEY([idTipoMatch]) REFERENCES [dbo].[TiposMatch] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Match_TiposMatch]') AND parent_object_id = OBJECT_ID(N'[dbo].[Match]')) ALTER TABLE [dbo].[Match] CHECK CONSTRAINT [FK_Match_TiposMatch] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Match_TiposPropiedad]') AND parent_object_id = OBJECT_ID(N'[dbo].[Match]')) ALTER TABLE [dbo].[Match] WITH CHECK ADD CONSTRAINT [FK_Match_TiposPropiedad] FOREIGN KEY([idTipoPropiedad]) REFERENCES [dbo].[TiposPropiedad] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Match_TiposPropiedad]') AND parent_object_id = OBJECT_ID(N'[dbo].[Match]')) ALTER TABLE [dbo].[Match] CHECK CONSTRAINT [FK_Match_TiposPropiedad] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Match_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Match]')) ALTER TABLE [dbo].[Match] WITH CHECK ADD CONSTRAINT [FK_Match_Usuarios] FOREIGN KEY([idUsuario]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Match_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Match]')) ALTER TABLE [dbo].[Match] CHECK CONSTRAINT [FK_Match_Usuarios] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Mensajes_Usuarios_idUsuarioEnvia]') AND parent_object_id = OBJECT_ID(N'[dbo].[Mensajes]')) ALTER TABLE [dbo].[Mensajes] WITH CHECK ADD CONSTRAINT [FK_Mensajes_Usuarios_idUsuarioEnvia] FOREIGN KEY([idUsuarioEnvia]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Mensajes_Usuarios_idUsuarioEnvia]') AND parent_object_id = OBJECT_ID(N'[dbo].[Mensajes]')) ALTER TABLE [dbo].[Mensajes] CHECK CONSTRAINT [FK_Mensajes_Usuarios_idUsuarioEnvia] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Mensajes_Usuarios_idUsuarioRecive]') AND parent_object_id = OBJECT_ID(N'[dbo].[Mensajes]')) ALTER TABLE [dbo].[Mensajes] WITH CHECK ADD CONSTRAINT [FK_Mensajes_Usuarios_idUsuarioRecive] FOREIGN KEY([idUsuarioRecibe]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Mensajes_Usuarios_idUsuarioRecive]') AND parent_object_id = OBJECT_ID(N'[dbo].[Mensajes]')) ALTER TABLE [dbo].[Mensajes] CHECK CONSTRAINT [FK_Mensajes_Usuarios_idUsuarioRecive] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_MunicipiosCiudades_DepartamentoEstado]') AND parent_object_id = OBJECT_ID(N'[dbo].[MunicipiosCiudades]')) ALTER TABLE [dbo].[MunicipiosCiudades] WITH CHECK ADD CONSTRAINT [FK_MunicipiosCiudades_DepartamentoEstado] FOREIGN KEY([idDepartamentoEstado]) REFERENCES [dbo].[DepartamentoEstado] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_MunicipiosCiudades_DepartamentoEstado]') AND parent_object_id = OBJECT_ID(N'[dbo].[MunicipiosCiudades]')) ALTER TABLE [dbo].[MunicipiosCiudades] CHECK CONSTRAINT [FK_MunicipiosCiudades_DepartamentoEstado] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Notificaciones_TiposNotificaciones]') AND parent_object_id = OBJECT_ID(N'[dbo].[Notificaciones]')) ALTER TABLE [dbo].[Notificaciones] WITH CHECK ADD CONSTRAINT [FK_Notificaciones_TiposNotificaciones] FOREIGN KEY([idTipoNotificacion]) REFERENCES [dbo].[TiposNotificaciones] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Notificaciones_TiposNotificaciones]') AND parent_object_id = OBJECT_ID(N'[dbo].[Notificaciones]')) ALTER TABLE [dbo].[Notificaciones] CHECK CONSTRAINT [FK_Notificaciones_TiposNotificaciones] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Notificaciones_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Notificaciones]')) ALTER TABLE [dbo].[Notificaciones] WITH CHECK ADD CONSTRAINT [FK_Notificaciones_Usuarios] FOREIGN KEY([idUsuario]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Notificaciones_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Notificaciones]')) ALTER TABLE [dbo].[Notificaciones] CHECK CONSTRAINT [FK_Notificaciones_Usuarios] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Plantillas_TiposPlantillas]') AND parent_object_id = OBJECT_ID(N'[dbo].[Plantillas]')) ALTER TABLE [dbo].[Plantillas] WITH CHECK ADD CONSTRAINT [FK_Plantillas_TiposPlantillas] FOREIGN KEY([idTipoPlantilla]) REFERENCES [dbo].[TiposPlantillas] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Plantillas_TiposPlantillas]') AND parent_object_id = OBJECT_ID(N'[dbo].[Plantillas]')) ALTER TABLE [dbo].[Plantillas] CHECK CONSTRAINT [FK_Plantillas_TiposPlantillas] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Plantillas_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Plantillas]')) ALTER TABLE [dbo].[Plantillas] WITH CHECK ADD CONSTRAINT [FK_Plantillas_Usuarios] FOREIGN KEY([idUsuario]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Plantillas_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Plantillas]')) ALTER TABLE [dbo].[Plantillas] CHECK CONSTRAINT [FK_Plantillas_Usuarios] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Propiedades_Contactos]') AND parent_object_id = OBJECT_ID(N'[dbo].[Propiedades]')) ALTER TABLE [dbo].[Propiedades] WITH CHECK ADD CONSTRAINT [FK_Propiedades_Contactos] FOREIGN KEY([idContacto]) REFERENCES [dbo].[Contactos] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Propiedades_Contactos]') AND parent_object_id = OBJECT_ID(N'[dbo].[Propiedades]')) ALTER TABLE [dbo].[Propiedades] CHECK CONSTRAINT [FK_Propiedades_Contactos] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Propiedades_EstadosPropiedad]') AND parent_object_id = OBJECT_ID(N'[dbo].[Propiedades]')) ALTER TABLE [dbo].[Propiedades] WITH CHECK ADD CONSTRAINT [FK_Propiedades_EstadosPropiedad] FOREIGN KEY([idEstadoPropiedad]) REFERENCES [dbo].[EstadosPropiedad] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Propiedades_EstadosPropiedad]') AND parent_object_id = OBJECT_ID(N'[dbo].[Propiedades]')) ALTER TABLE [dbo].[Propiedades] CHECK CONSTRAINT [FK_Propiedades_EstadosPropiedad] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Propiedades_MunicipiosCiudades]') AND parent_object_id = OBJECT_ID(N'[dbo].[Propiedades]')) ALTER TABLE [dbo].[Propiedades] WITH CHECK ADD CONSTRAINT [FK_Propiedades_MunicipiosCiudades] FOREIGN KEY([idMunicipioCiudad]) REFERENCES [dbo].[MunicipiosCiudades] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Propiedades_MunicipiosCiudades]') AND parent_object_id = OBJECT_ID(N'[dbo].[Propiedades]')) ALTER TABLE [dbo].[Propiedades] CHECK CONSTRAINT [FK_Propiedades_MunicipiosCiudades] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Propiedades_TiposPropiedad]') AND parent_object_id = OBJECT_ID(N'[dbo].[Propiedades]')) ALTER TABLE [dbo].[Propiedades] WITH CHECK ADD CONSTRAINT [FK_Propiedades_TiposPropiedad] FOREIGN KEY([idTipoPropiedad]) REFERENCES [dbo].[TiposPropiedad] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Propiedades_TiposPropiedad]') AND parent_object_id = OBJECT_ID(N'[dbo].[Propiedades]')) ALTER TABLE [dbo].[Propiedades] CHECK CONSTRAINT [FK_Propiedades_TiposPropiedad] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Propiedades_TiposTransaccion]') AND parent_object_id = OBJECT_ID(N'[dbo].[Propiedades]')) ALTER TABLE [dbo].[Propiedades] WITH CHECK ADD CONSTRAINT [FK_Propiedades_TiposTransaccion] FOREIGN KEY([idTipoTransaccion]) REFERENCES [dbo].[TiposTransaccion] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Propiedades_TiposTransaccion]') AND parent_object_id = OBJECT_ID(N'[dbo].[Propiedades]')) ALTER TABLE [dbo].[Propiedades] CHECK CONSTRAINT [FK_Propiedades_TiposTransaccion] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Propiedades_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Propiedades]')) ALTER TABLE [dbo].[Propiedades] WITH CHECK ADD CONSTRAINT [FK_Propiedades_Usuarios] FOREIGN KEY([idUsuario]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Propiedades_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Propiedades]')) ALTER TABLE [dbo].[Propiedades] CHECK CONSTRAINT [FK_Propiedades_Usuarios] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Publicaciones_GruposGeograficos]') AND parent_object_id = OBJECT_ID(N'[dbo].[Publicaciones]')) ALTER TABLE [dbo].[Publicaciones] WITH CHECK ADD CONSTRAINT [FK_Publicaciones_GruposGeograficos] FOREIGN KEY([idGrupoGeografico]) REFERENCES [dbo].[GruposGeograficos] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Publicaciones_GruposGeograficos]') AND parent_object_id = OBJECT_ID(N'[dbo].[Publicaciones]')) ALTER TABLE [dbo].[Publicaciones] CHECK CONSTRAINT [FK_Publicaciones_GruposGeograficos] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Publicaciones_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Publicaciones]')) ALTER TABLE [dbo].[Publicaciones] WITH CHECK ADD CONSTRAINT [FK_Publicaciones_Usuarios] FOREIGN KEY([idUsuario]) REFERENCES [dbo].[Usuarios] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Publicaciones_Usuarios]') AND parent_object_id = OBJECT_ID(N'[dbo].[Publicaciones]')) ALTER TABLE [dbo].[Publicaciones] CHECK CONSTRAINT [FK_Publicaciones_Usuarios] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Usuarios_MunicipiosCiudades]') AND parent_object_id = OBJECT_ID(N'[dbo].[Usuarios]')) ALTER TABLE [dbo].[Usuarios] WITH CHECK ADD CONSTRAINT [FK_Usuarios_MunicipiosCiudades] FOREIGN KEY([ciudadMunicipio]) REFERENCES [dbo].[MunicipiosCiudades] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Usuarios_MunicipiosCiudades]') AND parent_object_id = OBJECT_ID(N'[dbo].[Usuarios]')) ALTER TABLE [dbo].[Usuarios] CHECK CONSTRAINT [FK_Usuarios_MunicipiosCiudades] GO IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Usuarios_Preguntas]') AND parent_object_id = OBJECT_ID(N'[dbo].[Usuarios]')) ALTER TABLE [dbo].[Usuarios] WITH CHECK ADD CONSTRAINT [FK_Usuarios_Preguntas] FOREIGN KEY([pregunta]) REFERENCES [dbo].[Preguntas] ([codigo]) GO IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Usuarios_Preguntas]') AND parent_object_id = OBJECT_ID(N'[dbo].[Usuarios]')) ALTER TABLE [dbo].[Usuarios] CHECK CONSTRAINT [FK_Usuarios_Preguntas] GO
Loading…

no comments

    sign in to comment