init import
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2026 Oleg Borodin <onborodin@gmail.com>
|
||||
*/
|
||||
package maindb
|
||||
|
||||
const schema = `
|
||||
--- DROP TABLE IF EXISTS accounts;
|
||||
CREATE TABLE IF NOT EXISTS accounts (
|
||||
id TEXT NOT NULL,
|
||||
username TEXT NOT NULL,
|
||||
passhash TEXT NOT NULL,
|
||||
created_at TEXT NOT NULL,
|
||||
updated_at TEXT NOT NULL,
|
||||
created_by TEXT NOT NULL,
|
||||
updated_by TEXT NOT NULL,
|
||||
disabled BOOL
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS accounts_index01
|
||||
ON accounts(id);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS accounts_index02
|
||||
ON accounts(username);
|
||||
|
||||
--- DROP TABLE IF EXISTS grants;
|
||||
CREATE TABLE IF NOT EXISTS grants (
|
||||
id TEXT NOT NULL,
|
||||
account_id INT NOT NULL,
|
||||
right TEXT NOT NULL,
|
||||
pattern TEXT NOT NULL,
|
||||
created_at TEXT NOT NULL,
|
||||
updated_at TEXT NOT NULL,
|
||||
created_by TEXT NOT NULL,
|
||||
updated_by TEXT NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS grants_index00
|
||||
ON grants(id);
|
||||
CREATE INDEX IF NOT EXISTS grants_index01
|
||||
ON grants(account_id);
|
||||
CREATE INDEX IF NOT EXISTS grants_index02
|
||||
ON grants(account_id, right);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS grants_index03
|
||||
ON grants(account_id, right, pattern);
|
||||
|
||||
`
|
||||
Reference in New Issue
Block a user