1 drop table if exists choices
;
2 drop table if exists attachments
;
3 drop table if exists votes
;
4 drop table if exists roles
;
5 drop table if exists users
;
6 drop table if exists user_role
;
9 id INTEGER primary key autoincrement
,
10 email
TEXT unique not null,
11 password TEXT not null,
14 is_admin
INTEGER default 0 not null,
19 id INTEGER primary key autoincrement
,
21 system INTEGER default 0 not null
24 create table user_role (
27 FOREIGN KEY(id_user
) REFERENCES users(id),
28 FOREIGN KEY(id_role
) REFERENCES roles(id),
29 PRIMARY KEY(id_user
, id_role
)
33 id INTEGER primary key autoincrement
,
37 date_begin
INTEGER default CURRENT_TIMESTAMP not null,
38 date_end
INTEGER not null,
39 is_transparent
INTEGER default 1 not null,
40 is_public
INTEGER default 1 not null,
41 is_multiplechoice
INTEGER default 1 not null,
42 is_weighted
INTEGER default 0 not null,
43 is_open
INTEGER default 0 not null,
44 id_author
INTEGER, -- :COMMENT:maethor:120528: not null ?
45 id_role
INTEGER default 1 not null,
46 FOREIGN KEY(id_author
) REFERENCES users(id)
47 FOREIGN KEY(id_role
) REFERENCES roles(id)
50 create table attachments (
52 id_vote
INTEGER not null,
53 FOREIGN KEY(id_vote
) REFERENCES vote(id),
54 PRIMARY KEY(url
, id_vote
)
57 create table choices (
58 id INTEGER primary key autoincrement
,
60 id_vote
INTEGER not null,
61 FOREIGN KEY(id_vote
) REFERENCES vote(id)
66 insert into users (email
, password, name, organization
, is_admin
, key) values ("admin@admin.fr", "d033e22ae348aeb5660fc2140aec35850c4da997", "Toto (admin) Tata", "World corp", 1, "test"); -- mdp = admin
67 insert into roles (id, name, system) values (1, "Tous", 1);
68 insert into roles (name) values ("CA");
69 insert into roles (name) values ("Members");