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

16 lines
349 B
MySQL
Raw Normal View History

2024-02-02 14:39:13 +00:00
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)
);