Skip to content

Instantly share code, notes, and snippets.

@ekumachidi
Last active December 2, 2015 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ekumachidi/deb643cdf8567c0fc969 to your computer and use it in GitHub Desktop.
Save ekumachidi/deb643cdf8567c0fc969 to your computer and use it in GitHub Desktop.
CREATE TABLE Roles (
id SERIAL PRIMARY KEY,
name TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP
);
CREATE TABLE users
(
id serial NOT NULL,
email character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
encrypted_password character varying NOT NULL DEFAULT ''::character varying,
reset_password_token character varying,
reset_password_sent_at timestamp without time zone,
remember_created_at timestamp without time zone,
sign_in_count integer NOT NULL DEFAULT 0,
current_sign_in_at timestamp without time zone,
last_sign_in_at timestamp without time zone,
current_sign_in_ip inet,
last_sign_in_ip inet,
token character varying,
website_domain character varying,
Role_Id
CONSTRAINT users_pkey PRIMARY KEY (id)
)
CREATE TABLE Profiles (
id SERIAL PRIMARY KEY,
User_Id INT references Users(id),
name TEXT,
addres TEXT,
phone TEXT,
latitude DECIMAL,
longitude DECIMAL,
created_at TIMESTAMP,
updated_at TIMESTAMP
/* CONSTRAINT Profiles_pkey PRIMARY KEY (id),
CONSTRAINT fk_UsersId FOREIGN KEY (user_id)
REFERENCES users (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION */
);
CREATE TABLE Couriers (
id SERIAL PRIMARY KEY,
User_Id INT references Users(id),
created_at TIMESTAMP,
updated_at TIMESTAMP
);
CREATE TABLE Packages (
id SERIAL PRIMARY KEY,
User_Id INT references Users(id),
tracking_code TEXT,
weight INT,
vendor TEXT,
location TEXT,
destination TEXT,
recipient TEXT,
r_contact TEXT,
status BOOLEAN,
dispatch BOOLEAN,
latitude DECIMAL,
longitude DECIMAL,
created_at TIMESTAMP,
updated_at TIMESTAMP
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment