This repository has been archived on 2024-04-25. You can view files and clone it, but cannot push or open issues or pull requests.
golang-rest-example/migrations/000001_init.up.sql
2024-02-02 15:39:13 +01:00

15 lines
349 B
SQL

CREATE TABLE IF NOT EXISTS groups(
id serial PRIMARY KEY,
name VARCHAR (300) UNIQUE NOT NULL
);
CREATE TABLE IF NOT EXISTS users(
id serial PRIMARY KEY,
email VARCHAR (300) UNIQUE NOT NULL,
name VARCHAR (100) UNIQUE NOT NULL,
group_id INT,
CONSTRAINT fk_users_groups_group_id
FOREIGN KEY(group_id)
REFERENCES groups(id)
);