working commit

This commit is contained in:
2026-06-09 14:10:53 +02:00
parent ee30858d11
commit 6e92720e69
26 changed files with 339 additions and 165 deletions
-29
View File
@@ -10,34 +10,6 @@ import (
_ "github.com/mattn/go-sqlite3"
)
const schema = `
--- DROP TABLE IF EXISTS account;
CREATE TABLE IF NOT EXISTS account (
id TEXT NOT NULL,
username TEXT NOT NULL,
passhash TEXT NOT NULL,
created_at TEXT NOT NULL,
updated_at TEXT NOT NULL,
disabled BOOL
);
CREATE UNIQUE INDEX IF NOT EXISTS account_index01
ON account(id);
CREATE UNIQUE INDEX IF NOT EXISTS account_index02
ON account(username);
--- DROP TABLE IF EXISTS grant;
CREATE TABLE IF NOT EXISTS grant (
id TEXT NOT NULL,
account_id TEXT NOT NULL,
operation TEXT NOT NULL,
created_at TEXT NOT NULL
);
CREATE INDEX IF NOT EXISTS grant_index01
ON grant(account_id);
CREATE UNIQUE INDEX IF NOT EXISTS grant_index02
ON grant(account_id, operation);
`
type Database struct {
datapath string
db *sqlx.DB
@@ -61,7 +33,6 @@ func (db *Database) OpenDatabase() error {
if err != nil {
return err
}
err = db.db.Ping()
if err != nil {
return err