[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Plan for refactoring user information
- Subject: Plan for refactoring user information
- From: "Chris Travers" <..hidden..>
- Date: Mon, 5 Mar 2007 23:08:27 -0800
I am looking at reactoring user information in 1.3. Here is my basic proposal:
1) Users are connected to three other tables: employee (for HR
information), preferences (for their own preferences), and locations
(for business location).
The basic user table looks like:
create table db_users (
id serial primary key,
username text unique not null,
active bool default true not null,
employee_id int references employee (id),
location_id int references location (id)
On login, the application checks db_users (not users so we avoid
conflicts with setups with Pg-central in the main db) to see that the
user exists and is active. If not, it aborts.
The employee table remains unchanged for now.
The preferneces table looks like:
create table preferences(
id integer primary key references db_users(id)
deferrable initially deferred,
Compared to users_conf in 1.2, it is designed to store only
The location table stores information on business locations.
Employees are connected locations for purposes like addresses:
CREATE OR REPLACE TABLE locations (
id SERIAL PRIMARY KEY,
This would clearly separate user-modifiable data from non-modifiable
data, and would help to normalize the structure to a large extent.