schema.sql 1.1 KB

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