comparison Agendas/trunk/db/v1.0/00 - Tablas.sql @ 200:5346c0500594 deploy pre 1.0

Pasando a estructura de db fija, ya no se crea automáticamente. Se comenta lo referente a Patrocinadores que queda para alguna futura versión. Script para tablas de v1.0
author nelopauselli
date Wed, 17 Aug 2011 17:54:45 -0300
parents
children 6f5ab71614d4
comparison
equal deleted inserted replaced
199:39ce09df76dc 200:5346c0500594
1 DROP TABLE TrackLog
2 DROP TABLE Track
3 DROP TABLE Evento
4 DROP TABLE Cuenta
5 DROP TABLE Roles
6 DROP TABLE Persona
7 GO
8
9
10 CREATE TABLE Persona(
11 Id uniqueidentifier NOT NULL,
12 Nombre nvarchar(255) NULL,
13 Mail nvarchar(255) NULL,
14 Twitter nvarchar(255) NULL,
15 Blog nvarchar(255) NULL,
16 CONSTRAINT PK_Persona PRIMARY KEY (Id),
17 CONSTRAINT UK_Persona_Nombre UNIQUE (Nombre),
18 CONSTRAINT UK_Persona_Twitter UNIQUE (Twitter))
19 GO
20
21 CREATE TABLE Roles(
22 Persona uniqueidentifier NOT NULL,
23 Rol nvarchar(25) NOT NULL,
24 CONSTRAINT PK_Roles PRIMARY KEY (Persona, Rol),
25 CONSTRAINT FK_Roles_Persona FOREIGN KEY(Persona) REFERENCES Persona (Id) ON DELETE CASCADE
26 )
27 GO
28
29 CREATE TABLE Evento(
30 Id uniqueidentifier NOT NULL,
31 Titulo nvarchar(255) NULL,
32 FechaInicio datetime NULL,
33 FechaTermino datetime NULL,
34 UrlInvitacion nvarchar(255) NULL,
35 UrlWiki nvarchar(255) NULL,
36 NumeroOrden smallint NULL,
37 Ponente uniqueidentifier NULL,
38 Estado nvarchar(25) NULL,
39 Tipo int NULL,
40 Duracion bigint NULL,
41 CONSTRAINT PK_Evento PRIMARY KEY (Id),
42 CONSTRAINT UK_Titulo UNIQUE (Titulo),
43 CONSTRAINT FK_Evento_Persona FOREIGN KEY(Ponente) REFERENCES Persona (Id)
44 )
45 GO
46
47 CREATE TABLE Cuenta(
48 Id uniqueidentifier NOT NULL,
49 Persona uniqueidentifier NULL,
50 LogonName nvarchar(255) NULL,
51 IdentityProvider int NULL,
52 CONSTRAINT PK_Cuenta PRIMARY KEY (Id),
53 CONSTRAINT FK_Cuenta_Persona FOREIGN KEY(Persona) REFERENCES Persona (Id) ON DELETE CASCADE
54 )
55 GO
56
57 CREATE TABLE Track(
58 Id uniqueidentifier NOT NULL,
59 Evento uniqueidentifier NULL,
60 Accion int NULL,
61 Usuario uniqueidentifier NULL,
62 CONSTRAINT PK_Track PRIMARY KEY (Id),
63 CONSTRAINT FK_Track_Usuario FOREIGN KEY(Usuario)REFERENCES Persona (Id),
64 CONSTRAINT FK_Track_Evento FOREIGN KEY(Evento) REFERENCES Evento (Id) ON DELETE CASCADE
65 )
66 GO
67
68 CREATE TABLE TrackLog(
69 Id uniqueidentifier NOT NULL,
70 Propietario int NULL,
71 Mensaje nvarchar(255) NULL,
72 Track uniqueidentifier NULL,
73 Usuario uniqueidentifier NULL,
74 Successful bit NULL,
75 Fecha datetime NULL,
76 CONSTRAINT PK_TrackLog PRIMARY KEY (Id),
77 CONSTRAINT FK_TrackLog_Usuario FOREIGN KEY(Usuario)REFERENCES Persona (Id),
78 CONSTRAINT FK_TrackLog_Track FOREIGN KEY(Track)REFERENCES Track (Id) ON DELETE CASCADE
79 )
80 GO