mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2026-03-03 15:10:51 +01:00
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
12 lines
408 B
SQL
12 lines
408 B
SQL
-- Create genres table
|
|
CREATE TABLE IF NOT EXISTS genres (
|
|
id SERIAL PRIMARY KEY,
|
|
source SMALLINT NOT NULL,
|
|
remote_id INTEGER NOT NULL,
|
|
code VARCHAR(45) NOT NULL,
|
|
description VARCHAR(99) NOT NULL,
|
|
meta VARCHAR(45) NOT NULL,
|
|
CONSTRAINT uc_genres_source_remote_id UNIQUE (source, remote_id),
|
|
CONSTRAINT fk_genres_sources_id_source FOREIGN KEY (source) REFERENCES sources(id)
|
|
);
|