VEU.WathBody/2-db/migrations/001_schemas_and_ref.sql

20 lines
636 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 001_schemas_and_ref.sql: схемы-слои + справочник двигательных групп.
-- Идемпотентно (IF NOT EXISTS / ON CONFLICT DO NOTHING).
CREATE SCHEMA IF NOT EXISTS src;
CREATE SCHEMA IF NOT EXISTS ref;
CREATE TABLE IF NOT EXISTS ref.exercise_group (
id int PRIMARY KEY,
code text NOT NULL UNIQUE,
title text NOT NULL
);
INSERT INTO ref.exercise_group (id, code, title) VALUES
(1, 'push', 'Жимовые'),
(2, 'pull', 'Тяговые'),
(3, 'legs', 'Ноги'),
(4, 'core', 'Кор'),
(5, 'cardio', 'Кардио')
ON CONFLICT (code) DO NOTHING;