Skip to content

Commit

Permalink
[RSN-46] - Changed primary key setvalue (#18)
Browse files Browse the repository at this point in the history
* Changed primary key setvalue to 10

* Update init-dev-data.sql

* Added setval to init-db
  • Loading branch information
bilimig authored and rogacky11 committed May 17, 2024
1 parent 7a11120 commit 43e1397
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
15 changes: 10 additions & 5 deletions Database/init-db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,21 @@ INSERT INTO users.role ("id", "name") VALUES
(1, 'User'),
(2, 'Organizer'),
(3, 'Admin');

INSERT INTO common.object_type ("id", "name") VALUES (1, 'Event'),
SELECT setval('common.address_id_seq', (SELECT MAX(id) FROM users.role));

INSERT INTO common.object_type ("id", "name") VALUES
(1, 'Event'),
(2, 'User');

SELECT setval('common.address_id_seq', (SELECT MAX(id) FROM common.object_type));

INSERT INTO common.status ("id", "name", "object_type_id") VALUES
(1, 'Interested', 2),
(2, 'Participating', 2),
(3, 'Completed', 1),
(4, 'In progress', 1),
(5, 'Waiting for approval', 1);

SELECT setval('common.address_id_seq', (SELECT MAX(id) FROM common.status));

INSERT INTO events.tag ("id", "name") VALUES
(1, 'Technologia'),
(2, 'Sport'),
Expand All @@ -176,4 +180,5 @@ INSERT INTO events.tag ("id", "name") VALUES
(7, 'Hip Hop'),
(8, 'Esport'),
(9, 'League of Legends'),
(10, 'Zdrowie');
(10, 'Zdrowie');
SELECT setval('common.address_id_seq', (SELECT MAX(id) FROM events.tag));
10 changes: 8 additions & 2 deletions Database/init-dev-data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ INSERT INTO common.address ("id", "city", "country", "street", "state", "zip_cod
(8, 'Kraków', 'Polska', 'Floriańska 7', 'Małopolskie', '30-001'),
(9, 'Gdańsk', 'Polska', 'Długa 69', 'Pomorskie', '80-001'),
(10, 'Wrocław', 'Polska', 'Legnicka 420', 'Dolnośląskie', '51-702');
SELECT setval('common.address_id_seq', (SELECT MAX(id) FROM common.address));

INSERT INTO users.user ("id", "name", "surname", "username", "password", "created_at", "updated_at", "role_id", "email", "is_active", "address_id", "phone") VALUES
(1, 'Kamil', 'Owczarski', 'bilimigus', 'password', '2023-03-20 08:00:00', '2023-03-20 08:00:00', 1, '[email protected]', true, 1, '+48 123456789'),
Expand All @@ -21,7 +22,7 @@ INSERT INTO users.user ("id", "name", "surname", "username", "password", "create
(8, 'Tomasz', 'Zieliński', 'tzielinski', 'qwerty', '2022-05-25 15:00:00', '2022-06-20 11:30:10', 1, '[email protected]', true, 6, '+48 456123789'),
(9, 'Magdalena', 'Kowalczyk', 'mkowalczyk', 'mojehaslo', '2022-06-30 17:10:00', '2022-07-15 13:15:25', 3, '[email protected]', true, 7, '+48 987654123'),
(10, 'Marcin', 'Szymański', 'mszymanski', 'password', '2022-07-05 09:00:00', '2022-08-05 08:20:35', 2, '[email protected]', true, 8, '+48 321789654');
SELECT setval('users.user_id_seq', (SELECT MAX(id) FROM users.user));

INSERT INTO events.event ("id", "name", "address_id", "description", "organizer_id", "start_at", "end_at", "created_at", "updated_at", "slug", "status_id") VALUES
(1, 'Tech Conference', 1, 'Annual tech conference', 1, '2023-10-01 09:00:00', '2023-10-02 17:00:00', '2023-09-01 08:00:00', '2023-09-01 08:00:00', 'tech-conference', 1),
Expand All @@ -34,6 +35,7 @@ INSERT INTO events.event ("id", "name", "address_id", "description", "organizer_
(8, 'Wieczór Jazzowy', 8, 'Relaksujące dźwięki jazzu w kameralnej atmosferze', 8, CURRENT_TIMESTAMP + '1 day'::INTERVAL, CURRENT_TIMESTAMP + '1 day'::INTERVAL + '5 hours'::INTERVAL, '2023-09-01 08:00:00', '2023-09-01 08:00:00', 'wieczor-jazzowy', 1),
(9, 'Koncert Klasyczny', 9, 'Muzyka klasyczna w wykonaniu renomowanych artystów', 10, CURRENT_TIMESTAMP + '1 day'::INTERVAL, CURRENT_TIMESTAMP + '1 day'::INTERVAL + '3 hours'::INTERVAL, '2023-01-01 15:00:00', '2023-02-01 08:00:00', 'koncert-klasyczny', 1),
(10, 'Turniej w League of Legends', 10, 'Turniej LAN dla miłośnikow esportu i gry League of Legends', 10, CURRENT_TIMESTAMP - '1 day'::INTERVAL, CURRENT_TIMESTAMP - '3 hours'::INTERVAL, '2023-01-01 15:00:00', '2023-02-01 08:00:00', 'turniej-lol', 1);
SELECT setval('events.event_id_seq', (SELECT MAX(id) FROM events.event));

INSERT INTO events.event_tag ("event_id", "tag_id") VALUES
(1, 1),
Expand Down Expand Up @@ -61,6 +63,7 @@ INSERT INTO events.participant ("id", "event_id", "user_id", "status_id") VALUES
(8, 7, 8, 2),
(9, 9, 9, 2),
(10, 10, 10, 2);
SELECT setval('events.participant_id_seq', (SELECT MAX(id) FROM events.participant));

INSERT INTO events.parameter ("id", "key", "value") VALUES
(1, 'Liczba Uczestników', '1000'),
Expand All @@ -73,6 +76,7 @@ INSERT INTO events.parameter ("id", "key", "value") VALUES
(8, 'Czas Trwania', '3 dni'),
(9, 'Czas Trwania', '10 dni'),
(10, 'Miejsce Wydarzenia', 'Plenerowe');
SELECT setval('events.parameter_id_seq', (SELECT MAX(id) FROM events.parameter));

INSERT INTO events.event_parameter ("parameter_id", "event_id") VALUES
(1, 1),
Expand All @@ -97,6 +101,7 @@ INSERT INTO events.comment ("id", "event_id", "content", "created_at", "user_id"
(8, 8, 'Jestem zachwycony!', '2024-04-30', 8),
(9, 9, 'To będzie świetna zabawa!', '2024-05-18', 9),
(10, 10, 'jd orka', '2024-06-25', 10);
SELECT setval('events.comment_id_seq', (SELECT MAX(id) FROM events.comment));

INSERT INTO users.interest ("id", "name") VALUES
(1, 'Programowanie'),
Expand All @@ -109,6 +114,7 @@ INSERT INTO users.interest ("id", "name") VALUES
(8, 'Kulinaria'),
(9, 'Podróże'),
(10, 'Gry komputerowe');
SELECT setval('users.interest_id_seq', (SELECT MAX(id) FROM users.interest));

INSERT INTO users.user_interest ("user_id", "interest_id", "level") VALUES
(1, 1, 3),
Expand All @@ -118,6 +124,6 @@ INSERT INTO users.user_interest ("user_id", "interest_id", "level") VALUES
(5, 5, 3),
(6, 6, 4),
(7, 7, 6),
(8, 8,3),
(8, 8, 3),
(9, 9, 1),
(10, 10, 5);

0 comments on commit 43e1397

Please sign in to comment.