Complete global vs individual settings
This commit is contained in:
+1
-15
@@ -1,4 +1,3 @@
|
||||
-- Create the library table
|
||||
CREATE TABLE IF NOT EXISTS library
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
@@ -7,7 +6,6 @@ CREATE TABLE IF NOT EXISTS library
|
||||
icon VARCHAR(64) NOT NULL
|
||||
);
|
||||
|
||||
-- Create the library_path table
|
||||
CREATE TABLE IF NOT EXISTS library_path
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
@@ -16,7 +14,6 @@ CREATE TABLE IF NOT EXISTS library_path
|
||||
CONSTRAINT fk_library_path FOREIGN KEY (library_id) REFERENCES library (id)
|
||||
);
|
||||
|
||||
-- Create the book table
|
||||
CREATE TABLE IF NOT EXISTS book
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
@@ -33,11 +30,9 @@ CREATE TABLE IF NOT EXISTS book
|
||||
CONSTRAINT unique_file_library UNIQUE (file_name, library_id)
|
||||
);
|
||||
|
||||
-- Create indexes for the book table
|
||||
CREATE INDEX IF NOT EXISTS idx_library_id ON book (library_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_last_read_time ON book (last_read_time);
|
||||
|
||||
-- Create the book_metadata table
|
||||
CREATE TABLE IF NOT EXISTS book_metadata
|
||||
(
|
||||
book_id BIGINT NOT NULL PRIMARY KEY,
|
||||
@@ -56,7 +51,6 @@ CREATE TABLE IF NOT EXISTS book_metadata
|
||||
CONSTRAINT fk_book_metadata FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Create the author table
|
||||
CREATE TABLE IF NOT EXISTS author
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
@@ -64,14 +58,12 @@ CREATE TABLE IF NOT EXISTS author
|
||||
CONSTRAINT unique_name UNIQUE (name)
|
||||
);
|
||||
|
||||
-- Create the category table
|
||||
CREATE TABLE IF NOT EXISTS category
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
-- Create the book_viewer_setting table
|
||||
CREATE TABLE IF NOT EXISTS pdf_viewer_preference
|
||||
(
|
||||
book_id BIGINT PRIMARY KEY,
|
||||
@@ -86,11 +78,10 @@ CREATE TABLE IF NOT EXISTS epub_viewer_preference
|
||||
book_id BIGINT PRIMARY KEY,
|
||||
theme VARCHAR(128) NULL,
|
||||
font VARCHAR(128) NULL,
|
||||
font_size TINYINT NULL,
|
||||
font_size INT NULL,
|
||||
CONSTRAINT fk_epub_viewer_setting FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Create the book_metadata_category_mapping table
|
||||
CREATE TABLE IF NOT EXISTS book_metadata_category_mapping
|
||||
(
|
||||
book_id BIGINT NOT NULL,
|
||||
@@ -100,7 +91,6 @@ CREATE TABLE IF NOT EXISTS book_metadata_category_mapping
|
||||
CONSTRAINT fk_book_metadata_category_mapping_category FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Create the book_metadata_author_mapping table
|
||||
CREATE TABLE IF NOT EXISTS book_metadata_author_mapping
|
||||
(
|
||||
book_id BIGINT NOT NULL,
|
||||
@@ -110,11 +100,9 @@ CREATE TABLE IF NOT EXISTS book_metadata_author_mapping
|
||||
CONSTRAINT fk_book_metadata_author_mapping_author FOREIGN KEY (author_id) REFERENCES author (id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Create indexes for the book_metadata_author_mapping table
|
||||
CREATE INDEX IF NOT EXISTS idx_book_metadata_id ON book_metadata_author_mapping (book_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_author_id ON book_metadata_author_mapping (author_id);
|
||||
|
||||
-- Create the shelf table
|
||||
CREATE TABLE IF NOT EXISTS shelf
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
@@ -123,7 +111,6 @@ CREATE TABLE IF NOT EXISTS shelf
|
||||
icon VARCHAR(64) NOT NULL
|
||||
);
|
||||
|
||||
-- Create the book_shelf_mapping table
|
||||
CREATE TABLE IF NOT EXISTS book_shelf_mapping
|
||||
(
|
||||
book_id BIGINT NOT NULL,
|
||||
@@ -133,7 +120,6 @@ CREATE TABLE IF NOT EXISTS book_shelf_mapping
|
||||
CONSTRAINT fk_book_shelf_mapping_shelf FOREIGN KEY (shelf_id) REFERENCES shelf (id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Create the app_settings table
|
||||
CREATE TABLE app_settings
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
|
||||
@@ -9,4 +9,8 @@ VALUES ('epub', 'theme', 'white'),
|
||||
INSERT INTO app_settings (category, name, val)
|
||||
VALUES ('pdf', 'spread', 'odd'),
|
||||
('pdf', 'zoom', 'page-fit'),
|
||||
('pdf', 'sidebar', 'true');
|
||||
('pdf', 'sidebar', 'true');
|
||||
|
||||
INSERT INTO app_settings (category, name, val)
|
||||
VALUES ('reader_setting', 'pdf', 'individual'),
|
||||
('reader_setting', 'epub', 'individual');
|
||||
Reference in New Issue
Block a user