forked from dddsw/dddsouthwest-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sql
112 lines (102 loc) · 2.9 KB
/
init.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
-- CREATE USER dddsouthwest_user WITH PASSWORD 'letmein';
-- CREATE DATABASE dddsouthwest;
-- GRANT ALL PRIVILEGES ON DATABASE dddsouthwest TO dddsouthwest_user;
-- Run below against your new Postgres SQL database
CREATE TABLE Events
(
Id SERIAL PRIMARY KEY,
EventName VARCHAR(200) NOT NULL,
EventFilename VARCHAR(200),
EventDate TIMESTAMP NULL
);
CREATE UNIQUE INDEX Events_Filename_uindex ON Events (EventFilename);
CREATE TABLE Users
(
Id SERIAL PRIMARY KEY,
GivenName VARCHAR(150) NULL,
FamilyName VARCHAR(150) NULL,
EmailAddress VARCHAR(255) NOT NULL,
Password VARCHAR(255) NOT NULL,
Salt VARCHAR(255) NOT NULL,
IsBlocked BOOLEAN DEFAULT FALSE NOT NULL,
IsActivated BOOLEAN DEFAULT FALSE NOT NULL,
Roles JSON NULL,
ReceiveNewsletter BOOLEAN DEFAULT FALSE NOT NULL,
DateRegistered TIMESTAMP NOT NULL
);
CREATE TABLE Talks
(
Id SERIAL NOT NULL CONSTRAINT talks_pkey PRIMARY KEY,
TalkTitle VARCHAR(255) NOT NULL,
TalkSummary VARCHAR NOT NULL,
TalkBodyHtml VARCHAR NOT NULL,
TalkBodyMarkdown VARCHAR NOT NULL,
DateAdded TIMESTAMP NOT NULL,
LastModified TIMESTAMP NOT NULL,
SubmissionDate TIMESTAMP,
UserId INTEGER NOT NULL,
IsApproved BOOLEAN DEFAULT FALSE NOT NULL,
IsSubmitted BOOLEAN DEFAULT FALSE NOT NULL,
CONSTRAINT talks_users_id_fk FOREIGN KEY(UserId) REFERENCES Users
);
CREATE TABLE News
(
Id SERIAL PRIMARY KEY,
Title VARCHAR(255) NOT NULL,
Filename VARCHAR(255) NOT NULL,
DatePosted TIMESTAMP,
BodyHtml VARCHAR,
BodyMarkdown VARCHAR,
IsLive BOOLEAN DEFAULT FALSE NOT NULL,
IsDeleted BOOLEAN DEFAULT FALSE NOT NULL
);
CREATE TABLE Profiles
(
id SERIAL NOT NULL
CONSTRAINT profile_pkey
PRIMARY KEY,
Twitter VARCHAR(150),
Website VARCHAR(255),
Linkedin VARCHAR(255),
BioMarkdown VARCHAR,
BioHtml VARCHAR,
Lastmodified TIMESTAMP NOT NULL,
Volunteer BOOLEAN DEFAULT FALSE NOT NULL,
Userid INTEGER
CONSTRAINT profile_users_id_fk
REFERENCES users
);
CREATE TABLE Volunteers
(
Id serial constraint volunteers_pk primary key,
FullName varchar(255),
EmailAddress varchar(255),
PhoneNumber varchar(255),
HelpSetup boolean default false not null,
DateSubmitted TIMESTAMP NOT NULL
);
CREATE TABLE Pages
(
Id SERIAL PRIMARY KEY,
Title VARCHAR(255) NOT NULL,
Filename VARCHAR(255) NOT NULL,
Body VARCHAR,
BodyMarkdown VARCHAR,
BodyHtml VARCHAR,
IsLive BOOLEAN DEFAULT FALSE NOT NULL,
IsDeleted BOOLEAN DEFAULT FALSE NOT NULL,
PageOrder INT NOT NULL,
DateCreated TIMESTAMP,
LastModified TIMESTAMP
);
CREATE UNIQUE INDEX Pages_Id_uindex ON Pages (Id);
CREATE UNIQUE INDEX Pages_Filename_uindex ON Pages (Filename);
CREATE TABLE Team
(
Id SERIAL CONSTRAINT team_pk PRIMARY KEY,
FullName VARCHAR(255) NOT NULL,
EmailAddress VARCHAR(255),
PicturePath VARCHAR(255),
YearJoined INT,
Twitter VARCHAR(255)
);