Jan Dittberner
5efc57d2c3
- add audit logging for user changes - refactor model errors into functions - implement user delete form and submit handlers
18 lines
No EOL
875 B
SQL
18 lines
No EOL
875 B
SQL
-- add an audit table to track changes to users
|
|
CREATE TABLE audit
|
|
(
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
-- copied authenticated user name to keep the information when the admin is locked/deleted later
|
|
user_name VARCHAR(255) NOT NULL,
|
|
-- copied authenticated user email address to keep the information when the admin is locked/deleted later
|
|
user_address VARCHAR(255) NOT NULL,
|
|
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
-- an enum (in code) value to specify the action. Stored as text to be flexible for future changes
|
|
change TEXT NOT NULL,
|
|
-- reasoning for the change specified by the user
|
|
reasoning TEXT NOT NULL,
|
|
-- additional information about the change in an application specific json format
|
|
details TEXT
|
|
);
|
|
|
|
CREATE INDEX audit_change_idx ON audit (change); |