mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-05 08:55:51 +08:00
Add account management web pages (#694)
Added internal/frontend/account to implement account management code. Added user registration templates and handlers. Set up a sqlite and postgres database in package main.
This commit is contained in:
27
internal/data/migrations/sqlite/initial_tables.sql
Normal file
27
internal/data/migrations/sqlite/initial_tables.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
PRAGMA auto_vacuum = INCREMENTAL;
|
||||
|
||||
-- DROP TABLE IF EXISTS users;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id text PRIMARY KEY,
|
||||
username text NOT NULL DEFAULT '',
|
||||
email text NOT NULL DEFAULT '',
|
||||
password TEXT NOT NULL,
|
||||
salt text NOT NULL,
|
||||
confirmation_hash text,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT chk_username_not_empty CHECK (username != ''),
|
||||
CONSTRAINT chk_email_not_empty CHECK (email != ''),
|
||||
UNIQUE (email),
|
||||
UNIQUE (username)
|
||||
);
|
||||
|
||||
CREATE TRIGGER IF NOT EXISTS tg_users_updated_at
|
||||
AFTER UPDATE ON users
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
UPDATE users SET updated_at = CURRENT_TIMESTAMP
|
||||
WHERE
|
||||
id = old.id;
|
||||
END;
|
||||
Reference in New Issue
Block a user