Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
afurgapil committed Jun 22, 2024
1 parent 7d35222 commit 306ae5e
Showing 1 changed file with 58 additions and 2 deletions.
60 changes: 58 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,64 @@ jobs:
- name: Run database migrations
run: |
chmod +x ./scripts/create_migrations.sh
./scripts/create_migrations.sh
psql -h localhost -p 5432 -U postgres -d librarymanagementsystem_test -c "
CREATE TABLE IF NOT EXISTS public.book (
book_id character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
title character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
author character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
genre character varying(255) COLLATE pg_catalog.\"default\",
publication_date character varying(255) COLLATE pg_catalog.\"default\",
publisher character varying(255) COLLATE pg_catalog.\"default\",
isbn character varying(255) COLLATE pg_catalog.\"default\",
page_count integer,
shelf_number character varying(50) COLLATE pg_catalog.\"default\",
language character varying(255) COLLATE pg_catalog.\"default\",
donor character varying(255) COLLATE pg_catalog.\"default\",
CONSTRAINT book_pkey PRIMARY KEY (book_id)
) TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.book OWNER to postgres;
CREATE TABLE IF NOT EXISTS public.employee (
employee_id character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
employee_mail character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
employee_username character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
employee_phone_number character varying(20) COLLATE pg_catalog.\"default\" NOT NULL,
\"position\" character varying(100) COLLATE pg_catalog.\"default\" NOT NULL,
employee_password character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
CONSTRAINT employee_pkey PRIMARY KEY (employee_id)
) TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.employee OWNER to postgres;
CREATE TABLE IF NOT EXISTS public.student (
student_id character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
student_mail character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
student_password character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
debit integer NOT NULL DEFAULT 0,
book_limit integer NOT NULL DEFAULT 10,
is_banned boolean NOT NULL DEFAULT false,
CONSTRAINT student_pkey PRIMARY KEY (student_id)
) TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.student OWNER to postgres;
CREATE TABLE IF NOT EXISTS public.book_borrow (
borrow_id character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
student_id character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
book_id character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
borrow_date character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
delivery_date character varying(255) COLLATE pg_catalog.\"default\" NOT NULL,
is_extended boolean NOT NULL DEFAULT false,
CONSTRAINT book_borrow_pkey PRIMARY KEY (borrow_id),
CONSTRAINT fk_book_borrow_boo FOREIGN KEY (book_id)
REFERENCES public.book (book_id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE CASCADE
NOT VALID,
CONSTRAINT fk_book_borrow_student FOREIGN KEY (student_id)
REFERENCES public.student (student_id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE CASCADE
NOT VALID
) TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.book_borrow OWNER to postgres;"
- name: Run tests
run: go test -v ./... -coverprofile=coverage.txt -covermode=atomic

0 comments on commit 306ae5e

Please sign in to comment.