Skip to content

Commit

Permalink
events hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
pai0id committed Jul 19, 2024
1 parent 20158f4 commit e2b0064
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
28 changes: 22 additions & 6 deletions migrations/002_init_clubs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,34 @@ create TABLE if not exists encounter (
club_id int not null
);

create TABLE IF NOT EXISTS event
-- create TABLE IF NOT EXISTS event
-- (
-- id serial primary KEY,
-- title text not null,
-- description text not null,
-- prompt text not null,
-- media_id int not null,
-- date timestamp not null,
-- approved boolean default false,
-- created_at timestamp not null,
-- club_id int not null,
-- main_org int not null,
-- reg_url text default '',
-- reg_open_date timestamp not null,
-- feedback_url text default ''
-- );

create table IF NOT EXISTS event
(
id serial primary KEY,
id serial primary key,
title text not null,
description text not null,
prompt text not null,
media_id int not null,
date timestamp not null,
approved boolean default false,
created_at timestamp not null,
club_id int not null,
main_org int not null,
created_by int not null,
reg_url text default '',
reg_open_date timestamp not null,
feedback_url text default ''
Expand Down Expand Up @@ -69,9 +85,9 @@ ALTER TABLE encounter ADD FOREIGN KEY (club_id) REFERENCES club(id);
ALTER TABLE club ADD FOREIGN KEY (logo) REFERENCES mediafile(id);
ALTER TABLE club ADD FOREIGN KEY (parent_id) REFERENCES club(id);

ALTER TABLE event ADD FOREIGN KEY (club_id) REFERENCES club(id);
-- ALTER TABLE event ADD FOREIGN KEY (club_id) REFERENCES club(id);
ALTER TABLE event ADD FOREIGN KEY (media_id) REFERENCES mediafile(id);
ALTER TABLE event ADD FOREIGN KEY (main_org) REFERENCES member(id);
-- ALTER TABLE event ADD FOREIGN KEY (main_org) REFERENCES member(id);

ALTER TABLE club_photo ADD FOREIGN KEY (media_id) REFERENCES mediafile(id);
ALTER TABLE club_photo ADD FOREIGN KEY (club_id) REFERENCES club(id);
Expand Down
13 changes: 9 additions & 4 deletions migrations/012_insert_event.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
-- +goose Up
-- +goose StatementBegin

INSERT INTO event (title, description, prompt, media_id, date, approved, created_at, club_id, main_org, reg_url, reg_open_date, feedback_url)
-- INSERT INTO event (title, description, prompt, media_id, date, approved, created_at, club_id, main_org, reg_url, reg_open_date, feedback_url)
-- VALUES
-- ('Event 1', 'Description of Event 1', 'Prompt for Event 1', 1, '2022-01-01 10:00:00', true, '2022-01-01 09:00:00', 1, 1, 'https://example.com/register1', '2022-01-01 08:00:00', 'https://example.com/feedback1'),
-- ('Event 2', 'Description of Event 2', 'Prompt for Event 2', 2, '2022-02-01 10:00:00', false, '2022-02-01 09:00:00', 2, 2, 'https://example.com/register2', '2022-02-01 08:00:00', 'https://example.com/feedback2'),
-- ('Event 3', 'Description of Event 3', 'Prompt for Event 3', 3, '2022-03-01 10:00:00', true, '2022-03-01 09:00:00', 3, 3, 'https://example.com/register3', '2022-03-01 08:00:00', 'https://example.com/feedback3');
INSERT INTO event (title, description, prompt, media_id, date, approved, created_at, created_by, reg_url, reg_open_date, feedback_url)
VALUES
('Event 1', 'Description of Event 1', 'Prompt for Event 1', 1, '2022-01-01 10:00:00', true, '2022-01-01 09:00:00', 1, 1, 'https://example.com/register1', '2022-01-01 08:00:00', 'https://example.com/feedback1'),
('Event 2', 'Description of Event 2', 'Prompt for Event 2', 2, '2022-02-01 10:00:00', false, '2022-02-01 09:00:00', 2, 2, 'https://example.com/register2', '2022-02-01 08:00:00', 'https://example.com/feedback2'),
('Event 3', 'Description of Event 3', 'Prompt for Event 3', 3, '2022-03-01 10:00:00', true, '2022-03-01 09:00:00', 3, 3, 'https://example.com/register3', '2022-03-01 08:00:00', 'https://example.com/feedback3');
('Event 1', 'Description of Event 1', 'Prompt for Event 1', 1, '2022-01-01 10:00:00', true, '2022-01-01 09:00:00', 1, 'https://example.com/register1', '2022-01-01 08:00:00', 'https://example.com/feedback1'),
('Event 2', 'Description of Event 2', 'Prompt for Event 2', 2, '2022-02-01 10:00:00', false, '2022-02-01 09:00:00', 2, 'https://example.com/register2', '2022-02-01 08:00:00', 'https://example.com/feedback2'),
('Event 3', 'Description of Event 3', 'Prompt for Event 3', 3, '2022-03-01 10:00:00', true, '2022-03-01 09:00:00', 3, 'https://example.com/register3', '2022-03-01 08:00:00', 'https://example.com/feedback3');

-- +goose StatementEnd

Expand Down

0 comments on commit e2b0064

Please sign in to comment.