-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-db-split.sql
42 lines (37 loc) · 1.76 KB
/
create-db-split.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
create table users (
"id" serial primary key,
"firstName" character varying(255) not null,
"lastName" character varying(255) not null,
"email" character varying(255),
"createdAt" timestamp with time zone not null default ('now'::text)::timestamp with time zone,
"updatedAt" timestamp with time zone not null default ('now'::text)::timestamp with time zone,
"cgu" boolean,
"pixOrgaTermsOfServiceAccepted" boolean default false,
"pixCertifTermsOfServiceAccepted" boolean default false,
"hasSeenAssessmentInstructions" boolean default false,
"username" character varying(255),
"mustValidateTermsOfService" boolean not null default false,
"lastTermsOfServiceValidatedAt" timestamp with time zone,
"lang" character varying(255) not null default 'fr'::character varying,
"hasSeenNewDashboardInfo" boolean default false,
"isAnonymous" boolean default false,
"emailConfirmedAt" timestamp with time zone,
"hasSeenFocusedChallengeTooltip" boolean default false,
"hasSeenOtherChallengesTooltip" boolean default false,
"lastPixOrgaTermsOfServiceValidatedAt" timestamp with time zone,
"lastPixCertifTermsOfServiceValidatedAt" timestamp with time zone,
unique (email),
unique (username)
);
create index "users_email_lower" on "users"(LOWER("email"));
create table "user-logins" (
"id" serial primary key,
"createdAt" timestamp with time zone not null default ('now'::text)::timestamp with time zone,
"updatedAt" timestamp with time zone not null default ('now'::text)::timestamp with time zone,
"userId" int not null references users,
"lastLoggedAt" timestamp with time zone,
"failureCount" int not null default 0,
"temporaryBlockedUntil" timestamp with time zone,
"blockedAt" timestamp with time zone
);
create index on "user-logins" ("userId");