You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.5 KiB

3 years ago
3 years ago
  1. CREATE TABLE IF NOT EXISTS users (
  2. id SERIAL PRIMARY KEY,
  3. username VARCHAR(255) UNIQUE NOT NULL,
  4. password VARCHAR(255) NOT NULL,
  5. email VARCHAR(255) UNIQUE NULL,
  6. firstname VARCHAR(100) NULL,
  7. surname VARCHAR(100) NULL,
  8. avatar VARCHAR(100) NULL,
  9. active INT NOT NULL
  10. );
  11. CREATE TABLE IF NOT EXISTS roles (
  12. id SERIAL PRIMARY KEY,
  13. name VARCHAR(100) NOT NULL,
  14. active INT NOT NULL
  15. );
  16. CREATE TABLE IF NOT EXISTS users_roles (
  17. users_id INT NOT NULL,
  18. roles INT NOT NULL,
  19. FOREIGN KEY (users_id) REFERENCES users (id)
  20. );
  21. CREATE TABLE IF NOT EXISTS users_rolesprovider_activationkey (
  22. id SERIAL PRIMARY KEY,
  23. users_id INT NOT NULL,
  24. roles_id INT NOT NULL,
  25. activationkey uuid NOT NULL,
  26. FOREIGN KEY (users_id) REFERENCES users (id),
  27. FOREIGN KEY (roles_id) REFERENCES roles (id)
  28. );
  29. CREATE TABLE IF NOT EXISTS educemaden_organizations (
  30. id INT NOT NULL,
  31. active VARCHAR(20) NULL,
  32. name VARCHAR(255) NOT NULL,
  33. creation_date varchar(50) NULL,
  34. inep_code varchar(100) NULL,
  35. phone varchar(100) NOT NULL,
  36. type varchar(100) NULL,
  37. website varchar(255) NULL,
  38. login varchar(50) NULL,
  39. address varchar(50) NULL,
  40. responsible varchar(50) NULL
  41. );
  42. CREATE TABLE IF NOT EXISTS users_educemaden_organizations (
  43. id SERIAL PRIMARY KEY,
  44. users_id INT NOT NULL,
  45. educemaden_organizations_id INT NOT NULL,
  46. activationkey uuid NOT NULL,
  47. FOREIGN KEY (users_id) REFERENCES users (id)
  48. );