/
Arsinenko
/
CompClubAPI_Go
Обзор
Документация
Войти
/
Arsinenko
/
CompClubAPI_Go
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
sqlc/schema.sql
83 строки
2 KB
Arsinenko
EquipmentService
15 окт 2025, 14:21
15 окт 2025, 14:21
fd78e25
Код
Авторство
О чём код?
create table users ( login text not null constraint users_pk primary key, password_hash text not null, role text default 'client'::text not null constraint role_allowed check (role = ANY (ARRAY ['client'::text, 'admin'::text])), balance money ); alter table users owner to postgres; create table clubs ( name text not null primary key, address text not null, phone varchar(8) not null, working_hours text not null, is_alive boolean default true ); alter table clubs owner to postgres; create table tariffs ( name text not null primary key, price money not null ); alter table tariffs owner to postgres; create table working_spaces ( id serial primary key, enabled boolean default true, club text not null references clubs, tariff text not null references tariffs ); alter table working_spaces owner to postgres; create table bookings ( id serial primary key, "user" text not null references users, working_space integer not null references working_spaces, start_time timestamp not null, end_time timestamp ); alter table bookings owner to postgres; create table equipments( id serial primary key, name text not null, working_space integer not null references working_spaces, status boolean default true ); alter table equipments owner to postgres; create table club_stats( id serial primary key, club text not null references clubs, balance money not null );