Skip to content

Commit

Permalink
PRSD-642: Resyncs id generating sequences after test data input
Browse files Browse the repository at this point in the history
  • Loading branch information
isobel-softwire committed Dec 12, 2024
1 parent 56dd313 commit 6af8257
Showing 1 changed file with 39 additions and 19 deletions.
58 changes: 39 additions & 19 deletions src/main/resources/data-local.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,24 @@ VALUES ('urn:fdc:gov.uk:2022:ABCDE', '07712345678', '01/01/00', '09/13/24', '09/
INSERT INTO local_authority (id, name, created_date, last_modified_date)
VALUES (1, 'Betelgeuse', '09/13/24', '09/13/24');

INSERT INTO local_authority_user (subject_identifier, is_manager, local_authority_id, created_date, last_modified_date, name, email)
SELECT setval(pg_get_serial_sequence('local_authority', 'id'), (SELECT MAX(id) FROM local_authority));

INSERT INTO local_authority_user (subject_identifier, is_manager, local_authority_id, created_date, last_modified_date,
name, email)
VALUES ('urn:fdc:gov.uk:2022:KLMNO', true, 1, '10/07/24', '10/07/24', 'Ford Prefect', '[email protected]'),
('urn:fdc:gov.uk:2022:UVWXY', true, 1, '10/14/24', '10/14/24','Mock User', '[email protected]'),
('urn:fdc:gov.uk:2022:PQRST', false, 1, '10/09/24', '10/09/24','Arthur Dent', '[email protected]'),
('urn:fdc:gov.uk:2022:07lXHJeQwE0k5PZO7w_PQF425vT8T7e63MrvyPYNSoI', true, 1, '10/09/24', '10/09/24', 'Jasmin Conterio',
('urn:fdc:gov.uk:2022:UVWXY', true, 1, '10/14/24', '10/14/24', 'Mock User', '[email protected]'),
('urn:fdc:gov.uk:2022:PQRST', false, 1, '10/09/24', '10/09/24', 'Arthur Dent', '[email protected]'),
('urn:fdc:gov.uk:2022:07lXHJeQwE0k5PZO7w_PQF425vT8T7e63MrvyPYNSoI', true, 1, '10/09/24', '10/09/24',
'Jasmin Conterio',
'[email protected]'),
('urn:fdc:gov.uk:2022:mwfvbb5GgiDh0acjz9EDDQ7zwskWZzUSnWfavL70f6s', true, 1, '10/02/24', '10/02/24', 'Isobel Ibironke',
('urn:fdc:gov.uk:2022:mwfvbb5GgiDh0acjz9EDDQ7zwskWZzUSnWfavL70f6s', true, 1, '10/02/24', '10/02/24',
'Isobel Ibironke',
'[email protected]'),
('urn:fdc:gov.uk:2022:n93slCXHsxJ9rU6-AFM0jFIctYQjYf0KN9YVuJT-cao', true, 1, '10/15/24', '10/15/24', 'PRSDB LA Admin',
('urn:fdc:gov.uk:2022:n93slCXHsxJ9rU6-AFM0jFIctYQjYf0KN9YVuJT-cao', true, 1, '10/15/24', '10/15/24',
'PRSDB LA Admin',
'[email protected]'),
('urn:fdc:gov.uk:2022:cgVX2oJWKHMwzm8Gzx25CSoVXixVS0rw32Sar4Om8vQ', false, 1, '10/15/24', '10/15/24', 'PRSDB La User',
('urn:fdc:gov.uk:2022:cgVX2oJWKHMwzm8Gzx25CSoVXixVS0rw32Sar4Om8vQ', false, 1, '10/15/24', '10/15/24',
'PRSDB La User',
'[email protected]');

INSERT INTO local_authority_invitation (invited_email, inviting_authority_id, token)
Expand All @@ -49,22 +56,35 @@ VALUES ('[email protected]', 1, gen_random_uuid()),
('[email protected]', 1, gen_random_uuid());

INSERT INTO registration_number (id, created_date, number, type)
VALUES (1, '09/13/24', 2001001001, 1),
VALUES (1, '09/13/24', 2001001001, 1),
(2, '09/13/24', 3002001002, 1),
(3, '10/07/24', 4003001003, 1),
(4, '10/14/24', 5004001004, 1),
(5, '10/09/24', 6005001005, 1);

SELECT setval(pg_get_serial_sequence('registration_number', 'id'), (SELECT MAX(id) FROM registration_number));

INSERT INTO address (id, created_date, last_modified_date, uprn, single_line_address)
VALUES (1, '09/13/24', '09/13/24', 1, '1 Fictional Road'),
(2, '09/13/24', '09/13/24', 2, '2 Fake Way'),
(3, '09/13/24', '09/13/24', 3, '3 Imaginary Street'),
(4, '09/13/24', '09/13/24', 4, '4 Pretend Crescent'),
(5, '09/13/24', '09/13/24', 5, '5 Mythical Place');
VALUES (1, '09/13/24', '09/13/24', 1, '1 Fictional Road'),
(2, '09/13/24', '09/13/24', 2, '2 Fake Way'),
(3, '09/13/24', '09/13/24', 3, '3 Imaginary Street'),
(4, '09/13/24', '09/13/24', 4, '4 Pretend Crescent'),
(5, '09/13/24', '09/13/24', 5, '5 Mythical Place');

SELECT setval(pg_get_serial_sequence('address', 'id'), (SELECT MAX(id) FROM address));

INSERT INTO landlord (id, created_date, last_modified_date, registration_number_id, address_id, date_of_birth,
is_active, phone_number, subject_identifier, name, email)
VALUES (1, '09/13/24', '09/13/24', 1, 1, '09/13/2000', true, 07111111111, 'urn:fdc:gov.uk:2022:KLMNO',
'Alexander Smith', '[email protected]'),
(2, '09/13/24', '09/13/24', 2, 2, '08/13/2001', true, 07111111111, 'urn:fdc:gov.uk:2022:ABCDE',
'Alexandra Davies', '[email protected]'),
(3, '09/13/24', '09/13/24', 3, 3, '07/13/1997', true, 07111111111, 'urn:fdc:gov.uk:2022:PQRST',
'Evan Alexandrescu', '[email protected]'),
(4, '09/13/24', '09/13/24', 4, 4, '06/13/1989', true, 07111111111,
'urn:fdc:gov.uk:2022:07lXHJeQwE0k5PZO7w_PQF425vT8T7e63MrvyPYNSoI', 'Tobias Evans', '[email protected]'),
(5, '09/13/24', '09/13/24', 5, 5, '05/13/1950', true, 07111111111,
'urn:fdc:gov.uk:2022:mwfvbb5GgiDh0acjz9EDDQ7zwskWZzUSnWfavL70f6s', 'Margaret Mary Smith',
'[email protected]');

INSERT INTO landlord (id, created_date, last_modified_date, registration_number_id, address_id, date_of_birth, is_active, phone_number, subject_identifier, name, email)
VALUES (1, '09/13/24', '09/13/24', 1, 1,'09/13/2000', true, 07111111111, 'urn:fdc:gov.uk:2022:KLMNO', 'Alexander Smith', '[email protected]'),
(2, '09/13/24', '09/13/24', 2, 2,'08/13/2001', true, 07111111111, 'urn:fdc:gov.uk:2022:UVWXY', 'Alexandra Davies', '[email protected]'),
(3, '09/13/24', '09/13/24', 3, 3,'07/13/1997', true, 07111111111, 'urn:fdc:gov.uk:2022:PQRST', 'Evan Alexandrescu', '[email protected]'),
(4, '09/13/24', '09/13/24', 4, 4,'06/13/1989', true, 07111111111, 'urn:fdc:gov.uk:2022:07lXHJeQwE0k5PZO7w_PQF425vT8T7e63MrvyPYNSoI', 'Tobias Evans', '[email protected]'),
(5, '09/13/24', '09/13/24', 5, 5,'05/13/1950', true, 07111111111, 'urn:fdc:gov.uk:2022:mwfvbb5GgiDh0acjz9EDDQ7zwskWZzUSnWfavL70f6s', 'Margaret Mary Smith', '[email protected]');
SELECT setval(pg_get_serial_sequence('landlord', 'id'), (SELECT MAX(id) FROM landlord));

0 comments on commit 6af8257

Please sign in to comment.