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.

24 lines
565 B

  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. (
  13. id SERIAL PRIMARY KEY,
  14. name VARCHAR(100) NOT NULL,
  15. active INT NOT NULL
  16. );
  17. CREATE TABLE IF NOT EXISTS users_roles
  18. (
  19. users_id INT NOT NULL,
  20. roles INT NOT NULL,
  21. FOREIGN KEY (users_id) REFERENCES users (id)
  22. );