From b00bdabd40bfc88587f39da6a3c07d923c88fcd7 Mon Sep 17 00:00:00 2001 From: Alexander Dudkin Date: Wed, 25 Sep 2024 23:31:01 +0300 Subject: [PATCH] fix: drop restart sequence to prohibit bad requests on restart microservice --- .../src/main/resources/db/postgres/schema.sql | 4 +--- .../src/main/resources/db/postgres/data.sql | 18 +++++++++--------- .../src/main/resources/db/postgres/schema.sql | 4 +--- .../src/main/resources/db/postgres/schema.sql | 4 +--- .../src/main/resources/db/postgres/schema.sql | 2 -- 5 files changed, 12 insertions(+), 20 deletions(-) diff --git a/library-api-books-service/src/main/resources/db/postgres/schema.sql b/library-api-books-service/src/main/resources/db/postgres/schema.sql index c44cd55..e3249de 100644 --- a/library-api-books-service/src/main/resources/db/postgres/schema.sql +++ b/library-api-books-service/src/main/resources/db/postgres/schema.sql @@ -8,6 +8,4 @@ CREATE TABLE IF NOT EXISTS books ( appeared_utc TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX IF NOT EXISTS idx_books_isbn ON books (isbn); - -ALTER SEQUENCE books_id_seq RESTART WITH 100; \ No newline at end of file +CREATE INDEX IF NOT EXISTS idx_books_isbn ON books (isbn); \ No newline at end of file diff --git a/library-api-library-service/src/main/resources/db/postgres/data.sql b/library-api-library-service/src/main/resources/db/postgres/data.sql index f065350..6a61175 100644 --- a/library-api-library-service/src/main/resources/db/postgres/data.sql +++ b/library-api-library-service/src/main/resources/db/postgres/data.sql @@ -1,9 +1,9 @@ -INSERT INTO library (book_id, status) VALUES (100, 'IN_LIBRARY') ON CONFLICT DO NOTHING; -INSERT INTO library (book_id, status) VALUES (101, 'IN_LIBRARY') ON CONFLICT DO NOTHING; -INSERT INTO library (book_id, status) VALUES (102, 'ON_LOAN') ON CONFLICT DO NOTHING; -INSERT INTO library (book_id, status) VALUES (103, 'IN_LIBRARY') ON CONFLICT DO NOTHING; -INSERT INTO library (book_id, status) VALUES (104, 'IN_LIBRARY') ON CONFLICT DO NOTHING; -INSERT INTO library (book_id, status) VALUES (105, 'IN_LIBRARY') ON CONFLICT DO NOTHING; -INSERT INTO library (book_id, status) VALUES (106, 'IN_LIBRARY') ON CONFLICT DO NOTHING; -INSERT INTO library (book_id, status) VALUES (107, 'ON_LOAN') ON CONFLICT DO NOTHING; -INSERT INTO library (book_id, status) VALUES (108, 'ON_LOAN') ON CONFLICT DO NOTHING; \ No newline at end of file +INSERT INTO library (book_id, status) VALUES (1, 'IN_LIBRARY') ON CONFLICT DO NOTHING; +INSERT INTO library (book_id, status) VALUES (2, 'IN_LIBRARY') ON CONFLICT DO NOTHING; +INSERT INTO library (book_id, status) VALUES (3, 'ON_LOAN') ON CONFLICT DO NOTHING; +INSERT INTO library (book_id, status) VALUES (4, 'IN_LIBRARY') ON CONFLICT DO NOTHING; +INSERT INTO library (book_id, status) VALUES (5, 'IN_LIBRARY') ON CONFLICT DO NOTHING; +INSERT INTO library (book_id, status) VALUES (6, 'IN_LIBRARY') ON CONFLICT DO NOTHING; +INSERT INTO library (book_id, status) VALUES (7, 'IN_LIBRARY') ON CONFLICT DO NOTHING; +INSERT INTO library (book_id, status) VALUES (8, 'ON_LOAN') ON CONFLICT DO NOTHING; +INSERT INTO library (book_id, status) VALUES (9, 'ON_LOAN') ON CONFLICT DO NOTHING; \ No newline at end of file diff --git a/library-api-library-service/src/main/resources/db/postgres/schema.sql b/library-api-library-service/src/main/resources/db/postgres/schema.sql index 436996b..b7adeb9 100644 --- a/library-api-library-service/src/main/resources/db/postgres/schema.sql +++ b/library-api-library-service/src/main/resources/db/postgres/schema.sql @@ -5,6 +5,4 @@ CREATE TABLE IF NOT EXISTS library ( created_utc TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX IF NOT EXISTS idx_library_book_id ON library (book_id); - -ALTER SEQUENCE library_id_seq RESTART WITH 135; \ No newline at end of file +CREATE INDEX IF NOT EXISTS idx_library_book_id ON library (book_id); \ No newline at end of file diff --git a/library-api-loan-service/src/main/resources/db/postgres/schema.sql b/library-api-loan-service/src/main/resources/db/postgres/schema.sql index a560e93..6c51e24 100644 --- a/library-api-loan-service/src/main/resources/db/postgres/schema.sql +++ b/library-api-loan-service/src/main/resources/db/postgres/schema.sql @@ -8,6 +8,4 @@ CREATE TABLE IF NOT EXISTS loans ( ); CREATE INDEX IF NOT EXISTS idx_loans_user_id ON loans (user_id); -CREATE INDEX IF NOT EXISTS idx_loans_book_id ON loans (book_id); - -ALTER SEQUENCE loans_id_seq RESTART WITH 100; \ No newline at end of file +CREATE INDEX IF NOT EXISTS idx_loans_book_id ON loans (book_id); \ No newline at end of file diff --git a/library-api-users-service/src/main/resources/db/postgres/schema.sql b/library-api-users-service/src/main/resources/db/postgres/schema.sql index 691d153..d61b280 100644 --- a/library-api-users-service/src/main/resources/db/postgres/schema.sql +++ b/library-api-users-service/src/main/resources/db/postgres/schema.sql @@ -10,8 +10,6 @@ CREATE TABLE IF NOT EXISTS users ( CREATE INDEX IF NOT EXISTS idx_users_username ON users (username); -ALTER SEQUENCE users_id_seq RESTART WITH 100; - CREATE TABLE IF NOT EXISTS user_roles ( user_id BIGINT NOT NULL, user_role VARCHAR(50) NOT NULL,