Make User ID a uuid, reference user and building in edit log.
This commit is contained in:
parent
9711385963
commit
9ab762e8e7
@ -40,14 +40,12 @@ CREATE INDEX building_geometry_idx ON buildings ( geometry_id );
|
|||||||
-- Minimal user data to support login and edit history
|
-- Minimal user data to support login and edit history
|
||||||
CREATE TABLE users (
|
CREATE TABLE users (
|
||||||
-- internal unique id
|
-- internal unique id
|
||||||
user_id serial PRIMARY KEY,
|
user_id uuid PRIMARY KEY,
|
||||||
-- username for login (required)
|
-- username for login (required)
|
||||||
username varchar UNIQUE NOT NULL,
|
username varchar(30) UNIQUE NOT NULL,
|
||||||
-- email address for password reset (optional)
|
-- email address for password reset (optional)
|
||||||
email varchar(50),
|
email varchar(50),
|
||||||
-- salt - to be generated by application
|
-- password - as generated from hash(salt+password) via pgcrypto
|
||||||
salt varchar (20),
|
|
||||||
-- password - as generated application from hash(salt+password)
|
|
||||||
pass varchar(60)
|
pass varchar(60)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -65,11 +63,14 @@ CREATE TABLE log (
|
|||||||
-- default timestamp to time now
|
-- default timestamp to time now
|
||||||
log_timestamp TIMESTAMP default NOW(),
|
log_timestamp TIMESTAMP default NOW(),
|
||||||
-- log document to be extended in application
|
-- log document to be extended in application
|
||||||
-- log change action (CREATE/UPDATE/DELETE)
|
-- log change diff (CREATE/UPDATE/DELETE)
|
||||||
log_doc jsonb,
|
log_doc jsonb,
|
||||||
-- log user id
|
-- log user id
|
||||||
user_id integer REFERENCES users
|
user_id uuid REFERENCES users,
|
||||||
|
-- log building id
|
||||||
|
building_id integer REFERENCES buildings
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX log_timestamp_idx ON log ( log_timestamp );
|
CREATE INDEX log_timestamp_idx ON log ( log_timestamp );
|
||||||
CREATE INDEX log_user_idx ON log ( user_id );
|
CREATE INDEX log_user_idx ON log ( user_id );
|
||||||
|
CREATE INDEX log_building_idx ON log ( building_id );
|
||||||
|
Loading…
Reference in New Issue
Block a user