Files
Олег Бородин 25365aef77 init import
2026-05-24 11:02:51 +02:00

44 lines
1.2 KiB
Go

/*
* 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);
`