refactor: update db migrator

This commit is contained in:
Steven
2024-08-29 08:21:23 +08:00
parent 784d91ab75
commit 85f5f03be9
19 changed files with 307 additions and 412 deletions

View File

@@ -0,0 +1 @@
DROP TABLE IF EXISTS idp;

View File

@@ -0,0 +1,14 @@
-- collection
CREATE TABLE collection (
id INTEGER PRIMARY KEY AUTOINCREMENT,
creator_id INTEGER NOT NULL,
created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
name TEXT NOT NULL UNIQUE,
title TEXT NOT NULL DEFAULT '',
description TEXT NOT NULL DEFAULT '',
shortcut_ids INTEGER[] NOT NULL,
visibility TEXT NOT NULL CHECK (visibility IN ('PRIVATE', 'WORKSPACE', 'PUBLIC')) DEFAULT 'PRIVATE'
);
CREATE INDEX idx_collection_name ON collection(name);