if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Billete_Cliente]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Billete] DROP CONSTRAINT FK_Billete_Cliente
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Billete_Cliente1]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Billete] DROP CONSTRAINT FK_Billete_Cliente1
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Mostrador_Compañia]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Mostrador] DROP CONSTRAINT FK_Mostrador_Compañia
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Vuelo_Compañia]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Vuelo] DROP CONSTRAINT FK_Vuelo_Compañia
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Avion_Hangar]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Avion] DROP CONSTRAINT FK_Avion_Hangar
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_PARENT_PuertaDeEmbarque_Puerta]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[PuertaDeEmbarque] DROP CONSTRAINT FK_PARENT_PuertaDeEmbarque_Puerta
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_PARENT_PuertaPorLaQueSeSale_Puerta]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[PuertaPorLaQueSeSale] DROP CONSTRAINT FK_PARENT_PuertaPorLaQueSeSale_Puerta
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Vuelo_Puerta]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Vuelo] DROP CONSTRAINT FK_Vuelo_Puerta
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_RutaRuta_mSiguientes]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[RutaRuta] DROP CONSTRAINT FK_RutaRuta_mSiguientes
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_RutaRuta_Ruta]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[RutaRuta] DROP CONSTRAINT FK_RutaRuta_Ruta
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Vuelo_Ruta]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Vuelo] DROP CONSTRAINT FK_Vuelo_Ruta
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_TarjetaDeEmbarque_PuertaDeEmbarque]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[TarjetaDeEmbarque] DROP CONSTRAINT FK_TarjetaDeEmbarque_PuertaDeEmbarque
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Billete_Vuelo]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Billete] DROP CONSTRAINT FK_Billete_Vuelo
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_InfoVuelo_Vuelo]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[InfoVuelo] DROP CONSTRAINT FK_InfoVuelo_Vuelo
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Avion_InfoVuelo]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Avion] DROP CONSTRAINT FK_Avion_InfoVuelo
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Billete_TarjetaDeEmbarque]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Billete] DROP CONSTRAINT FK_Billete_TarjetaDeEmbarque
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Equipaje_TarjetaDeEmbarque]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Equipaje] DROP CONSTRAINT FK_Equipaje_TarjetaDeEmbarque
GO

/****** Objeto: tabla [dbo].[Avion]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Avion]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Avion]
GO

/****** Objeto: tabla [dbo].[Billete]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Billete]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Billete]
GO

/****** Objeto: tabla [dbo].[Equipaje]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Equipaje]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Equipaje]
GO

/****** Objeto: tabla [dbo].[InfoVuelo]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[InfoVuelo]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[InfoVuelo]
GO

/****** Objeto: tabla [dbo].[TarjetaDeEmbarque]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TarjetaDeEmbarque]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[TarjetaDeEmbarque]
GO

/****** Objeto: tabla [dbo].[Mostrador]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Mostrador]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Mostrador]
GO

/****** Objeto: tabla [dbo].[PuertaDeEmbarque]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PuertaDeEmbarque]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[PuertaDeEmbarque]
GO

/****** Objeto: tabla [dbo].[PuertaPorLaQueSeSale]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PuertaPorLaQueSeSale]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[PuertaPorLaQueSeSale]
GO

/****** Objeto: tabla [dbo].[RutaRuta]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RutaRuta]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[RutaRuta]
GO

/****** Objeto: tabla [dbo].[Vuelo]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Vuelo]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Vuelo]
GO

/****** Objeto: tabla [dbo].[Cliente]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Cliente]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Cliente]
GO

/****** Objeto: tabla [dbo].[Compañia]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Compañia]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Compañia]
GO

/****** Objeto: tabla [dbo].[Hangar]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Hangar]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Hangar]
GO

/****** Objeto: tabla [dbo].[Puerta]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Puerta]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Puerta]
GO

/****** Objeto: tabla [dbo].[Ruta]    fecha de la secuencia de comandos: 18/11/2004 12:26:07 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Ruta]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Ruta]
GO

/****** Objeto: tabla [dbo].[Cliente]    fecha de la secuencia de comandos: 18/11/2004 12:26:08 ******/
CREATE TABLE [dbo].[Cliente] (
	[NIF] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[Nombre] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[Apellidos] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[Personal] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,

) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[Compañia]    fecha de la secuencia de comandos: 18/11/2004 12:26:08 ******/
CREATE TABLE [dbo].[Compañia] (
	[Compañia] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[Nombre] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[Hangar]    fecha de la secuencia de comandos: 18/11/2004 12:26:08 ******/
CREATE TABLE [dbo].[Hangar] (
	[Hangar] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[FechaEntrada] [datetime] NULL ,
	[Estado] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[Puerta]    fecha de la secuencia de comandos: 18/11/2004 12:26:08 ******/
CREATE TABLE [dbo].[Puerta] (
	[Puerta] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL 
) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[Ruta]    fecha de la secuencia de comandos: 18/11/2004 12:26:08 ******/
CREATE TABLE [dbo].[Ruta] (
	[Ruta] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[Origen] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[Destino] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[Distancia] [int] NULL 
) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[Mostrador]    fecha de la secuencia de comandos: 18/11/2004 12:26:08 ******/
CREATE TABLE [dbo].[Mostrador] (
	[Mostrador] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[Estado] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[CompañiaCompañia] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[PuertaDeEmbarque]    fecha de la secuencia de comandos: 18/11/2004 12:26:08 ******/
CREATE TABLE [dbo].[PuertaDeEmbarque] (
	[Puerta] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[FechaEmbarque] [datetime] NULL 
) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[PuertaPorLaQueSeSale]    fecha de la secuencia de comandos: 18/11/2004 12:26:08 ******/
CREATE TABLE [dbo].[PuertaPorLaQueSeSale] (
	[Puerta] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL 
) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[RutaRuta]    fecha de la secuencia de comandos: 18/11/2004 12:26:09 ******/
CREATE TABLE [dbo].[RutaRuta] (
	[Id] [int] IDENTITY (1, 1) NOT NULL ,
	[RutaAnterior] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[RutaSiguiente] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[Vuelo]    fecha de la secuencia de comandos: 18/11/2004 12:26:09 ******/
CREATE TABLE [dbo].[Vuelo] (
	[Vuelo] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[Frecuencia] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[PuertaPuerta] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[Compañia] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[Ruta] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL 
) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[InfoVuelo]    fecha de la secuencia de comandos: 18/11/2004 12:26:09 ******/
CREATE TABLE [dbo].[InfoVuelo] (
	[Vuelo] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[FechaSalida] [datetime] NULL ,
	[PrecioBase] [float] NOT NULL,
	[FechaLLegada] [datetime] NULL ,
	[Estado] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[VueloVuelo] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[TarjetaDeEmbarque]    fecha de la secuencia de comandos: 18/11/2004 12:26:09 ******/
CREATE TABLE [dbo].[TarjetaDeEmbarque] (
	[TE] [int] NOT NULL ,
	[TipoAsiento] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[FechaDeEmbarque] [datetime] NOT NULL ,
	[NumeroDeAsiento] [int] NOT NULL ,
	[LocalizadorBillete] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[PuertaDeEmbarque] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL 
) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[Avion]    fecha de la secuencia de comandos: 18/11/2004 12:26:09 ******/
CREATE TABLE [dbo].[Avion] (
	[Avion] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[Tipo] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[Capacidad] [int] NOT NULL,
	[Turista] [int] NOT NULL,
	[Distribucion] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[AsientosNoSeleccionables] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[AsientosReservados1] [int] NULL ,
	[AsientosReservados2] [int] NULL ,
	[AsientosReservados3] [int] NULL ,
	[AsientosReservados4] [int] NULL ,
	[VueloInfoVuelo] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[HangarHangar] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL 
) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[Billete]    fecha de la secuencia de comandos: 18/11/2004 12:26:09 ******/
CREATE TABLE [dbo].[Billete] (
	[Localizador] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[Clase] [int] NULL ,
	[Precio] [float] NULL ,
	[TETarjetaDeEmbarque] [int] NULL ,
	[IdVuelo] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[NIFPasajero] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[NIFReservador] [varchar] (50) COLLATE Modern_Spanish_CI_AS NULL ,
	[FechaReserva] [datetime] NULL
) ON [PRIMARY]
GO

/****** Objeto: tabla [dbo].[Equipaje]    fecha de la secuencia de comandos: 18/11/2004 12:26:09 ******/
CREATE TABLE [dbo].[Equipaje] (
	[Maleta] [int] NOT NULL ,
	[TarjetaDeEmbarque] [int] NOT NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Cliente] WITH NOCHECK ADD 
	CONSTRAINT [PK_Cliente] PRIMARY KEY  CLUSTERED 
	(
		[NIF]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Compañia] WITH NOCHECK ADD 
	CONSTRAINT [PK_Compañia] PRIMARY KEY  CLUSTERED 
	(
		[Compañia]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Hangar] WITH NOCHECK ADD 
	CONSTRAINT [PK_Hangar] PRIMARY KEY  CLUSTERED 
	(
		[Hangar]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Puerta] WITH NOCHECK ADD 
	CONSTRAINT [PK_Puerta] PRIMARY KEY  CLUSTERED 
	(
		[Puerta]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Ruta] WITH NOCHECK ADD 
	CONSTRAINT [PK_Ruta] PRIMARY KEY  CLUSTERED 
	(
		[Ruta]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Mostrador] WITH NOCHECK ADD 
	CONSTRAINT [PK_Mostrador] PRIMARY KEY  CLUSTERED 
	(
		[Mostrador]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[PuertaDeEmbarque] WITH NOCHECK ADD 
	CONSTRAINT [PK_PuertaDeEmbarque] PRIMARY KEY  CLUSTERED 
	(
		[Puerta]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[PuertaPorLaQueSeSale] WITH NOCHECK ADD 
	CONSTRAINT [PK_PuertaPorLaQueSeSale] PRIMARY KEY  CLUSTERED 
	(
		[Puerta]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[RutaRuta] WITH NOCHECK ADD 
	CONSTRAINT [PK_RutaRuta] PRIMARY KEY  CLUSTERED 
	(
		[Id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Vuelo] WITH NOCHECK ADD 
	CONSTRAINT [PK_Vuelo] PRIMARY KEY  CLUSTERED 
	(
		[Vuelo]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[InfoVuelo] WITH NOCHECK ADD 
	CONSTRAINT [PK_InfoVuelo] PRIMARY KEY  CLUSTERED 
	(
		[Vuelo]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[TarjetaDeEmbarque] WITH NOCHECK ADD 
	CONSTRAINT [PK_TarjetaDeEmbarque] PRIMARY KEY  CLUSTERED 
	(
		[TE]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Avion] WITH NOCHECK ADD 
	CONSTRAINT [PK_Avion] PRIMARY KEY  CLUSTERED 
	(
		[Avion]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Billete] WITH NOCHECK ADD 
	CONSTRAINT [PK_Billete] PRIMARY KEY  CLUSTERED 
	(
		[Localizador]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Equipaje] WITH NOCHECK ADD 
	CONSTRAINT [PK_Equipaje] PRIMARY KEY  CLUSTERED 
	(
		[Maleta]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[PuertaDeEmbarque] WITH NOCHECK ADD 
	CONSTRAINT [IX_PuertaDeEmbarque] UNIQUE  NONCLUSTERED 
	(
		[Puerta]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[PuertaPorLaQueSeSale] WITH NOCHECK ADD 
	CONSTRAINT [IX_PuertaPorLaQueSeSale] UNIQUE  NONCLUSTERED 
	(
		[Puerta]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Mostrador] ADD 
	CONSTRAINT [FK_Mostrador_Compañia] FOREIGN KEY 
	(
		[CompañiaCompañia]
	) REFERENCES [dbo].[Compañia] (
		[Compañia]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[PuertaDeEmbarque] ADD 
	CONSTRAINT [FK_PARENT_PuertaDeEmbarque_Puerta] FOREIGN KEY 
	(
		[Puerta]
	) REFERENCES [dbo].[Puerta] (
		[Puerta]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[PuertaPorLaQueSeSale] ADD 
	CONSTRAINT [FK_PARENT_PuertaPorLaQueSeSale_Puerta] FOREIGN KEY 
	(
		[Puerta]
	) REFERENCES [dbo].[Puerta] (
		[Puerta]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[RutaRuta] ADD 
	CONSTRAINT [FK_RutaRuta_mSiguientes] FOREIGN KEY 
	(
		[RutaAnterior]
	) REFERENCES [dbo].[Ruta] (
		[Ruta]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_RutaRuta_Ruta] FOREIGN KEY 
	(
		[RutaSiguiente]
	) REFERENCES [dbo].[Ruta] (
		[Ruta]
	)
GO

ALTER TABLE [dbo].[Vuelo] ADD 
	CONSTRAINT [FK_Vuelo_Compañia] FOREIGN KEY 
	(
		[Compañia]
	) REFERENCES [dbo].[Compañia] (
		[Compañia]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Vuelo_Puerta] FOREIGN KEY 
	(
		[PuertaPuerta]
	) REFERENCES [dbo].[Puerta] (
		[Puerta]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Vuelo_Ruta] FOREIGN KEY 
	(
		[Ruta]
	) REFERENCES [dbo].[Ruta] (
		[Ruta]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[InfoVuelo] ADD 
	CONSTRAINT [FK_InfoVuelo_Vuelo] FOREIGN KEY 
	(
		[VueloVuelo]
	) REFERENCES [dbo].[Vuelo] (
		[Vuelo]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[TarjetaDeEmbarque] ADD 
	CONSTRAINT [FK_TarjetaDeEmbarque_PuertaDeEmbarque] FOREIGN KEY 
	(
		[PuertaDeEmbarque]
	) REFERENCES [dbo].[PuertaDeEmbarque] (
		[Puerta]
	)
GO

ALTER TABLE [dbo].[Avion] ADD 
	CONSTRAINT [FK_Avion_Hangar] FOREIGN KEY 
	(
		[HangarHangar]
	) REFERENCES [dbo].[Hangar] (
		[Hangar]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Avion_InfoVuelo] FOREIGN KEY 
	(
		[VueloInfoVuelo]
	) REFERENCES [dbo].[InfoVuelo] (
		[Vuelo]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Billete] ADD 
	CONSTRAINT [FK_Billete_Cliente] FOREIGN KEY 
	(
		[NIFPasajero]
	) REFERENCES [dbo].[Cliente] (
		[NIF]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Billete_Cliente1] FOREIGN KEY 
	(
		[NIFReservador]
	) REFERENCES [dbo].[Cliente] (
		[NIF]
	),
	CONSTRAINT [FK_Billete_TarjetaDeEmbarque] FOREIGN KEY 
	(
		[TETarjetaDeEmbarque]
	) REFERENCES [dbo].[TarjetaDeEmbarque] (
		[TE]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Billete_Vuelo] FOREIGN KEY 
	(
		[IdVuelo]
	) REFERENCES [dbo].[Vuelo] (
		[Vuelo]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Equipaje] ADD 
	CONSTRAINT [FK_Equipaje_TarjetaDeEmbarque] FOREIGN KEY 
	(
		[TarjetaDeEmbarque]
	) REFERENCES [dbo].[TarjetaDeEmbarque] (
		[TE]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

