43P_Chernov_2.sql 516 B

12345678910111213141516171819202122232425262728293031
  1. drop table roles;
  2. drop table lesson;
  3. --Таблица ролей
  4. create table roles
  5. (
  6. id serial primary key,
  7. role text not null
  8. );
  9. insert into roles (role) values
  10. ('Администратор'),
  11. ('Пользователь');
  12. --select * from roles;
  13. create table users
  14. (
  15. id serial primary key,
  16. surname text not null,
  17. name text not null,
  18. patronymic text,
  19. login text not null,
  20. password byteA not null,
  21. image byteA,
  22. role int not null constraint fk_role_to_user references roles(id) on delete cascade
  23. )