1 drop table if exists user_choice
;
2 drop table if exists choices
;
3 drop table if exists attachments
;
4 drop table if exists votes
;
5 drop table if exists user_group
;
6 drop table if exists groups
;
7 drop table if exists users
;
10 id INTEGER primary key autoincrement
,
11 email
TEXT unique not null,
12 password TEXT not null,
15 is_admin
INTEGER default 0 not null,
20 id INTEGER primary key autoincrement
,
21 name TEXT unique not null,
22 system INTEGER default 0 not null
25 create table user_group (
28 FOREIGN KEY(id_user
) REFERENCES users(id),
29 FOREIGN KEY(id_group
) REFERENCES groups(id),
30 PRIMARY KEY(id_user
, id_group
)
34 id INTEGER primary key autoincrement
,
38 date_begin
INTEGER default CURRENT_TIMESTAMP not null,
39 date_end
INTEGER not null,
40 is_transparent
INTEGER default 1 not null,
41 is_public
INTEGER default 1 not null,
42 is_multiplechoice
INTEGER default 1 not null,
43 is_weighted
INTEGER default 0 not null,
44 is_open
INTEGER default 0 not null,
45 is_terminated
INTEGER default 0 not null,
46 id_author
INTEGER, -- :COMMENT:maethor:120528: not null ?
47 id_group
INTEGER default 1 not null,
48 FOREIGN KEY(id_author
) REFERENCES users(id)
49 FOREIGN KEY(id_group
) REFERENCES groups(id)
52 create table attachments (
53 id INTEGER primary key autoincrement
,
55 id_vote
INTEGER not null,
56 FOREIGN KEY(id_vote
) REFERENCES vote(id)
59 create table choices (
60 id INTEGER primary key autoincrement
,
62 id_vote
INTEGER not null,
63 FOREIGN KEY(id_vote
) REFERENCES vote(id)
66 create table user_choice (
70 FOREIGN KEY(id_user
) REFERENCES users(id),
71 FOREIGN KEY(id_choice
) REFERENCES choices(id),
72 PRIMARY KEY(id_user
, id_choice
)
77 insert into users (email
, password, name, organization
, is_admin
, key) values ("admin@admin.fr", "d033e22ae348aeb5660fc2140aec35850c4da997", "Toto (admin) Tata", "World corp", 1, "test"); -- mdp = admin
78 insert into groups (id, name, system) values (1, "Tous", 1);
79 insert into groups (name) values ("CA");
80 insert into groups (name) values ("Membres");