mirror of
https://github.com/mihonapp/mihon.git
synced 2025-07-15 12:13:18 +02:00
Move default category into database (#7676)
This commit is contained in:
@ -5,6 +5,17 @@ CREATE TABLE categories(
|
||||
flags INTEGER NOT NULL
|
||||
);
|
||||
|
||||
-- Insert system category
|
||||
INSERT OR IGNORE INTO categories(_id, name, sort, flags) VALUES (0, "", -1, 0);
|
||||
-- Disallow deletion of default category
|
||||
CREATE TRIGGER IF NOT EXISTS system_category_delete_trigger BEFORE DELETE
|
||||
ON categories
|
||||
BEGIN SELECT CASE
|
||||
WHEN old._id <= 0 THEN
|
||||
RAISE(ABORT, "System category can't be deleted")
|
||||
END;
|
||||
END;
|
||||
|
||||
getCategories:
|
||||
SELECT
|
||||
_id AS id,
|
||||
@ -40,5 +51,9 @@ SET name = coalesce(:name, name),
|
||||
flags = coalesce(:flags, flags)
|
||||
WHERE _id = :categoryId;
|
||||
|
||||
updateAllFlags:
|
||||
UPDATE categories SET
|
||||
flags = coalesce(?, flags);
|
||||
|
||||
selectLastInsertedRowId:
|
||||
SELECT last_insert_rowid();
|
Reference in New Issue
Block a user