mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2026-03-03 07:00:51 +01:00
Add DB migrations and run them on startup
Enable sqlx "migrate" feature and add SQL migrations to create the database schema: pg_trgm extension, sources, genres, authors, sequences, books, junction tables, annotations, and supporting indexes
This commit is contained in:
9
migrations/20260116092206_create_sequences_table.sql
Normal file
9
migrations/20260116092206_create_sequences_table.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
-- Create sequences table
|
||||
CREATE TABLE IF NOT EXISTS sequences (
|
||||
id SERIAL PRIMARY KEY,
|
||||
source SMALLINT NOT NULL,
|
||||
remote_id INTEGER NOT NULL,
|
||||
name VARCHAR(256) NOT NULL,
|
||||
CONSTRAINT uc_sequences_source_remote_id UNIQUE (source, remote_id),
|
||||
CONSTRAINT fk_sequences_sources_id_source FOREIGN KEY (source) REFERENCES sources(id)
|
||||
);
|
||||
Reference in New Issue
Block a user