fix typo schema
[cavote.git] / schema.sql
1 drop table if exists votes;
2 drop table if exists users;
3
4 create table users (
5 id INTEGER primary key autoincrement,
6 email TEXT unique not null,
7 password TEXT not null,
8 name TEXT unique,
9 organization TEXT,
10 is_admin INTEGER default 0 not null,
11 key TEXT
12 );
13
14 create table votes (
15 id INTEGER primary key autoincrement,
16 title TEXT not null,
17 description TEXT,
18 category TEXT,
19 date_begin INTEGER default CURRENT_TIMESTAMP not null,
20 date_end INTEGER not null,
21 is_transparent INTEGER default 1 not null,
22 is_public INTEGER default 1 not null,
23 is_multiplechoice INTEGER default 1 not null,
24 is_weighted INTEGER default 0 not null,
25 is_closed INTEGER default 0 not null,
26 id_author INTEGER, -- :COMMENT:maethor:120528: not null ?
27 --id_role INTEGER,
28 FOREIGN KEY(id_author) REFERENCES users(id)
29 --FOREIGN KEY(id_role) REFERENCES role(id)
30 );
31
32 -- Test data
33
34 insert into users (email, password, name, organization, is_admin, key) values ("admin@admin.fr", "admin", "Toto (admin) Tata", "World corp", 1, "test");
35