mirror of
https://github.com/gotson/komga.git
synced 2026-05-08 12:35:30 +02:00
chore: fix SQLite-specific syntax in PostgreSQL migrations
This commit is contained in:
parent
fa2b0e47e5
commit
1b4f8018ae
5 changed files with 20 additions and 27 deletions
|
|
@ -2,7 +2,6 @@
|
|||
CREATE INDEX idx__thumbnail_book__book_id on THUMBNAIL_BOOK (BOOK_ID);
|
||||
|
||||
-- Remove column THUMBNAIL from table MEDIA
|
||||
PRAGMA foreign_keys= OFF;
|
||||
|
||||
ALTER TABLE MEDIA
|
||||
RENAME TO _MEDIA_OLD;
|
||||
|
|
@ -15,7 +14,7 @@ CREATE TABLE MEDIA
|
|||
LAST_MODIFIED_DATE timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
COMMENT varchar NULL,
|
||||
BOOK_ID varchar NOT NULL PRIMARY KEY,
|
||||
PAGE_COUNT int NOT NULL DEFAULT false,
|
||||
PAGE_COUNT integer NOT NULL DEFAULT 0,
|
||||
FOREIGN KEY (BOOK_ID) REFERENCES BOOK (ID)
|
||||
);
|
||||
|
||||
|
|
@ -25,4 +24,3 @@ FROM _MEDIA_OLD;
|
|||
|
||||
DROP TABLE _MEDIA_OLD;
|
||||
|
||||
PRAGMA foreign_keys= ON;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
PRAGMA foreign_keys= OFF;
|
||||
|
||||
ALTER TABLE BOOK_METADATA
|
||||
RENAME TO _BOOK_METADATA_OLD;
|
||||
|
|
@ -44,4 +43,3 @@ FROM _BOOK_METADATA_OLD;
|
|||
|
||||
DROP TABLE _BOOK_METADATA_OLD;
|
||||
|
||||
PRAGMA foreign_keys= ON;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ VALUES ('DELETE_EMPTY_COLLECTIONS', ${delete-empty-collections});
|
|||
INSERT INTO SERVER_SETTINGS
|
||||
VALUES ('DELETE_EMPTY_READLISTS', ${delete-empty-read-lists});
|
||||
INSERT INTO SERVER_SETTINGS
|
||||
VALUES ('REMEMBER_ME_KEY', hex(randomblob(32)));
|
||||
VALUES ('REMEMBER_ME_KEY', md5(random()::text));
|
||||
INSERT INTO SERVER_SETTINGS
|
||||
VALUES ('REMEMBER_ME_DURATION', 365);
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ alter table "USER"
|
|||
add column ROLE_KOBO_SYNC boolean NOT NULL DEFAULT false;
|
||||
|
||||
update "USER"
|
||||
set ROLE_KOBO_SYNC = 1
|
||||
where ROLE_ADMIN = 1;
|
||||
set ROLE_KOBO_SYNC = true
|
||||
where ROLE_ADMIN = true;
|
||||
|
|
|
|||
|
|
@ -7,32 +7,31 @@ CREATE TABLE USER_ROLE
|
|||
);
|
||||
|
||||
insert into USER_ROLE
|
||||
select id, "ADMIN"
|
||||
from user
|
||||
where ROLE_ADMIN = 1;
|
||||
select id, 'ADMIN'
|
||||
from "USER"
|
||||
where ROLE_ADMIN = true;
|
||||
|
||||
insert into USER_ROLE
|
||||
select id, "KOREADER_SYNC"
|
||||
from user
|
||||
where ROLE_ADMIN = 1;
|
||||
select id, 'KOREADER_SYNC'
|
||||
from "USER"
|
||||
where ROLE_ADMIN = true;
|
||||
|
||||
insert into USER_ROLE
|
||||
select id, "FILE_DOWNLOAD"
|
||||
from user
|
||||
where ROLE_FILE_DOWNLOAD = 1;
|
||||
select id, 'FILE_DOWNLOAD'
|
||||
from "USER"
|
||||
where ROLE_FILE_DOWNLOAD = true;
|
||||
|
||||
insert into USER_ROLE
|
||||
select id, "PAGE_STREAMING"
|
||||
from user
|
||||
where ROLE_PAGE_STREAMING = 1;
|
||||
select id, 'PAGE_STREAMING'
|
||||
from "USER"
|
||||
where ROLE_PAGE_STREAMING = true;
|
||||
|
||||
insert into USER_ROLE
|
||||
select id, "KOBO_SYNC"
|
||||
from user
|
||||
where ROLE_KOBO_SYNC = 1;
|
||||
select id, 'KOBO_SYNC'
|
||||
from "USER"
|
||||
where ROLE_KOBO_SYNC = true;
|
||||
|
||||
-- Remove columns ROLE_ADMIN, ROLE_FILE_DOWNLOAD, ROLE_PAGE_STREAMING, ROLE_KOBO_SYNC from "USER"
|
||||
PRAGMA foreign_keys= OFF;
|
||||
|
||||
create table USER_dg_tmp
|
||||
(
|
||||
|
|
@ -60,9 +59,7 @@ select ID,
|
|||
AGE_RESTRICTION_ALLOW_ONLY
|
||||
from "USER";
|
||||
|
||||
drop table "USER";
|
||||
drop table "USER" CASCADE;
|
||||
|
||||
alter table USER_dg_tmp
|
||||
rename to "USER";
|
||||
|
||||
PRAGMA foreign_keys= ON;
|
||||
|
|
|
|||
Loading…
Reference in a new issue