USE [Banda]
GO
/****** Object:  Table [Music].[TipoAlbum]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[TipoAlbum](
	[IdTipoAlbum] [int] IDENTITY(1,1) NOT NULL,
	[Descripcion] [nvarchar](256) NOT NULL,
 CONSTRAINT [PK_TipoAlbum] PRIMARY KEY CLUSTERED 
(
	[IdTipoAlbum] 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 [Music].[TipoEstadoCancion]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[TipoEstadoCancion](
	[IdTipoEstadoCancion] [int] IDENTITY(1,1) NOT NULL,
	[Descripcion] [nvarchar](256) NOT NULL,
 CONSTRAINT [PK_TipoEstadoCancion] PRIMARY KEY CLUSTERED 
(
	[IdTipoEstadoCancion] 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 [Music].[Album]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[Album](
	[IdAlbum] [int] IDENTITY(1,1) NOT NULL,
	[Titulo] [nvarchar](200) NOT NULL,
	[IdTipoAlbum] [int] NOT NULL,
	[FechaLanzamiento] [date] NULL,
	[PortadaRuta] [nvarchar](500) NULL,
	[Descripcion] [nvarchar](max) NULL,
	[IndUltimosLanzamientos] [tinyint] NOT NULL,
	[IndActivo] [tinyint] NOT NULL,
 CONSTRAINT [PK_Album] PRIMARY KEY CLUSTERED 
(
	[IdAlbum] 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 [Music].[Cancion]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[Cancion](
	[IdCancion] [int] IDENTITY(1,1) NOT NULL,
	[Titulo] [nvarchar](200) NOT NULL,
	[IdTipoEstadoCancion] [int] NOT NULL,
	[DuracionSegundos] [int] NULL,
	[AudioRuta] [nvarchar](500) NULL,
	[Letra] [nvarchar](max) NULL,
	[IndActivo] [tinyint] NOT NULL,
	[SpotifyUrl] [nvarchar](1024) NULL,
	[AppleMusicUrl] [nvarchar](1024) NULL,
	[YoutubeMusicUrl] [nvarchar](1024) NULL,
	[YoutubeVisualizerId] [nvarchar](1024) NULL,
	[PortadaRuta] [varchar](512) NULL,
 CONSTRAINT [PK_Cancion] PRIMARY KEY CLUSTERED 
(
	[IdCancion] 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 [Music].[AlbumCancion]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[AlbumCancion](
	[IdAlbumCancion] [int] IDENTITY(1,1) NOT NULL,
	[IdAlbum] [int] NOT NULL,
	[IdCancion] [int] NOT NULL,
	[NumeroPista] [int] NULL,
 CONSTRAINT [PK_AlbumCancion] PRIMARY KEY CLUSTERED 
(
	[IdAlbumCancion] 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:  View [Music].[VWAlbumTracklist]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   VIEW [Music].[VWAlbumTracklist] AS
SELECT
    a.IdAlbum,
    a.Titulo                AS Album,
    ta.Descripcion          AS TipoAlbum,
    a.FechaLanzamiento,
    a.PortadaRuta,
    ac.NumeroPista,
    c.IdCancion,
    c.Titulo                AS Cancion,
    c.DuracionSegundos,
    c.AudioRuta,
    c.SpotifyUrl,
    c.AppleMusicUrl,
    c.YoutubeMusicUrl,
    c.YoutubeVisualizerId,
    tec.Descripcion         AS EstadoCancion
FROM Music.Album a
JOIN Music.TipoAlbum ta             ON ta.IdTipoAlbum           = a.IdTipoAlbum
JOIN Music.AlbumCancion ac          ON ac.IdAlbum               = a.IdAlbum
JOIN Music.Cancion c                ON c.IdCancion              = ac.IdCancion AND c.IndActivo = 1
JOIN Music.TipoEstadoCancion tec    ON tec.IdTipoEstadoCancion  = c.IdTipoEstadoCancion
WHERE a.IndActivo = 1
GO
/****** Object:  Table [Music].[TipoCredito]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[TipoCredito](
	[IdTipoCredito] [int] IDENTITY(1,1) NOT NULL,
	[Descripcion] [nvarchar](256) NOT NULL,
 CONSTRAINT [PK_TipoCredito] PRIMARY KEY CLUSTERED 
(
	[IdTipoCredito] 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 [Music].[Artista]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[Artista](
	[IdArtista] [int] IDENTITY(1,1) NOT NULL,
	[Nombre] [nvarchar](120) NOT NULL,
	[Descripcion] [nvarchar](max) NULL,
	[FotoRuta] [nvarchar](500) NULL,
	[IndMiembro] [tinyint] NOT NULL,
	[Orden] [int] NOT NULL,
	[IndActivo] [tinyint] NOT NULL,
 CONSTRAINT [PK_Artista] PRIMARY KEY CLUSTERED 
(
	[IdArtista] 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 [Music].[CancionArtista]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[CancionArtista](
	[IdCancionArtista] [int] IDENTITY(1,1) NOT NULL,
	[IdCancion] [int] NOT NULL,
	[IdArtista] [int] NOT NULL,
	[IdTipoCredito] [int] NOT NULL,
 CONSTRAINT [PK_CancionArtista] PRIMARY KEY CLUSTERED 
(
	[IdCancionArtista] 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:  View [Music].[VWCreditosCancion]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Music].[VWCreditosCancion] AS
SELECT
    c.IdCancion,
    c.Titulo                AS Cancion,
    ar.IdArtista,
    ar.Nombre               AS Artista,
    tc.Descripcion          AS TipoCredito
FROM Music.Cancion c
JOIN Music.CancionArtista ca    ON ca.IdCancion     = c.IdCancion
JOIN Music.Artista ar           ON ar.IdArtista     = ca.IdArtista
JOIN Music.TipoCredito tc       ON tc.IdTipoCredito = ca.IdTipoCredito
WHERE c.IndActivo = 1
GO
/****** Object:  View [Music].[VWCancionesDisponibles]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   VIEW [Music].[VWCancionesDisponibles] AS
SELECT
    c.IdCancion,
    c.Titulo,
    c.DuracionSegundos,
    c.AudioRuta,
    c.SpotifyUrl,
    c.AppleMusicUrl,
    c.YoutubeMusicUrl,
    c.YoutubeVisualizerId,
    a.IdAlbum,
    a.Titulo                AS Album,
    a.PortadaRuta,
    ac.NumeroPista
FROM Music.Cancion c
JOIN Music.TipoEstadoCancion tec    ON tec.IdTipoEstadoCancion  = c.IdTipoEstadoCancion
JOIN Music.AlbumCancion ac          ON ac.IdCancion             = c.IdCancion
JOIN Music.Album a                  ON a.IdAlbum                = ac.IdAlbum AND a.IndActivo = 1
WHERE c.IndActivo        = 1
  AND tec.Descripcion    = N'Disponible'
  AND c.AudioRuta        IS NOT NULL
GO
/****** Object:  View [Music].[VWCancion]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- Music.VWCancion source

CREATE     VIEW [Music].[VWCancion] AS
SELECT
    c.IdCancion,
    c.Titulo,
    c.IdTipoEstadoCancion,
    tec.Descripcion         AS EstadoCancion,
    c.DuracionSegundos,
    c.AudioRuta,
    c.Letra,
    c.SpotifyUrl,
    c.AppleMusicUrl,
    c.YoutubeMusicUrl,
    c.YoutubeVisualizerId,
    c.IndActivo,
    c.PortadaRuta
FROM Music.Cancion c
JOIN Music.TipoEstadoCancion tec    ON tec.IdTipoEstadoCancion = c.IdTipoEstadoCancion;
GO
/****** Object:  View [Music].[VWAlbum]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Music].[VWAlbum] AS
SELECT
    a.IdAlbum,
    a.Titulo,
    a.IdTipoAlbum,
    ta.Descripcion          AS TipoAlbum,
    a.FechaLanzamiento,
    a.PortadaRuta,
    a.Descripcion,
    a.IndUltimosLanzamientos,
    a.IndActivo
FROM Music.Album a
JOIN Music.TipoAlbum ta     ON ta.IdTipoAlbum = a.IdTipoAlbum
GO
/****** Object:  View [Music].[VWArtista]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Music].[VWArtista] AS
SELECT
    a.IdArtista,
    a.Nombre,
    a.Descripcion,
    a.FotoRuta,
    a.IndMiembro,
    a.Orden,
    a.IndActivo
FROM Music.Artista a
GO
/****** Object:  Table [Music].[Video]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[Video](
	[IdVideo] [int] IDENTITY(1,1) NOT NULL,
	[Titulo] [nvarchar](200) NOT NULL,
	[YoutubeId] [nvarchar](20) NULL,
	[IdCancion] [int] NULL,
	[FechaPublicacion] [date] NULL,
	[IndActivo] [tinyint] NOT NULL,
 CONSTRAINT [PK_Video] PRIMARY KEY CLUSTERED 
(
	[IdVideo] 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:  View [Music].[VWVideo]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Music].[VWVideo] AS
SELECT
    v.IdVideo,
    v.Titulo,
    v.YoutubeId,
    v.IdCancion,
    c.Titulo                AS Cancion,
    v.FechaPublicacion,
    v.IndActivo
FROM Music.Video v
LEFT JOIN Music.Cancion c   ON c.IdCancion = v.IdCancion
GO
/****** Object:  Table [Music].[AlbumFoto]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[AlbumFoto](
	[IdAlbumFoto] [int] IDENTITY(1,1) NOT NULL,
	[Titulo] [nvarchar](200) NOT NULL,
	[Descripcion] [nvarchar](max) NULL,
	[FechaEvento] [date] NULL,
	[IndActivo] [tinyint] NOT NULL,
 CONSTRAINT [PK_AlbumFoto] PRIMARY KEY CLUSTERED 
(
	[IdAlbumFoto] 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:  View [Music].[VWAlbumFoto]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Music].[VWAlbumFoto] AS
SELECT
    af.IdAlbumFoto,
    af.Titulo,
    af.Descripcion,
    af.FechaEvento,
    af.IndActivo
FROM Music.AlbumFoto af
GO
/****** Object:  Table [Music].[TipoFoto]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[TipoFoto](
	[IdTipoFoto] [int] IDENTITY(1,1) NOT NULL,
	[Descripcion] [nvarchar](256) NOT NULL,
 CONSTRAINT [PK_TipoFoto] PRIMARY KEY CLUSTERED 
(
	[IdTipoFoto] 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 [Music].[Foto]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[Foto](
	[IdFoto] [int] IDENTITY(1,1) NOT NULL,
	[Titulo] [nvarchar](200) NULL,
	[Ruta] [nvarchar](500) NOT NULL,
	[Descripcion] [nvarchar](500) NULL,
	[IdTipoFoto] [int] NULL,
	[IdAlbumFoto] [int] NULL,
	[Orden] [int] NOT NULL,
	[IndActivo] [tinyint] NOT NULL,
 CONSTRAINT [PK_Foto] PRIMARY KEY CLUSTERED 
(
	[IdFoto] 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:  View [Music].[VWFoto]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Music].[VWFoto] AS
SELECT
    f.IdFoto,
    f.Titulo,
    f.Ruta,
    f.Descripcion,
    f.IdTipoFoto,
    tf.Descripcion          AS TipoFoto,
    f.IdAlbumFoto,
    af.Titulo               AS AlbumFoto,
    f.Orden,
    f.IndActivo
FROM Music.Foto f
LEFT JOIN Music.TipoFoto tf     ON tf.IdTipoFoto  = f.IdTipoFoto
LEFT JOIN Music.AlbumFoto af    ON af.IdAlbumFoto = f.IdAlbumFoto
GO
/****** Object:  Table [Music].[Clip]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[Clip](
	[IdClip] [int] IDENTITY(1,1) NOT NULL,
	[IdCancion] [int] NOT NULL,
	[Ruta] [nvarchar](500) NOT NULL,
	[DuracionSegundos] [int] NULL,
	[IndActivo] [tinyint] NOT NULL,
 CONSTRAINT [PK_Clip] PRIMARY KEY CLUSTERED 
(
	[IdClip] 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:  View [Music].[VWClip]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Music].[VWClip] AS
SELECT
    cl.IdClip,
    cl.IdCancion,
    c.Titulo                AS Cancion,
    cl.Ruta,
    cl.DuracionSegundos,
    cl.IndActivo
FROM Music.Clip cl
JOIN Music.Cancion c        ON c.IdCancion = cl.IdCancion
GO
/****** Object:  Table [Music].[Rol]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[Rol](
	[IdRol] [int] IDENTITY(1,1) NOT NULL,
	[Descripcion] [nvarchar](256) NOT NULL,
	[IndActivo] [tinyint] NOT NULL,
 CONSTRAINT [PK_Rol] PRIMARY KEY CLUSTERED 
(
	[IdRol] 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:  View [Music].[VWRol]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Music].[VWRol] AS
SELECT
    r.IdRol,
    r.Descripcion,
    r.IndActivo
FROM Music.Rol r
GO
/****** Object:  Table [Music].[ArtistaRol]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[ArtistaRol](
	[IdArtistaRol] [int] IDENTITY(1,1) NOT NULL,
	[IdArtista] [int] NOT NULL,
	[IdRol] [int] NOT NULL,
 CONSTRAINT [PK_ArtistaRol] PRIMARY KEY CLUSTERED 
(
	[IdArtistaRol] 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:  View [Music].[VWArtistaRol]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Music].[VWArtistaRol] AS
SELECT
    ar.IdArtistaRol,
    ar.IdArtista,
    a.Nombre                AS Artista,
    ar.IdRol,
    r.Descripcion           AS Rol
FROM Music.ArtistaRol ar
JOIN Music.Artista a        ON a.IdArtista = ar.IdArtista
JOIN Music.Rol r            ON r.IdRol     = ar.IdRol
GO
/****** Object:  View [Music].[VWAlbumCancion]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Music].[VWAlbumCancion] AS
SELECT
    ac.IdAlbumCancion,
    ac.IdAlbum,
    a.Titulo                AS Album,
    a.FechaLanzamiento,
    ac.NumeroPista,
    ac.IdCancion,
    c.Titulo                AS Cancion
FROM Music.AlbumCancion ac
JOIN Music.Album a          ON a.IdAlbum   = ac.IdAlbum
JOIN Music.Cancion c        ON c.IdCancion = ac.IdCancion
GO
/****** Object:  Table [Music].[AlbumArtista]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[AlbumArtista](
	[IdAlbumArtista] [int] IDENTITY(1,1) NOT NULL,
	[IdAlbum] [int] NOT NULL,
	[IdArtista] [int] NOT NULL,
	[IdTipoCredito] [int] NOT NULL,
 CONSTRAINT [PK_AlbumArtista] PRIMARY KEY CLUSTERED 
(
	[IdAlbumArtista] 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:  View [Music].[VWAlbumArtista]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Music].[VWAlbumArtista] AS
SELECT
    aa.IdAlbumArtista,
    aa.IdAlbum,
    a.Titulo                AS Album,
    aa.IdArtista,
    ar.Nombre               AS Artista,
    aa.IdTipoCredito,
    tc.Descripcion          AS TipoCredito
FROM Music.AlbumArtista aa
JOIN Music.Album a          ON a.IdAlbum        = aa.IdAlbum
JOIN Music.Artista ar       ON ar.IdArtista     = aa.IdArtista
JOIN Music.TipoCredito tc   ON tc.IdTipoCredito = aa.IdTipoCredito
GO
/****** Object:  View [Music].[VWCancionArtista]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [Music].[VWCancionArtista] AS
SELECT
    ca.IdCancionArtista,
    ca.IdCancion,
    c.Titulo                AS Cancion,
    ca.IdArtista,
    ar.Nombre               AS Artista,
    ca.IdTipoCredito,
    tc.Descripcion          AS TipoCredito
FROM Music.CancionArtista ca
JOIN Music.Cancion c        ON c.IdCancion      = ca.IdCancion
JOIN Music.Artista ar       ON ar.IdArtista     = ca.IdArtista
JOIN Music.TipoCredito tc   ON tc.IdTipoCredito = ca.IdTipoCredito
GO
/****** Object:  Table [Music].[Gear]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Music].[Gear](
	[IdGear] [int] IDENTITY(1,1) NOT NULL,
	[IdArtista] [int] NOT NULL,
	[Marca] [nvarchar](100) NOT NULL,
	[Modelo] [nvarchar](200) NOT NULL,
	[FotoRuta] [nvarchar](500) NULL,
	[Descripcion] [nvarchar](max) NULL,
	[Orden] [int] NOT NULL,
	[IndActivo] [tinyint] NOT NULL,
 CONSTRAINT [PK_Gear] PRIMARY KEY CLUSTERED 
(
	[IdGear] 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:  View [Music].[VWGear]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   VIEW [Music].[VWGear] AS
SELECT g.IdGear, g.IdArtista, a.Nombre AS Artista,
       g.Marca, g.Modelo, g.FotoRuta, g.Descripcion, g.Orden, g.IndActivo
FROM Music.Gear g
JOIN Music.Artista a ON a.IdArtista = g.IdArtista
GO
/****** Object:  Table [Core].[Contacto]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[Contacto](
	[IdContacto] [int] IDENTITY(1,1) NOT NULL,
	[IdCliente] [int] NOT NULL,
	[Nombre] [varchar](512) NULL,
	[Email] [varchar](45) NULL,
	[Cargo] [varchar](512) NULL,
	[Avatar] [varchar](256) NULL,
 CONSTRAINT [PK_Contacto] PRIMARY KEY CLUSTERED 
(
	[IdContacto] 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 [Core].[Usuario]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[Usuario](
	[IdUsuario] [int] IDENTITY(1,1) NOT NULL,
	[IdCliente] [int] NULL,
	[IdEmpresa] [int] NULL,
	[LoginName] [varchar](45) NULL,
	[Clave] [varchar](45) NULL,
	[IdContacto] [int] NOT NULL,
	[Eliminado] [int] NULL,
	[IdPerfil] [int] NULL,
	[IdTipoIdioma] [int] NOT NULL,
	[FechaCreacion] [datetime] NOT NULL,
	[FechaUltimaSesion] [datetime] NULL,
	[IdTipoClave] [int] NOT NULL,
	[IndFiltroMarca] [tinyint] NOT NULL,
	[IndFiltroDepartamento] [tinyint] NOT NULL,
 CONSTRAINT [PK_Usuario] PRIMARY KEY CLUSTERED 
(
	[IdUsuario] 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 [Core].[Perfil]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[Perfil](
	[IdPerfil] [int] NOT NULL,
	[Descripcion] [varchar](256) NULL,
	[Eliminado] [int] NULL,
	[LandingPage] [varchar](256) NOT NULL,
	[IndSeleccionable] [int] NOT NULL,
	[IdTipoProducto] [int] NOT NULL,
 CONSTRAINT [PK_Perfil] PRIMARY KEY CLUSTERED 
(
	[IdPerfil] 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:  View [Core].[VWUsuario]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   view [Core].[VWUsuario]
as
SELECT u.IdUsuario,
	u.LoginName,
	u.Clave,
	u.IdContacto,
	u.Eliminado,
	u.IdPerfil,
	u.IdTipoIdioma,
	u.FechaCreacion,
	u.FechaUltimaSesion,
	u.IndFiltroMarca,
	u.IndFiltroDepartamento,
	u.IdTipoClave,
	p.Descripcion as Perfil,
	p.LandingPage,
	p.IndSeleccionable,
	p.IdTipoProducto,
	c.Nombre,
	c.Email, 
	c.Cargo,
	c.Nombre AS Descripcion
  FROM [Core].[Usuario] u
  join Core.Perfil p on p.IdPerfil = u.IdPerfil
  join Core.Contacto c on c.IdContacto = u.IdContacto


GO
/****** Object:  Table [Core].[Cliente]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[Cliente](
	[IdCliente] [int] IDENTITY(1,1) NOT NULL,
	[IdTipoCliente] [int] NOT NULL,
	[RazonSocial] [varchar](256) NULL,
	[Rut] [varchar](15) NULL,
	[Direccion] [varchar](512) NULL,
	[Eliminado] [int] NULL,
	[UriLogo] [varchar](512) NOT NULL,
	[IdTipoProducto] [int] NOT NULL,
	[IndTurnoDiscontinuo] [int] NULL,
	[UriLogoAlternativo] [varchar](512) NOT NULL,
	[IdEstilo] [int] NULL,
 CONSTRAINT [PK_Cliente] PRIMARY KEY CLUSTERED 
(
	[IdCliente] 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 [Core].[Configuracion]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[Configuracion](
	[IdConfiguracion] [int] IDENTITY(1,1) NOT NULL,
	[Codigo] [varchar](128) NOT NULL,
	[Valor] [varchar](512) NOT NULL,
 CONSTRAINT [PK_Configuracion] PRIMARY KEY CLUSTERED 
(
	[IdConfiguracion] 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 [Core].[ConfiguracionCliente]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[ConfiguracionCliente](
	[IdConfiguracionCliente] [int] NOT NULL,
	[IdCliente] [int] NOT NULL,
	[IdConfiguracion] [int] NOT NULL,
	[Valor] [varchar](512) NOT NULL,
 CONSTRAINT [PK_ConfiguracionCliente] PRIMARY KEY CLUSTERED 
(
	[IdConfiguracionCliente] 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 [Core].[Empresa]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[Empresa](
	[IdEmpresa] [int] NOT NULL,
	[Descripcion] [varchar](256) NOT NULL,
	[IdCliente] [int] NOT NULL,
	[Logo] [varchar](256) NULL,
	[Alias] [varchar](256) NOT NULL,
 CONSTRAINT [PK_Empresa] PRIMARY KEY CLUSTERED 
(
	[IdEmpresa] 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 [Core].[Estilo]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[Estilo](
	[IdEstilo] [int] NOT NULL,
	[Descripcion] [varchar](100) NULL,
	[IndHost] [int] NULL,
	[IdTipoLogin] [int] NOT NULL,
	[LogoAlternativo] [varchar](512) NOT NULL,
 CONSTRAINT [PK_Estilo] PRIMARY KEY CLUSTERED 
(
	[IdEstilo] 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 [Core].[Rol]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[Rol](
	[IdRol] [int] IDENTITY(1,1) NOT NULL,
	[Codigo] [varchar](110) NOT NULL,
	[Descripcion] [varchar](256) NULL,
	[Eliminado] [int] NULL,
 CONSTRAINT [PK_Rol_1] PRIMARY KEY CLUSTERED 
(
	[IdRol] 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 [Core].[RolPorPerfil]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[RolPorPerfil](
	[IdRolPorPerfil] [int] IDENTITY(1,1) NOT NULL,
	[IdRol] [int] NULL,
	[IdPerfil] [int] NULL,
 CONSTRAINT [PK_RolPorPerfil] PRIMARY KEY CLUSTERED 
(
	[IdRolPorPerfil] 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 [Core].[TipoClave]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[TipoClave](
	[IdTipoClave] [int] NOT NULL,
	[Descripcion] [varchar](64) NULL,
 CONSTRAINT [PK_TipoClave] PRIMARY KEY CLUSTERED 
(
	[IdTipoClave] 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 [Core].[TipoCliente]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[TipoCliente](
	[IdTipoCliente] [int] NOT NULL,
	[Descripcion] [varchar](45) NULL,
 CONSTRAINT [PK_TipoCliente] PRIMARY KEY CLUSTERED 
(
	[IdTipoCliente] 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 [Core].[TipoIdioma]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[TipoIdioma](
	[IdTipoIdioma] [int] NOT NULL,
	[Codigo] [varchar](2) NOT NULL,
	[Descripcion] [varchar](16) NOT NULL,
 CONSTRAINT [PK_TipoIdioma] PRIMARY KEY CLUSTERED 
(
	[IdTipoIdioma] 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 [Core].[TipoLogin]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[TipoLogin](
	[IdTipoLogin] [int] NOT NULL,
	[Descripcion] [varchar](128) NOT NULL,
 CONSTRAINT [PK_TipoLogin] PRIMARY KEY CLUSTERED 
(
	[IdTipoLogin] 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 [Core].[TipoProducto]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[TipoProducto](
	[IdTipoProducto] [int] NOT NULL,
	[Codigo] [varchar](6) NOT NULL,
	[Descripcion] [varchar](64) NOT NULL,
 CONSTRAINT [PK_TipoProducto] PRIMARY KEY CLUSTERED 
(
	[IdTipoProducto] 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 [Core].[ValorEstilos]    Script Date: 25-06-2026 14:46:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Core].[ValorEstilos](
	[IdValorEstilo] [int] IDENTITY(1,1) NOT NULL,
	[IdTipoEstilo] [varchar](100) NOT NULL,
	[IdEstilo] [int] NOT NULL,
	[Color] [varchar](100) NULL,
 CONSTRAINT [PK_ValorEstilos] PRIMARY KEY CLUSTERED 
(
	[IdValorEstilo] 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 [Core].[Usuario] ADD  CONSTRAINT [DF_Usuario_IndFiltroMarca]  DEFAULT ((0)) FOR [IndFiltroMarca]
GO
ALTER TABLE [Music].[Album] ADD  DEFAULT ((0)) FOR [IndUltimosLanzamientos]
GO
ALTER TABLE [Music].[Album] ADD  DEFAULT ((1)) FOR [IndActivo]
GO
ALTER TABLE [Music].[AlbumFoto] ADD  DEFAULT ((1)) FOR [IndActivo]
GO
ALTER TABLE [Music].[Artista] ADD  DEFAULT ((0)) FOR [IndMiembro]
GO
ALTER TABLE [Music].[Artista] ADD  DEFAULT ((0)) FOR [Orden]
GO
ALTER TABLE [Music].[Artista] ADD  DEFAULT ((1)) FOR [IndActivo]
GO
ALTER TABLE [Music].[Cancion] ADD  DEFAULT ((1)) FOR [IndActivo]
GO
ALTER TABLE [Music].[Clip] ADD  DEFAULT ((1)) FOR [IndActivo]
GO
ALTER TABLE [Music].[Foto] ADD  DEFAULT ((0)) FOR [Orden]
GO
ALTER TABLE [Music].[Foto] ADD  DEFAULT ((1)) FOR [IndActivo]
GO
ALTER TABLE [Music].[Gear] ADD  DEFAULT ((0)) FOR [Orden]
GO
ALTER TABLE [Music].[Gear] ADD  DEFAULT ((1)) FOR [IndActivo]
GO
ALTER TABLE [Music].[Rol] ADD  DEFAULT ((1)) FOR [IndActivo]
GO
ALTER TABLE [Music].[Video] ADD  DEFAULT ((1)) FOR [IndActivo]
GO
ALTER TABLE [Core].[Cliente]  WITH CHECK ADD  CONSTRAINT [FK_Cliente_Estilo] FOREIGN KEY([IdEstilo])
REFERENCES [Core].[Estilo] ([IdEstilo])
GO
ALTER TABLE [Core].[Cliente] CHECK CONSTRAINT [FK_Cliente_Estilo]
GO
ALTER TABLE [Core].[Cliente]  WITH CHECK ADD  CONSTRAINT [FK_Cliente_TipoCliente] FOREIGN KEY([IdTipoCliente])
REFERENCES [Core].[TipoCliente] ([IdTipoCliente])
GO
ALTER TABLE [Core].[Cliente] CHECK CONSTRAINT [FK_Cliente_TipoCliente]
GO
ALTER TABLE [Core].[Cliente]  WITH CHECK ADD  CONSTRAINT [FK_Cliente_TipoProducto] FOREIGN KEY([IdTipoProducto])
REFERENCES [Core].[TipoProducto] ([IdTipoProducto])
GO
ALTER TABLE [Core].[Cliente] CHECK CONSTRAINT [FK_Cliente_TipoProducto]
GO
ALTER TABLE [Core].[ConfiguracionCliente]  WITH CHECK ADD  CONSTRAINT [FK_ConfiguracionCliente_Cliente] FOREIGN KEY([IdCliente])
REFERENCES [Core].[Cliente] ([IdCliente])
GO
ALTER TABLE [Core].[ConfiguracionCliente] CHECK CONSTRAINT [FK_ConfiguracionCliente_Cliente]
GO
ALTER TABLE [Core].[ConfiguracionCliente]  WITH CHECK ADD  CONSTRAINT [FK_ConfiguracionCliente_Configuracion] FOREIGN KEY([IdConfiguracion])
REFERENCES [Core].[Configuracion] ([IdConfiguracion])
GO
ALTER TABLE [Core].[ConfiguracionCliente] CHECK CONSTRAINT [FK_ConfiguracionCliente_Configuracion]
GO
ALTER TABLE [Core].[Contacto]  WITH CHECK ADD  CONSTRAINT [FK_Contacto_Cliente] FOREIGN KEY([IdCliente])
REFERENCES [Core].[Cliente] ([IdCliente])
GO
ALTER TABLE [Core].[Contacto] CHECK CONSTRAINT [FK_Contacto_Cliente]
GO
ALTER TABLE [Core].[Empresa]  WITH CHECK ADD  CONSTRAINT [FK_Empresa_Cliente] FOREIGN KEY([IdCliente])
REFERENCES [Core].[Cliente] ([IdCliente])
GO
ALTER TABLE [Core].[Empresa] CHECK CONSTRAINT [FK_Empresa_Cliente]
GO
ALTER TABLE [Core].[Estilo]  WITH CHECK ADD  CONSTRAINT [FK_Estilo_TipoLogin] FOREIGN KEY([IdTipoLogin])
REFERENCES [Core].[TipoLogin] ([IdTipoLogin])
GO
ALTER TABLE [Core].[Estilo] CHECK CONSTRAINT [FK_Estilo_TipoLogin]
GO
ALTER TABLE [Core].[Perfil]  WITH CHECK ADD  CONSTRAINT [FK_Perfil_TipoProducto] FOREIGN KEY([IdTipoProducto])
REFERENCES [Core].[TipoProducto] ([IdTipoProducto])
GO
ALTER TABLE [Core].[Perfil] CHECK CONSTRAINT [FK_Perfil_TipoProducto]
GO
ALTER TABLE [Core].[RolPorPerfil]  WITH CHECK ADD  CONSTRAINT [FK_RolPorPerfil_Perfil] FOREIGN KEY([IdPerfil])
REFERENCES [Core].[Perfil] ([IdPerfil])
GO
ALTER TABLE [Core].[RolPorPerfil] CHECK CONSTRAINT [FK_RolPorPerfil_Perfil]
GO
ALTER TABLE [Core].[RolPorPerfil]  WITH CHECK ADD  CONSTRAINT [FK_RolPorPerfil_Rol] FOREIGN KEY([IdRol])
REFERENCES [Core].[Rol] ([IdRol])
GO
ALTER TABLE [Core].[RolPorPerfil] CHECK CONSTRAINT [FK_RolPorPerfil_Rol]
GO
ALTER TABLE [Core].[Usuario]  WITH CHECK ADD  CONSTRAINT [FK_Usuario_Cliente] FOREIGN KEY([IdCliente])
REFERENCES [Core].[Cliente] ([IdCliente])
GO
ALTER TABLE [Core].[Usuario] CHECK CONSTRAINT [FK_Usuario_Cliente]
GO
ALTER TABLE [Core].[Usuario]  WITH CHECK ADD  CONSTRAINT [FK_Usuario_Contacto] FOREIGN KEY([IdContacto])
REFERENCES [Core].[Contacto] ([IdContacto])
GO
ALTER TABLE [Core].[Usuario] CHECK CONSTRAINT [FK_Usuario_Contacto]
GO
ALTER TABLE [Core].[Usuario]  WITH CHECK ADD  CONSTRAINT [FK_Usuario_Empresa] FOREIGN KEY([IdEmpresa])
REFERENCES [Core].[Empresa] ([IdEmpresa])
GO
ALTER TABLE [Core].[Usuario] CHECK CONSTRAINT [FK_Usuario_Empresa]
GO
ALTER TABLE [Core].[Usuario]  WITH CHECK ADD  CONSTRAINT [FK_Usuario_Perfil] FOREIGN KEY([IdPerfil])
REFERENCES [Core].[Perfil] ([IdPerfil])
GO
ALTER TABLE [Core].[Usuario] CHECK CONSTRAINT [FK_Usuario_Perfil]
GO
ALTER TABLE [Core].[Usuario]  WITH CHECK ADD  CONSTRAINT [FK_Usuario_TipoClave] FOREIGN KEY([IdTipoClave])
REFERENCES [Core].[TipoClave] ([IdTipoClave])
GO
ALTER TABLE [Core].[Usuario] CHECK CONSTRAINT [FK_Usuario_TipoClave]
GO
ALTER TABLE [Core].[Usuario]  WITH CHECK ADD  CONSTRAINT [FK_Usuario_TipoIdioma] FOREIGN KEY([IdTipoIdioma])
REFERENCES [Core].[TipoIdioma] ([IdTipoIdioma])
GO
ALTER TABLE [Core].[Usuario] CHECK CONSTRAINT [FK_Usuario_TipoIdioma]
GO
ALTER TABLE [Music].[Album]  WITH CHECK ADD  CONSTRAINT [FK_Album_TipoAlbum] FOREIGN KEY([IdTipoAlbum])
REFERENCES [Music].[TipoAlbum] ([IdTipoAlbum])
GO
ALTER TABLE [Music].[Album] CHECK CONSTRAINT [FK_Album_TipoAlbum]
GO
ALTER TABLE [Music].[AlbumArtista]  WITH CHECK ADD  CONSTRAINT [FK_AlbumArtista_Album] FOREIGN KEY([IdAlbum])
REFERENCES [Music].[Album] ([IdAlbum])
GO
ALTER TABLE [Music].[AlbumArtista] CHECK CONSTRAINT [FK_AlbumArtista_Album]
GO
ALTER TABLE [Music].[AlbumArtista]  WITH CHECK ADD  CONSTRAINT [FK_AlbumArtista_Artista] FOREIGN KEY([IdArtista])
REFERENCES [Music].[Artista] ([IdArtista])
GO
ALTER TABLE [Music].[AlbumArtista] CHECK CONSTRAINT [FK_AlbumArtista_Artista]
GO
ALTER TABLE [Music].[AlbumArtista]  WITH CHECK ADD  CONSTRAINT [FK_AlbumArtista_TipoCredito] FOREIGN KEY([IdTipoCredito])
REFERENCES [Music].[TipoCredito] ([IdTipoCredito])
GO
ALTER TABLE [Music].[AlbumArtista] CHECK CONSTRAINT [FK_AlbumArtista_TipoCredito]
GO
ALTER TABLE [Music].[AlbumCancion]  WITH CHECK ADD  CONSTRAINT [FK_AlbumCancion_Album] FOREIGN KEY([IdAlbum])
REFERENCES [Music].[Album] ([IdAlbum])
GO
ALTER TABLE [Music].[AlbumCancion] CHECK CONSTRAINT [FK_AlbumCancion_Album]
GO
ALTER TABLE [Music].[AlbumCancion]  WITH CHECK ADD  CONSTRAINT [FK_AlbumCancion_Cancion] FOREIGN KEY([IdCancion])
REFERENCES [Music].[Cancion] ([IdCancion])
GO
ALTER TABLE [Music].[AlbumCancion] CHECK CONSTRAINT [FK_AlbumCancion_Cancion]
GO
ALTER TABLE [Music].[ArtistaRol]  WITH CHECK ADD  CONSTRAINT [FK_ArtistaRol_Artista] FOREIGN KEY([IdArtista])
REFERENCES [Music].[Artista] ([IdArtista])
GO
ALTER TABLE [Music].[ArtistaRol] CHECK CONSTRAINT [FK_ArtistaRol_Artista]
GO
ALTER TABLE [Music].[ArtistaRol]  WITH CHECK ADD  CONSTRAINT [FK_ArtistaRol_Rol] FOREIGN KEY([IdRol])
REFERENCES [Music].[Rol] ([IdRol])
GO
ALTER TABLE [Music].[ArtistaRol] CHECK CONSTRAINT [FK_ArtistaRol_Rol]
GO
ALTER TABLE [Music].[Cancion]  WITH CHECK ADD  CONSTRAINT [FK_Cancion_TipoEstadoCancion] FOREIGN KEY([IdTipoEstadoCancion])
REFERENCES [Music].[TipoEstadoCancion] ([IdTipoEstadoCancion])
GO
ALTER TABLE [Music].[Cancion] CHECK CONSTRAINT [FK_Cancion_TipoEstadoCancion]
GO
ALTER TABLE [Music].[CancionArtista]  WITH CHECK ADD  CONSTRAINT [FK_CancionArtista_Artista] FOREIGN KEY([IdArtista])
REFERENCES [Music].[Artista] ([IdArtista])
GO
ALTER TABLE [Music].[CancionArtista] CHECK CONSTRAINT [FK_CancionArtista_Artista]
GO
ALTER TABLE [Music].[CancionArtista]  WITH CHECK ADD  CONSTRAINT [FK_CancionArtista_Cancion] FOREIGN KEY([IdCancion])
REFERENCES [Music].[Cancion] ([IdCancion])
GO
ALTER TABLE [Music].[CancionArtista] CHECK CONSTRAINT [FK_CancionArtista_Cancion]
GO
ALTER TABLE [Music].[CancionArtista]  WITH CHECK ADD  CONSTRAINT [FK_CancionArtista_TipoCredito] FOREIGN KEY([IdTipoCredito])
REFERENCES [Music].[TipoCredito] ([IdTipoCredito])
GO
ALTER TABLE [Music].[CancionArtista] CHECK CONSTRAINT [FK_CancionArtista_TipoCredito]
GO
ALTER TABLE [Music].[Clip]  WITH CHECK ADD  CONSTRAINT [FK_Clip_Cancion] FOREIGN KEY([IdCancion])
REFERENCES [Music].[Cancion] ([IdCancion])
GO
ALTER TABLE [Music].[Clip] CHECK CONSTRAINT [FK_Clip_Cancion]
GO
ALTER TABLE [Music].[Foto]  WITH CHECK ADD  CONSTRAINT [FK_Foto_AlbumFoto] FOREIGN KEY([IdAlbumFoto])
REFERENCES [Music].[AlbumFoto] ([IdAlbumFoto])
GO
ALTER TABLE [Music].[Foto] CHECK CONSTRAINT [FK_Foto_AlbumFoto]
GO
ALTER TABLE [Music].[Foto]  WITH CHECK ADD  CONSTRAINT [FK_Foto_TipoFoto] FOREIGN KEY([IdTipoFoto])
REFERENCES [Music].[TipoFoto] ([IdTipoFoto])
GO
ALTER TABLE [Music].[Foto] CHECK CONSTRAINT [FK_Foto_TipoFoto]
GO
ALTER TABLE [Music].[Gear]  WITH CHECK ADD  CONSTRAINT [FK_Gear_Artista] FOREIGN KEY([IdArtista])
REFERENCES [Music].[Artista] ([IdArtista])
GO
ALTER TABLE [Music].[Gear] CHECK CONSTRAINT [FK_Gear_Artista]
GO
ALTER TABLE [Music].[Video]  WITH CHECK ADD  CONSTRAINT [FK_Video_Cancion] FOREIGN KEY([IdCancion])
REFERENCES [Music].[Cancion] ([IdCancion])
GO
ALTER TABLE [Music].[Video] CHECK CONSTRAINT [FK_Video_Cancion]
GO
