Skip to content

Commit

Permalink
fix: drop restart sequence to prohibit bad requests on restart micros…
Browse files Browse the repository at this point in the history
…ervice
  • Loading branch information
thisdudkin committed Sep 25, 2024
1 parent 54f7796 commit b00bdab
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
CREATE INDEX IF NOT EXISTS idx_books_isbn ON books (isbn);
Original file line number Diff line number Diff line change
@@ -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;
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;
Original file line number Diff line number Diff line change
Expand Up @@ -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;
CREATE INDEX IF NOT EXISTS idx_library_book_id ON library (book_id);
Original file line number Diff line number Diff line change
Expand Up @@ -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;
CREATE INDEX IF NOT EXISTS idx_loans_book_id ON loans (book_id);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b00bdab

Please sign in to comment.