feat: init
This commit is contained in:
parent
7688020b52
commit
6302dd62d6
33 changed files with 6027 additions and 0 deletions
29
internal/repository/migrations/0001_init.up.sql
Normal file
29
internal/repository/migrations/0001_init.up.sql
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
create table users (
|
||||
id uuid primary key,
|
||||
login text not null
|
||||
);
|
||||
|
||||
create type status as enum ('active', 'offline', 'busy');
|
||||
|
||||
create table stations (
|
||||
id uuid primary key,
|
||||
slug text not null,
|
||||
status status not null
|
||||
);
|
||||
|
||||
create table satellites (
|
||||
id uuid primary key,
|
||||
display_name text not null,
|
||||
status status not null
|
||||
);
|
||||
|
||||
create table subscriptions (
|
||||
id uuid primary key,
|
||||
user_id uuid not null references users(id),
|
||||
station_id uuid null references satellites(id),
|
||||
satellite_id uuid null references stations(id),
|
||||
created_at timestamp not null,
|
||||
updated_at timestamp not null,
|
||||
|
||||
check (station_id is not null or satellite_id is not null)
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue