142 lines
3.4 KiB
SQL
142 lines
3.4 KiB
SQL
--
|
|
-- PostgreSQL database dump
|
|
--
|
|
|
|
-- Dumped from database version 16.4 (Debian 16.4-1.pgdg120+1)
|
|
-- Dumped by pg_dump version 16.4 (Debian 16.4-1.pgdg120+1)
|
|
|
|
SET statement_timeout = 0;
|
|
SET lock_timeout = 0;
|
|
SET idle_in_transaction_session_timeout = 0;
|
|
SET client_encoding = 'UTF8';
|
|
SET standard_conforming_strings = on;
|
|
SELECT pg_catalog.set_config('search_path', '', false);
|
|
SET check_function_bodies = false;
|
|
SET xmloption = content;
|
|
SET client_min_messages = warning;
|
|
SET row_security = off;
|
|
|
|
ALTER TABLE ONLY public.student DROP CONSTRAINT student_group_id_fkey;
|
|
ALTER TABLE ONLY public.presence DROP CONSTRAINT presence_student_id_fkey;
|
|
ALTER TABLE ONLY public.student DROP CONSTRAINT student_pkey;
|
|
ALTER TABLE ONLY public.presence DROP CONSTRAINT presence_pkey;
|
|
ALTER TABLE ONLY public."group" DROP CONSTRAINT group_pkey;
|
|
DROP TABLE public.student;
|
|
DROP TABLE public.presence;
|
|
DROP TABLE public."group";
|
|
SET default_tablespace = '';
|
|
|
|
SET default_table_access_method = heap;
|
|
|
|
--
|
|
-- Name: group; Type: TABLE; Schema: public; Owner: postgres
|
|
--
|
|
|
|
CREATE TABLE public."group" (
|
|
group_id integer NOT NULL,
|
|
group_name text NOT NULL
|
|
);
|
|
|
|
|
|
ALTER TABLE public."group" OWNER TO postgres;
|
|
|
|
--
|
|
-- Name: group_group_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
|
--
|
|
|
|
ALTER TABLE public."group" ALTER COLUMN group_id ADD GENERATED ALWAYS AS IDENTITY (
|
|
SEQUENCE NAME public.group_group_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: presence; Type: TABLE; Schema: public; Owner: postgres
|
|
--
|
|
|
|
CREATE TABLE public.presence (
|
|
student_id integer NOT NULL,
|
|
presence_date date NOT NULL,
|
|
presence_is_attendance boolean DEFAULT true NOT NULL,
|
|
presence_lesson_number smallint NOT NULL
|
|
);
|
|
|
|
|
|
ALTER TABLE public.presence OWNER TO postgres;
|
|
|
|
--
|
|
-- Name: student; Type: TABLE; Schema: public; Owner: postgres
|
|
--
|
|
|
|
CREATE TABLE public.student (
|
|
student_id integer NOT NULL,
|
|
student_name text NOT NULL,
|
|
group_id integer
|
|
);
|
|
|
|
|
|
ALTER TABLE public.student OWNER TO postgres;
|
|
|
|
--
|
|
-- Name: student_student_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
|
--
|
|
|
|
ALTER TABLE public.student ALTER COLUMN student_id ADD GENERATED ALWAYS AS IDENTITY (
|
|
SEQUENCE NAME public.student_student_id_seq
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: group group_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
--
|
|
|
|
ALTER TABLE ONLY public."group"
|
|
ADD CONSTRAINT group_pkey PRIMARY KEY (group_id);
|
|
|
|
|
|
--
|
|
-- Name: presence presence_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
--
|
|
|
|
ALTER TABLE ONLY public.presence
|
|
ADD CONSTRAINT presence_pkey PRIMARY KEY (student_id, presence_date, presence_is_attendance, presence_lesson_number);
|
|
|
|
|
|
--
|
|
-- Name: student student_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
--
|
|
|
|
ALTER TABLE ONLY public.student
|
|
ADD CONSTRAINT student_pkey PRIMARY KEY (student_id);
|
|
|
|
|
|
--
|
|
-- Name: presence presence_student_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
--
|
|
|
|
ALTER TABLE ONLY public.presence
|
|
ADD CONSTRAINT presence_student_id_fkey FOREIGN KEY (student_id) REFERENCES public.student(student_id);
|
|
|
|
|
|
--
|
|
-- Name: student student_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
--
|
|
|
|
ALTER TABLE ONLY public.student
|
|
ADD CONSTRAINT student_group_id_fkey FOREIGN KEY (group_id) REFERENCES public."group"(group_id);
|
|
|
|
|
|
--
|
|
-- PostgreSQL database dump complete
|
|
--
|
|
|