Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created clients.sql #18

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions server/db/schema/clients.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
DROP TABLE IF EXISTS clients;

CREATE TYPE ethnicity AS ENUM ('Non-Hispanic', 'Hispanic', 'Refused');
CREATE TYPE race AS ENUM('Caucasian', 'Hispanic', 'African American', 'Asian', 'Pacific Islander/Hawaiian', 'Native American', 'Multi/Other');
CREATE TYPE client_status AS ENUM('Active', 'Exited');

CREATE TABLE clients (
id SERIAL NOT NULL PRIMARY KEY,
created_by INT NOT NULL,
unit_id INT NOT NULL,
"grant" VARCHAR(256) NOT NULL,
"status" client_status NOT NULL,
first_name VARCHAR(16) NOT NULL,
last_name VARCHAR(16) NOT NULL,
date_of_birth DATE NOT NULL,
age INT NOT NULL,
phone_number VARCHAR(10) NOT NULL,
email VARCHAR(32) NOT NULL,
emergency_contact_name VARCHAR(32) NOT NULL,
emergency_contact_phone_number VARCHAR(10) NOT NULL,
medical BOOLEAN NOT NULL,
entrance_date DATE NOT NULL,
estimated_exit_date DATE NOT NULL,
exit_date DATE,
bed_nights INT NOT NULL,
bed_nights_children INT NOT NULL,
pregnant_upon_entry BOOLEAN NOT NULL,
disabled_children BOOLEAN NOT NULL,
ethnicity ethnicity NOT NULL,
race race NOT NULL,
city_of_last_permanent_residence VARCHAR(256) NOT NULL,
prior_living VARCHAR(256) NOT NULL,
prior_living_city VARCHAR(256) NOT NULL,
shelter_in_last_five_years BOOLEAN NOT NULL,
homelessness_length INT NOT NULL,
chronically_homeless BOOLEAN NOT NULL,
attending_school_upon_entry BOOLEAN NOT NULL,
employement_gained BOOLEAN NOT NULL,
reason_for_leaving VARCHAR(1024),
specific_reason_for_leaving VARCHAR(1024),
specific_destination VARCHAR(64),
savings_amount NUMERIC(10, 2),
attending_school_upon_exit BOOLEAN,
reunified BOOLEAN,
successful_completion BOOLEAN,
destination_city VARCHAR(32),
FOREIGN KEY (created_by) REFERENCES case_managers(id),
FOREIGN KEY (unit_id) REFERENCES units(id)
);
Loading