We make regular updates to the data available in Business Intelligence Connector. You can stay up to date by following our release notes. You can review previous schema updates.

Bookmark or share this article with your business intelligence team. It contains the current schema.

Current schema

The Business Intelligence Connector schema was last updated on April 12, 2024. Download the latest schema (.sql).

Check out our current schema in plaintext below:

COMMENT ON SCHEMA IS 'standard public schema';
CREATE TABLE agency_question_custom_fields (
application_id bigint,
custom_field character varying,
boolean_value boolean,
float_value double precision,
date_value timestamp without time zone,
display_value character varying,
unit character varying,
min_value numeric,
max_value numeric,
user_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
key character varying,
text_value character varying,
organization_id bigint
);
CREATE TABLE application_custom_fields (
application_id bigint,
custom_field character varying,
float_value double precision,
date_value date,
display_value character varying,
unit character varying,
min_value numeric,
max_value numeric,
user_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
key character varying(1024),
text_value character varying(16384),
organization_id bigint
);
CREATE TABLE application_question_answers (
job_post_id bigint,
application_id bigint,
question character varying(65535),
answer character varying(65535),
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE application_stages (
application_id bigint,
stage_id bigint,
entered_on timestamp without time zone,
exited_on timestamp without time zone,
stage_name character varying,
organization_id bigint
);
CREATE TABLE applications (
id bigint NOT NULL,
candidate_id bigint,
applied_at timestamp without time zone,
status character varying,
prospect boolean,
stage_id bigint,
source_id bigint,
referrer_id bigint,
rejected_at timestamp without time zone,
rejected_by_id bigint,
rejection_reason_id bigint,
pipeline_percent double precision,
migrated boolean,
rejected_by character varying,
stage_name character varying,
job_post_id bigint,
prospect_pool character varying(65535),
prospect_pool_stage character varying(65535),
prospect_owner_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
event_id bigint,
converted_prospect_application_id bigint,
sent_demographic_questions boolean,
organization_id bigint
);
CREATE TABLE applications_jobs (
application_id bigint,
job_id bigint,
organization_id bigint
);
CREATE TABLE approvals (
offer_id bigint,
application_id bigint,
job_id bigint,
job_name character varying(1024),
candidate_id bigint,
candidate_name character varying(1024),
approver_id bigint,
approver_name character varying(1024),
approval_type character varying(32),
status character varying(32),
version integer,
version_final integer,
group_id bigint,
group_order integer,
group_quorum integer,
assigned_at timestamp without time zone,
completed_at timestamp without time zone,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE attributes (
id bigint NOT NULL,
organization_id bigint,
name character varying(1024),
category character varying,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
CREATE TABLE audit_log (
organization_id bigint,
event_time timestamp without time zone,
request_id character varying(255),
request_type character varying(255),
performer_id character varying(255),
performer_type character varying(255),
performer_meta character varying,
performer_ip_address character varying(255),
event_type character varying(255),
event_target_id bigint,
event_target_type character varying(255),
event_meta character varying
);
CREATE TABLE candidate_custom_fields (
candidate_id bigint,
custom_field character varying,
float_value double precision,
date_value date,
display_value character varying(1024),
unit character varying,
min_value numeric,
max_value numeric,
user_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
key character varying(1024),
text_value character varying(16384),
organization_id bigint
);
CREATE TABLE candidate_email_addresses (
candidate_id bigint,
value character varying(255),
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE candidate_mailing_addresses (
candidate_id bigint,
value character varying(65535),
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE candidate_phone_numbers (
candidate_id bigint,
value character varying(255),
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE candidate_survey_questions (
id bigint NOT NULL,
question character varying,
organization_id bigint
);
CREATE TABLE candidate_surveys (
id bigint,
organization_id bigint,
submitted_at timestamp without time zone,
department_id bigint,
department_name character varying,
office_id bigint,
office_name character varying,
question_1 character varying,
question_2 character varying,
question_3 character varying,
question_4 character varying,
question_5 character varying,
question_6 character varying,
question_7 character varying,
question_8 character varying,
question_9 character varying(16384)
);
CREATE TABLE candidates (
id bigint NOT NULL,
first_name character varying,
last_name character varying,
recruiter_id bigint,
coordinator_id bigint,
migrated boolean,
recruiter character varying,
coordinator character varying,
company character varying(1024),
title character varying(1024),
created_at timestamp without time zone,
updated_at timestamp without time zone,
private boolean,
organization_id bigint
);
CREATE TABLE candidates_tags (
id bigint NOT NULL,
tag_id bigint,
candidate_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE demographic_answer_option_translations (
id bigint NOT NULL,
demographic_answer_option_id bigint NOT NULL,
language character varying NOT NULL,
name character varying NOT NULL,
organization_id bigint
);
CREATE TABLE demographic_answer_options (
id bigint NOT NULL,
demographic_question_id bigint NOT NULL,
active boolean NOT NULL,
free_form boolean NOT NULL,
name character varying,
organization_id bigint
);
CREATE TABLE demographic_answers (
id bigint NOT NULL,
application_id bigint NOT NULL,
demographic_question_id bigint NOT NULL,
demographic_answer_option_id bigint,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
organization_id bigint
);
CREATE TABLE demographic_free_form_answers (
id bigint NOT NULL,
demographic_answer_id bigint NOT NULL,
text character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
organization_id bigint
);
CREATE TABLE demographic_question_sets (
id bigint NOT NULL,
organization_id bigint NOT NULL,
title character varying NOT NULL,
description character varying,
active boolean NOT NULL
);
CREATE TABLE demographic_question_translations (
id bigint NOT NULL,
demographic_question_id bigint NOT NULL,
language character varying NOT NULL,
name character varying NOT NULL,
organization_id bigint
);
CREATE TABLE demographic_questions (
id bigint NOT NULL,
organization_id bigint NOT NULL,
active boolean NOT NULL,
demographic_question_set_id bigint,
name character varying,
required boolean,
answer_type character varying
);
CREATE TABLE departments (
id bigint NOT NULL,
organization_id bigint,
name character varying(1024),
parent_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
CREATE TABLE educations (
candidate_id bigint,
school_name character varying,
degree character varying,
discipline character varying,
start date,
"end" date,
latest boolean,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE eeoc_responses (
application_id bigint,
status character varying,
race character varying,
gender character varying,
disability_status character varying,
veteran_status character varying,
submitted_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE employments (
candidate_id bigint,
company_name character varying,
title character varying,
start date,
"end" date,
latest boolean,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE events (
id bigint NOT NULL,
name character varying(65535),
organization_id bigint
);
CREATE TABLE gdpr_consent_decisions (
candidate_id bigint NOT NULL,
decision character varying NOT NULL,
decided_at timestamp without time zone NOT NULL,
organization_id bigint
);
CREATE TABLE gdpr_consent_requests (
candidate_id bigint NOT NULL,
status character varying NOT NULL,
token character varying NOT NULL,
requested_at timestamp without time zone NOT NULL,
organization_id bigint
);
CREATE TABLE gdpr_office_rules (
office_id bigint NOT NULL,
retention_period bigint NOT NULL,
organization_id bigint
);
CREATE TABLE gho_assigned_tasks (
id bigint NOT NULL,
task_name character varying NOT NULL,
task_description character varying,
task_category character varying(255) NOT NULL,
assigned_for_id integer NOT NULL,
assigned_by_id integer,
completed_at timestamp without time zone,
due_date_relative_days integer,
assign_days_before integer NOT NULL,
calculated_due_date date,
calculated_assign_date date,
attachment_required boolean NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
assigned_employee_id bigint,
third_party_system_email character varying,
assigned_custom_field_id integer,
assigned_coworker_employee_id integer,
completed_by_employee_id integer,
completed_by_third_party_system_email character varying,
assignee_updated_at timestamp without time zone,
assigned_at timestamp without time zone,
company_id bigint
);
CREATE TABLE gho_custom_field_values (
id bigint NOT NULL,
employee_id bigint NOT NULL,
custom_field_id bigint NOT NULL,
custom_field_permanent_field_id character varying(255),
custom_field_field_type character varying(255),
value character varying,
value_employee_id integer,
value_date date,
value_updated_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
company_id bigint
);
CREATE TABLE gho_custom_fields (
id bigint NOT NULL,
permanent_field_id character varying(255),
name character varying(255),
field_type character varying(255),
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
company_id bigint
);
CREATE TABLE gho_employee_roles (
role_id bigint,
employee_id bigint NOT NULL,
company_id bigint
);
CREATE TABLE gho_employees (
id bigint NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
personal_email character varying,
work_email character varying,
start_date date,
termination_date date,
employment_status character varying,
manager_id bigint,
hr_manager_id bigint,
title character varying,
global_role character varying,
n_direct_reports bigint,
department character varying,
location character varying,
legal_name_first_name character varying,
legal_name_middle_name character varying,
legal_name_last_name character varying,
legal_name_suffix character varying,
preferred_first_name character varying,
preferred_last_name character varying,
company_id bigint
);
CREATE TABLE gho_roles (
id bigint NOT NULL,
name character varying(255) NOT NULL,
company_id bigint
);
CREATE TABLE gho_user_activities (
employee_id bigint NOT NULL,
hourly_last_sign_in_at timestamp without time zone,
company_id bigint
);
CREATE TABLE greenhouse_usages (
user_id bigint,
date date,
organization_id bigint
);
CREATE TABLE hiring_team (
job_id bigint,
user_id bigint,
role character varying,
responsible boolean,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE interviewer_tags (
user_id bigint,
tag character varying,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE interviewers (
interview_id bigint,
user_id bigint,
scorecard_id bigint,
"user" character varying,
organization_id bigint
);
CREATE TABLE interviews (
id bigint NOT NULL,
organization_id bigint,
name character varying(1024),
created_at timestamp without time zone,
updated_at timestamp without time zone
);
CREATE TABLE job_custom_fields (
job_id bigint,
custom_field character varying,
float_value double precision,
date_value date,
display_value character varying(1024),
unit character varying,
min_value numeric,
max_value numeric,
user_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
key character varying(1024),
text_value character varying(16384),
organization_id bigint
);
CREATE TABLE job_post_questions (
job_post_id bigint,
question character varying(65535),
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE job_posts (
id bigint NOT NULL,
job_id bigint,
title character varying,
live boolean,
job_board_name character varying,
language character varying,
location character varying,
created_at timestamp without time zone,
updated_at timestamp without time zone,
eeoc_enabled boolean,
indeed_feed boolean,
linked_in_feed boolean,
glassdoor_feed boolean,
first_published timestamp without time zone,
organization_id bigint
);
CREATE TABLE job_snapshots (
job_id bigint,
date date,
hired_count integer,
prospect_count integer,
new_today integer,
rejected_today integer,
advanced_today integer,
interviews_today integer,
organization_id bigint
);
CREATE TABLE jobs (
id bigint NOT NULL,
organization_id bigint,
name character varying(1024),
requisition_id character varying,
status character varying,
opened_at timestamp without time zone,
closed_at timestamp without time zone,
department_id bigint,
level character varying,
confidential boolean,
created_at timestamp without time zone,
notes character varying(65535),
updated_at timestamp without time zone
);
CREATE TABLE jobs_attributes (
id bigint NOT NULL,
job_id bigint,
attribute_id bigint,
active boolean,
created_at timestamp without time zone,
updated_at timestamp without time zone,
name character varying,
category character varying,
organization_id bigint
);
CREATE TABLE jobs_departments (
id bigint NOT NULL,
job_id bigint,
department_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE jobs_interviews (
id bigint NOT NULL,
job_id bigint,
stage_id bigint,
interview_id bigint,
"order" integer,
estimated_duration integer,
created_at timestamp without time zone,
updated_at timestamp without time zone,
interview_name character varying,
stage_name character varying,
organization_id bigint
);
CREATE TABLE jobs_offices (
id bigint NOT NULL,
job_id bigint,
office_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE jobs_stages (
job_id bigint,
stage_id bigint,
"order" integer,
name character varying,
stage_alert_setting integer,
created_at timestamp without time zone,
updated_at timestamp without time zone,
milestones character varying(1024),
organization_id bigint
);
CREATE TABLE offer_custom_fields (
offer_id bigint,
custom_field character varying,
float_value double precision,
date_value date,
display_value character varying(1024),
unit character varying,
min_value numeric,
max_value numeric,
user_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
key character varying(1024),
text_value character varying(16384),
organization_id bigint
);
CREATE TABLE offers (
id bigint NOT NULL,
application_id bigint,
status character varying,
created_at timestamp without time zone,
sent_at date,
resolved_at timestamp without time zone,
start_date timestamp without time zone,
created_by character varying,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE offices (
id bigint NOT NULL,
organization_id bigint,
name character varying(1024),
parent_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
CREATE TABLE opening_custom_fields (
opening_id bigint NOT NULL,
custom_field character varying,
float_value double precision,
date_value date,
display_value character varying,
unit character varying,
min_value numeric,
max_value numeric,
user_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
key character varying,
text_value character varying,
organization_id bigint
);
CREATE TABLE openings (
id bigint NOT NULL,
job_id bigint,
opening_id character varying,
opened_at timestamp without time zone,
closed_at timestamp without time zone,
hired_application_id bigint,
close_reason character varying(255),
created_at timestamp without time zone,
updated_at timestamp without time zone,
target_start_date date,
organization_id bigint
);
CREATE TABLE organizations (
id bigint NOT NULL,
name character varying(1024)
);
CREATE TABLE prospect_pool_stages (
id bigint NOT NULL,
prospect_pool_id bigint NOT NULL,
name character varying NOT NULL,
priority integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
organization_id bigint
);
CREATE TABLE prospect_pool_transitions (
application_id bigint,
user_id bigint,
old_prospect_pool_id bigint,
old_prospect_stage_id bigint,
new_prospect_pool_id bigint,
new_prospect_stage_id bigint,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
organization_id bigint
);
CREATE TABLE prospect_pools (
id bigint NOT NULL,
name character varying NOT NULL,
active boolean NOT NULL,
description character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
organization_id bigint
);
CREATE TABLE referral_question_custom_fields (
candidate_id bigint,
custom_field character varying,
float_value double precision,
date_value date,
display_value character varying(1024),
unit character varying,
min_value numeric,
max_value numeric,
user_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
key character varying(1024),
text_value character varying(16384),
organization_id bigint
);
CREATE TABLE referrers (
id bigint NOT NULL,
organization_id bigint,
name character varying(1024),
user_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
CREATE TABLE rejection_question_custom_fields (
application_id bigint,
custom_field character varying,
float_value double precision,
date_value date,
display_value character varying,
unit character varying,
min_value numeric,
max_value numeric,
user_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
key character varying(1024),
text_value character varying(16384),
organization_id bigint
);
CREATE TABLE rejection_reasons (
id bigint NOT NULL,
organization_id bigint,
name character varying(1024),
type character varying,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
CREATE TABLE scheduled_interviews (
id bigint NOT NULL,
application_id bigint,
interview_id bigint,
status character varying,
scheduled_by_id bigint,
scheduled_at timestamp without time zone,
starts_at timestamp without time zone,
ends_at timestamp without time zone,
all_day_start_date date,
all_day_end_date date,
stage_name character varying(1024),
interview_name character varying(1024),
organization_id bigint
);
CREATE TABLE scorecard_question_answers (
scorecard_id bigint,
application_id bigint,
question character varying(65535),
answer character varying(65535),
created_at timestamp without time zone,
updated_at timestamp without time zone,
scorecard_question_id bigint,
organization_id bigint
);
CREATE TABLE scorecard_questions (
id bigint NOT NULL,
interview_kit_id bigint,
question character varying NOT NULL,
answer_type character varying NOT NULL,
active boolean NOT NULL,
priority integer,
required boolean,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
focus_attributes character varying,
organization_id bigint
);
CREATE TABLE scorecards (
id bigint NOT NULL,
application_id bigint,
stage_id bigint,
interview_id bigint,
interviewer_id bigint,
submitter_id bigint,
overall_recommendation character varying,
submitted_at timestamp without time zone,
scheduled_interview_ended_at timestamp without time zone,
total_focus_attributes integer,
completed_focus_attributes integer,
interviewer character varying,
submitter character varying,
stage_name character varying,
created_at timestamp without time zone,
updated_at timestamp without time zone,
interview_name character varying(4096),
organization_id bigint
);
CREATE TABLE scorecards_attributes (
scorecard_id bigint,
attribute_id bigint,
rating character varying,
notes character varying(65535),
created_at timestamp without time zone,
updated_at timestamp without time zone,
attribute_name character varying,
attribute_category character varying,
organization_id bigint
);
CREATE TABLE sources (
id bigint NOT NULL,
organization_id bigint,
name character varying(1024),
type character varying,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
CREATE TABLE stage_snapshots (
stage_id bigint,
date date,
active_count integer,
job_id bigint,
stage_name character varying,
organization_id bigint
);
CREATE TABLE stages (
id bigint NOT NULL,
organization_id bigint,
name character varying(1024),
"order" integer,
active boolean,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
CREATE TABLE survey_builder_answers (
id bigint NOT NULL,
survey_id bigint,
question_id bigint,
submitted_at timestamp without time zone,
value character varying,
comment character varying,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE survey_builder_questions (
id bigint NOT NULL,
answer_type character varying,
survey_id bigint,
priority integer,
value character varying,
active boolean,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE survey_builder_surveys (
id bigint NOT NULL,
key character varying,
active boolean,
activated_at timestamp without time zone,
all_departments boolean,
all_offices boolean,
stage_names character varying,
delay_days integer,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE survey_builder_surveys_departments (
id bigint NOT NULL,
survey_id bigint,
department_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE survey_builder_surveys_offices (
id bigint NOT NULL,
survey_id bigint,
office_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE tags (
id bigint NOT NULL,
organization_id bigint,
name character varying(1024),
created_at timestamp without time zone,
updated_at timestamp without time zone
);
CREATE TABLE user_actions (
id bigint NOT NULL,
job_id bigint,
user_id bigint,
type character varying,
organization_id bigint
);
CREATE TABLE user_attribute_custom_fields (
user_id bigint,
custom_field character varying,
float_value double precision,
date_value date,
display_value character varying(1024),
unit character varying,
min_value numeric,
max_value numeric,
user_id_value bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
key character varying(1024),
text_value character varying(16384),
organization_id bigint
);
CREATE TABLE user_candidate_links (
user_id bigint,
candidate_id bigint,
created_at timestamp without time zone,
updated_at timestamp without time zone,
organization_id bigint
);
CREATE TABLE users (
id bigint NOT NULL,
organization_id bigint,
first_name character varying,
last_name character varying,
email character varying,
status character varying,
full_name character varying,
employee_id character varying,
created_at timestamp without time zone,
updated_at timestamp without time zone
);
ALTER TABLE ONLY applications
ADD CONSTRAINT applications_pkey PRIMARY KEY (id);
ALTER TABLE ONLY attributes
ADD CONSTRAINT attributes_pkey PRIMARY KEY (id);
ALTER TABLE ONLY candidate_survey_questions
ADD CONSTRAINT candidate_survey_questions_pkey PRIMARY KEY (id);
ALTER TABLE ONLY candidates
ADD CONSTRAINT candidates_pkey PRIMARY KEY (id);
ALTER TABLE ONLY candidates_tags
ADD CONSTRAINT candidates_tags_pkey PRIMARY KEY (id);
ALTER TABLE ONLY demographic_answer_option_translations
ADD CONSTRAINT demographic_answer_option_translations_pkey PRIMARY KEY (id);
ALTER TABLE ONLY demographic_answer_options
ADD CONSTRAINT demographic_answer_options_pkey PRIMARY KEY (id);
ALTER TABLE ONLY demographic_answers
ADD CONSTRAINT demographic_answers_pkey PRIMARY KEY (id);
ALTER TABLE ONLY demographic_free_form_answers
ADD CONSTRAINT demographic_free_form_answers_pkey PRIMARY KEY (id);
ALTER TABLE ONLY demographic_question_sets
ADD CONSTRAINT demographic_question_sets_pkey PRIMARY KEY (id);
ALTER TABLE ONLY demographic_question_translations
ADD CONSTRAINT demographic_question_translations_pkey PRIMARY KEY (id);
ALTER TABLE ONLY demographic_questions
ADD CONSTRAINT demographic_questions_pkey PRIMARY KEY (id);
ALTER TABLE ONLY departments
ADD CONSTRAINT departments_pkey PRIMARY KEY (id);
ALTER TABLE ONLY events
ADD CONSTRAINT events_pkey PRIMARY KEY (id);
ALTER TABLE ONLY gho_assigned_tasks
ADD CONSTRAINT gho_assigned_tasks_pkey PRIMARY KEY (id);
ALTER TABLE ONLY gho_custom_field_values
ADD CONSTRAINT gho_custom_field_values_pkey PRIMARY KEY (id);
ALTER TABLE ONLY gho_custom_fields
ADD CONSTRAINT gho_custom_fields_pkey PRIMARY KEY (id);
ALTER TABLE ONLY gho_employees
ADD CONSTRAINT gho_employees_pkey PRIMARY KEY (id);
ALTER TABLE ONLY gho_roles
ADD CONSTRAINT gho_roles_pkey PRIMARY KEY (id);
ALTER TABLE ONLY interviews
ADD CONSTRAINT interviews_pkey PRIMARY KEY (id);
ALTER TABLE ONLY job_posts
ADD CONSTRAINT job_posts_pkey PRIMARY KEY (id);
ALTER TABLE ONLY jobs_attributes
ADD CONSTRAINT jobs_attributes_pkey PRIMARY KEY (id);
ALTER TABLE ONLY jobs_departments
ADD CONSTRAINT jobs_departments_pkey PRIMARY KEY (id);
ALTER TABLE ONLY jobs_interviews
ADD CONSTRAINT jobs_interviews_pkey PRIMARY KEY (id);
ALTER TABLE ONLY jobs_offices
ADD CONSTRAINT jobs_offices_pkey PRIMARY KEY (id);
ALTER TABLE ONLY jobs
ADD CONSTRAINT jobs_pkey PRIMARY KEY (id);
ALTER TABLE ONLY offers
ADD CONSTRAINT offers_pkey PRIMARY KEY (id);
ALTER TABLE ONLY offices
ADD CONSTRAINT offices_pkey PRIMARY KEY (id);
ALTER TABLE ONLY openings
ADD CONSTRAINT openings_pkey PRIMARY KEY (id);
ALTER TABLE ONLY organizations
ADD CONSTRAINT organizations_pkey PRIMARY KEY (id);
ALTER TABLE ONLY referrers
ADD CONSTRAINT referrers_pkey PRIMARY KEY (id);
ALTER TABLE ONLY rejection_reasons
ADD CONSTRAINT rejection_reasons_pkey PRIMARY KEY (id);
ALTER TABLE ONLY scheduled_interviews
ADD CONSTRAINT scheduled_interviews_pkey PRIMARY KEY (id);
ALTER TABLE ONLY scorecard_questions
ADD CONSTRAINT scorecard_questions_pkey PRIMARY KEY (id);
ALTER TABLE ONLY scorecards
ADD CONSTRAINT scorecards_pkey PRIMARY KEY (id);
ALTER TABLE ONLY sources
ADD CONSTRAINT sources_pkey PRIMARY KEY (id);
ALTER TABLE ONLY stages
ADD CONSTRAINT stages_pkey PRIMARY KEY (id);
ALTER TABLE ONLY survey_builder_answers
ADD CONSTRAINT survey_builder_answers_pkey PRIMARY KEY (id);
ALTER TABLE ONLY survey_builder_questions
ADD CONSTRAINT survey_builder_questions_pkey PRIMARY KEY (id);
ALTER TABLE ONLY survey_builder_surveys_departments
ADD CONSTRAINT survey_builder_surveys_departments_pkey PRIMARY KEY (id);
ALTER TABLE ONLY survey_builder_surveys_offices
ADD CONSTRAINT survey_builder_surveys_offices_pkey PRIMARY KEY (id);
ALTER TABLE ONLY survey_builder_surveys
ADD CONSTRAINT survey_builder_surveys_pkey PRIMARY KEY (id);
ALTER TABLE ONLY tags
ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
ALTER TABLE ONLY user_actions
ADD CONSTRAINT user_actions_pkey PRIMARY KEY (id);
ALTER TABLE ONLY users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
ALTER TABLE ONLY agency_question_custom_fields
ADD CONSTRAINT agency_question_custom_fields_application_id_fk FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY agency_question_custom_fields
ADD CONSTRAINT agency_question_custom_fields_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY application_custom_fields
ADD CONSTRAINT application_custom_fields_application_id_fk FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY application_custom_fields
ADD CONSTRAINT application_custom_fields_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY application_question_answers
ADD CONSTRAINT application_question_answers_application_id_fk FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY application_question_answers
ADD CONSTRAINT application_question_answers_job_post_id_fk FOREIGN KEY (job_post_id) REFERENCES job_posts(id);
ALTER TABLE ONLY application_stages
ADD CONSTRAINT application_stages_application_id_fk FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY application_stages
ADD CONSTRAINT application_stages_stage_id_fk FOREIGN KEY (stage_id) REFERENCES stages(id);
ALTER TABLE ONLY applications
ADD CONSTRAINT applications_candidate_id_fk FOREIGN KEY (candidate_id) REFERENCES candidates(id);
ALTER TABLE ONLY applications
ADD CONSTRAINT applications_converted_prospect_application_id_fk FOREIGN KEY (converted_prospect_application_id) REFERENCES applications(id);
ALTER TABLE ONLY applications
ADD CONSTRAINT applications_event_id_fk FOREIGN KEY (event_id) REFERENCES events(id);
ALTER TABLE ONLY applications
ADD CONSTRAINT applications_job_post_id_fk FOREIGN KEY (job_post_id) REFERENCES job_posts(id);
ALTER TABLE ONLY applications_jobs
ADD CONSTRAINT applications_jobs_application_id_fk FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY applications_jobs
ADD CONSTRAINT applications_jobs_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY applications
ADD CONSTRAINT applications_prospect_owner_id_fk FOREIGN KEY (prospect_owner_id) REFERENCES users(id);
ALTER TABLE ONLY applications
ADD CONSTRAINT applications_referrer_id_fk FOREIGN KEY (referrer_id) REFERENCES referrers(id);
ALTER TABLE ONLY applications
ADD CONSTRAINT applications_rejected_by_id_fk FOREIGN KEY (rejected_by_id) REFERENCES users(id);
ALTER TABLE ONLY applications
ADD CONSTRAINT applications_rejection_reason_id_fk FOREIGN KEY (rejection_reason_id) REFERENCES rejection_reasons(id);
ALTER TABLE ONLY applications
ADD CONSTRAINT applications_source_id_fk FOREIGN KEY (source_id) REFERENCES sources(id);
ALTER TABLE ONLY applications
ADD CONSTRAINT applications_stage_id_fk FOREIGN KEY (stage_id) REFERENCES stages(id);
ALTER TABLE ONLY approvals
ADD CONSTRAINT approvals_application_id_fk FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY approvals
ADD CONSTRAINT approvals_approver_id_fk FOREIGN KEY (approver_id) REFERENCES users(id);
ALTER TABLE ONLY approvals
ADD CONSTRAINT approvals_candidate_id_fk FOREIGN KEY (candidate_id) REFERENCES candidates(id);
ALTER TABLE ONLY approvals
ADD CONSTRAINT approvals_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY approvals
ADD CONSTRAINT approvals_offer_id_fk FOREIGN KEY (offer_id) REFERENCES offers(id);
ALTER TABLE ONLY attributes
ADD CONSTRAINT attributes_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY candidate_custom_fields
ADD CONSTRAINT candidate_custom_fields_candidate_id_fk FOREIGN KEY (candidate_id) REFERENCES candidates(id);
ALTER TABLE ONLY candidate_custom_fields
ADD CONSTRAINT candidate_custom_fields_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY candidate_email_addresses
ADD CONSTRAINT candidate_email_addresses_candidate_id_fk FOREIGN KEY (candidate_id) REFERENCES candidates(id);
ALTER TABLE ONLY candidate_mailing_addresses
ADD CONSTRAINT candidate_mailing_addresses_candidate_id_fk FOREIGN KEY (candidate_id) REFERENCES candidates(id);
ALTER TABLE ONLY candidate_phone_numbers
ADD CONSTRAINT candidate_phone_numbers_candidate_id_fk FOREIGN KEY (candidate_id) REFERENCES candidates(id);
ALTER TABLE ONLY candidate_surveys
ADD CONSTRAINT candidate_surveys_department_id_fk FOREIGN KEY (department_id) REFERENCES departments(id);
ALTER TABLE ONLY candidate_surveys
ADD CONSTRAINT candidate_surveys_office_id_fk FOREIGN KEY (office_id) REFERENCES offices(id);
ALTER TABLE ONLY candidate_surveys
ADD CONSTRAINT candidate_surveys_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY candidates
ADD CONSTRAINT candidates_coordinator_id_fk FOREIGN KEY (coordinator_id) REFERENCES users(id);
ALTER TABLE ONLY candidates
ADD CONSTRAINT candidates_recruiter_id_fk FOREIGN KEY (recruiter_id) REFERENCES users(id);
ALTER TABLE ONLY candidates_tags
ADD CONSTRAINT candidates_tags_candidate_id_fk FOREIGN KEY (candidate_id) REFERENCES candidates(id);
ALTER TABLE ONLY candidates_tags
ADD CONSTRAINT candidates_tags_tag_id_fk FOREIGN KEY (tag_id) REFERENCES tags(id);
ALTER TABLE ONLY demographic_answer_option_translations
ADD CONSTRAINT demographic_answer_option_translations_demographic_answer_optio FOREIGN KEY (demographic_answer_option_id) REFERENCES demographic_answer_options(id);
ALTER TABLE ONLY demographic_answer_options
ADD CONSTRAINT demographic_answer_options_demographic_question_id_fk FOREIGN KEY (demographic_question_id) REFERENCES demographic_questions(id);
ALTER TABLE ONLY demographic_answers
ADD CONSTRAINT demographic_answers_application_id_fk FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY demographic_answers
ADD CONSTRAINT demographic_answers_demographic_answer_option_id_fk FOREIGN KEY (demographic_answer_option_id) REFERENCES demographic_answer_options(id);
ALTER TABLE ONLY demographic_answers
ADD CONSTRAINT demographic_answers_demographic_question_id_fk FOREIGN KEY (demographic_question_id) REFERENCES demographic_questions(id);
ALTER TABLE ONLY demographic_free_form_answers
ADD CONSTRAINT demographic_free_form_answers_demographic_answer_id_fk FOREIGN KEY (demographic_answer_id) REFERENCES demographic_answers(id);
ALTER TABLE ONLY demographic_question_translations
ADD CONSTRAINT demographic_question_translations_demographic_question_id_fk FOREIGN KEY (demographic_question_id) REFERENCES demographic_questions(id);
ALTER TABLE ONLY demographic_questions
ADD CONSTRAINT demographic_questions_demographic_question_set_id_fk FOREIGN KEY (demographic_question_set_id) REFERENCES demographic_question_sets(id);
ALTER TABLE ONLY demographic_questions
ADD CONSTRAINT demographic_questions_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY departments
ADD CONSTRAINT departments_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY eeoc_responses
ADD CONSTRAINT eeoc_responses_application_id_fk FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY jobs_interviews
ADD CONSTRAINT fk_rails_01a98bb05d FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY survey_builder_surveys_offices
ADD CONSTRAINT fk_rails_02f2d608ed FOREIGN KEY (survey_id) REFERENCES survey_builder_surveys(id);
ALTER TABLE ONLY scorecard_question_answers
ADD CONSTRAINT fk_rails_09cd11b21c FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY survey_builder_questions
ADD CONSTRAINT fk_rails_0d3b9d776d FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY demographic_question_translations
ADD CONSTRAINT fk_rails_0fdba299f8 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY survey_builder_surveys_offices
ADD CONSTRAINT fk_rails_157481c65d FOREIGN KEY (office_id) REFERENCES offices(id);
ALTER TABLE ONLY events
ADD CONSTRAINT fk_rails_163b5130b5 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY offers
ADD CONSTRAINT fk_rails_16e70cd36f FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY eeoc_responses
ADD CONSTRAINT fk_rails_1a99718a9e FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY user_actions
ADD CONSTRAINT fk_rails_1c49ff35e2 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY demographic_answer_options
ADD CONSTRAINT fk_rails_1d03b0c06d FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY candidate_survey_questions
ADD CONSTRAINT fk_rails_1d1591d9b1 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY prospect_pool_stages
ADD CONSTRAINT fk_rails_2225dc4692 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY educations
ADD CONSTRAINT fk_rails_25f42b7e99 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY prospect_pools
ADD CONSTRAINT fk_rails_274c8418f4 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY jobs_departments
ADD CONSTRAINT fk_rails_32059966b0 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY employments
ADD CONSTRAINT fk_rails_330cc0ff04 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY user_candidate_links
ADD CONSTRAINT fk_rails_345973b0c5 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY survey_builder_answers
ADD CONSTRAINT fk_rails_383c01c6a1 FOREIGN KEY (survey_id) REFERENCES survey_builder_surveys(id);
ALTER TABLE ONLY survey_builder_questions
ADD CONSTRAINT fk_rails_38661a99a0 FOREIGN KEY (survey_id) REFERENCES survey_builder_surveys(id);
ALTER TABLE ONLY survey_builder_surveys
ADD CONSTRAINT fk_rails_443e928aba FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY jobs_offices
ADD CONSTRAINT fk_rails_495ab2bbc0 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY gdpr_consent_requests
ADD CONSTRAINT fk_rails_50e1d86384 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY candidate_email_addresses
ADD CONSTRAINT fk_rails_52166401c0 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY openings
ADD CONSTRAINT fk_rails_543f758735 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY candidates_tags
ADD CONSTRAINT fk_rails_547d231484 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY scorecards
ADD CONSTRAINT fk_rails_59bd91c764 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY approvals
ADD CONSTRAINT fk_rails_5aaa3a5e4a FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY application_stages
ADD CONSTRAINT fk_rails_5ca5eea709 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY candidate_mailing_addresses
ADD CONSTRAINT fk_rails_5dcf1d3c7d FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY applications
ADD CONSTRAINT fk_rails_618951e727 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY application_custom_fields
ADD CONSTRAINT fk_rails_61ea5a0109 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY interviewers
ADD CONSTRAINT fk_rails_6513c6845e FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY survey_builder_answers
ADD CONSTRAINT fk_rails_65997e64a9 FOREIGN KEY (question_id) REFERENCES survey_builder_questions(id);
ALTER TABLE ONLY gdpr_consent_decisions
ADD CONSTRAINT fk_rails_6a0d45e689 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY candidate_custom_fields
ADD CONSTRAINT fk_rails_6d2ccdc7eb FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY demographic_question_sets
ADD CONSTRAINT fk_rails_6f74cafdba FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY greenhouse_usages
ADD CONSTRAINT fk_rails_758b7f0034 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY jobs_attributes
ADD CONSTRAINT fk_rails_77ce920e4c FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY opening_custom_fields
ADD CONSTRAINT fk_rails_7d0abe09a3 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY applications_jobs
ADD CONSTRAINT fk_rails_8c9f30a4df FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY referral_question_custom_fields
ADD CONSTRAINT fk_rails_990bffe104 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY gdpr_office_rules
ADD CONSTRAINT fk_rails_9c93391db8 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY stage_snapshots
ADD CONSTRAINT fk_rails_9e5b8a39e6 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY prospect_pool_transitions
ADD CONSTRAINT fk_rails_9f8e31c857 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY user_attribute_custom_fields
ADD CONSTRAINT fk_rails_a4a930c19a FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY job_custom_fields
ADD CONSTRAINT fk_rails_a78b811e54 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY agency_question_custom_fields
ADD CONSTRAINT fk_rails_a979d3360f FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY jobs_stages
ADD CONSTRAINT fk_rails_abc20b7959 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY offer_custom_fields
ADD CONSTRAINT fk_rails_b16334f543 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY candidates
ADD CONSTRAINT fk_rails_b2429415c2 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY job_post_questions
ADD CONSTRAINT fk_rails_b4c90420b3 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY survey_builder_surveys_departments
ADD CONSTRAINT fk_rails_c3c32f8eda FOREIGN KEY (department_id) REFERENCES departments(id);
ALTER TABLE ONLY survey_builder_surveys_offices
ADD CONSTRAINT fk_rails_c8be1554b8 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY prospect_pool_transitions
ADD CONSTRAINT fk_rails_cbb61aed7d FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY hiring_team
ADD CONSTRAINT fk_rails_cc34ba5656 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY scorecards_attributes
ADD CONSTRAINT fk_rails_d326390f69 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY demographic_answers
ADD CONSTRAINT fk_rails_d50c04e794 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY prospect_pool_transitions
ADD CONSTRAINT fk_rails_dea2de4e91 FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY candidate_phone_numbers
ADD CONSTRAINT fk_rails_decfd1d297 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY demographic_free_form_answers
ADD CONSTRAINT fk_rails_e018b5e599 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY job_snapshots
ADD CONSTRAINT fk_rails_e1532478c8 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY job_posts
ADD CONSTRAINT fk_rails_e83f4bcf39 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY scorecard_questions
ADD CONSTRAINT fk_rails_e86c9718d4 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY scheduled_interviews
ADD CONSTRAINT fk_rails_ed782127d8 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY survey_builder_answers
ADD CONSTRAINT fk_rails_f0683d051e FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY survey_builder_surveys_departments
ADD CONSTRAINT fk_rails_f34d1fc57d FOREIGN KEY (survey_id) REFERENCES survey_builder_surveys(id);
ALTER TABLE ONLY application_question_answers
ADD CONSTRAINT fk_rails_f35a5f14cb FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY interviewer_tags
ADD CONSTRAINT fk_rails_f5d05f4ddf FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY demographic_answer_option_translations
ADD CONSTRAINT fk_rails_fa8db5f533 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY survey_builder_surveys_departments
ADD CONSTRAINT fk_rails_fdefcb0c78 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY rejection_question_custom_fields
ADD CONSTRAINT fk_rails_fe1fffaad6 FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY gdpr_consent_decisions
ADD CONSTRAINT gdpr_consent_decisions_candidate_id_fk FOREIGN KEY (candidate_id) REFERENCES candidates(id);
ALTER TABLE ONLY gdpr_consent_requests
ADD CONSTRAINT gdpr_consent_requests_candidate_id_fk FOREIGN KEY (candidate_id) REFERENCES candidates(id);
ALTER TABLE ONLY gdpr_office_rules
ADD CONSTRAINT gdpr_office_rules_office_id_fk FOREIGN KEY (office_id) REFERENCES offices(id);
ALTER TABLE ONLY gho_custom_field_values
ADD CONSTRAINT gho_custom_field_values_custom_field_id_fk FOREIGN KEY (custom_field_id) REFERENCES gho_custom_fields(id);
ALTER TABLE ONLY gho_custom_field_values
ADD CONSTRAINT gho_custom_field_values_employee_id_fk FOREIGN KEY (employee_id) REFERENCES gho_employees(id);
ALTER TABLE ONLY gho_custom_field_values
ADD CONSTRAINT gho_custom_field_values_value_employee_id_fk FOREIGN KEY (value_employee_id) REFERENCES gho_employees(id);
ALTER TABLE ONLY gho_employee_roles
ADD CONSTRAINT gho_employee_roles_employee_id_fk FOREIGN KEY (employee_id) REFERENCES gho_employees(id);
ALTER TABLE ONLY gho_employee_roles
ADD CONSTRAINT gho_employee_roles_role_id_fk FOREIGN KEY (role_id) REFERENCES gho_roles(id);
ALTER TABLE ONLY gho_user_activities
ADD CONSTRAINT gho_user_activities_employee_id_fk FOREIGN KEY (employee_id) REFERENCES gho_employees(id);
ALTER TABLE ONLY greenhouse_usages
ADD CONSTRAINT greenhouse_usages_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY hiring_team
ADD CONSTRAINT hiring_team_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY hiring_team
ADD CONSTRAINT hiring_team_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY interviewer_tags
ADD CONSTRAINT interviewer_tags_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY interviewers
ADD CONSTRAINT interviewers_interview_id_fk FOREIGN KEY (interview_id) REFERENCES scheduled_interviews(id);
ALTER TABLE ONLY interviewers
ADD CONSTRAINT interviewers_scorecard_id_fk FOREIGN KEY (scorecard_id) REFERENCES scorecards(id);
ALTER TABLE ONLY interviewers
ADD CONSTRAINT interviewers_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY interviews
ADD CONSTRAINT interviews_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY job_custom_fields
ADD CONSTRAINT job_custom_fields_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY job_custom_fields
ADD CONSTRAINT job_custom_fields_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY job_post_questions
ADD CONSTRAINT job_post_questions_job_post_id_fk FOREIGN KEY (job_post_id) REFERENCES job_posts(id);
ALTER TABLE ONLY job_posts
ADD CONSTRAINT job_posts_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY job_snapshots
ADD CONSTRAINT job_snapshots_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY jobs_attributes
ADD CONSTRAINT jobs_attributes_attribute_id_fk FOREIGN KEY (attribute_id) REFERENCES attributes(id);
ALTER TABLE ONLY jobs_attributes
ADD CONSTRAINT jobs_attributes_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY jobs
ADD CONSTRAINT jobs_department_id_fk FOREIGN KEY (department_id) REFERENCES departments(id);
ALTER TABLE ONLY jobs_departments
ADD CONSTRAINT jobs_departments_department_id_fk FOREIGN KEY (department_id) REFERENCES departments(id);
ALTER TABLE ONLY jobs_departments
ADD CONSTRAINT jobs_departments_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY jobs_interviews
ADD CONSTRAINT jobs_interviews_interview_id_fk FOREIGN KEY (interview_id) REFERENCES interviews(id);
ALTER TABLE ONLY jobs_interviews
ADD CONSTRAINT jobs_interviews_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY jobs_interviews
ADD CONSTRAINT jobs_interviews_stage_id_fk FOREIGN KEY (stage_id) REFERENCES stages(id);
ALTER TABLE ONLY jobs_offices
ADD CONSTRAINT jobs_offices_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY jobs_offices
ADD CONSTRAINT jobs_offices_office_id_fk FOREIGN KEY (office_id) REFERENCES offices(id);
ALTER TABLE ONLY jobs
ADD CONSTRAINT jobs_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY jobs_stages
ADD CONSTRAINT jobs_stages_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY jobs_stages
ADD CONSTRAINT jobs_stages_stage_id_fk FOREIGN KEY (stage_id) REFERENCES stages(id);
ALTER TABLE ONLY offer_custom_fields
ADD CONSTRAINT offer_custom_fields_offer_id_fk FOREIGN KEY (offer_id) REFERENCES offers(id);
ALTER TABLE ONLY offer_custom_fields
ADD CONSTRAINT offer_custom_fields_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY offers
ADD CONSTRAINT offers_application_id_fk FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY offices
ADD CONSTRAINT offices_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY opening_custom_fields
ADD CONSTRAINT opening_custom_fields_opening_id_fk FOREIGN KEY (opening_id) REFERENCES openings(id);
ALTER TABLE ONLY opening_custom_fields
ADD CONSTRAINT opening_custom_fields_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY openings
ADD CONSTRAINT openings_hired_application_id_fk FOREIGN KEY (hired_application_id) REFERENCES applications(id);
ALTER TABLE ONLY openings
ADD CONSTRAINT openings_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY referral_question_custom_fields
ADD CONSTRAINT referral_question_custom_fields_candidate_id_fk FOREIGN KEY (candidate_id) REFERENCES candidates(id);
ALTER TABLE ONLY referral_question_custom_fields
ADD CONSTRAINT referral_question_custom_fields_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY referrers
ADD CONSTRAINT referrers_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY referrers
ADD CONSTRAINT referrers_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY rejection_question_custom_fields
ADD CONSTRAINT rejection_question_custom_fields_application_id_fk FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY rejection_question_custom_fields
ADD CONSTRAINT rejection_question_custom_fields_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY rejection_reasons
ADD CONSTRAINT rejection_reasons_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY scheduled_interviews
ADD CONSTRAINT scheduled_interviews_application_id_fk FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY scheduled_interviews
ADD CONSTRAINT scheduled_interviews_interview_id_fk FOREIGN KEY (interview_id) REFERENCES interviews(id);
ALTER TABLE ONLY scheduled_interviews
ADD CONSTRAINT scheduled_interviews_scheduled_by_id_fk FOREIGN KEY (scheduled_by_id) REFERENCES users(id);
ALTER TABLE ONLY scorecard_question_answers
ADD CONSTRAINT scorecard_question_answers_application_id_fk FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY scorecard_question_answers
ADD CONSTRAINT scorecard_question_answers_scorecard_id_fk FOREIGN KEY (scorecard_id) REFERENCES scorecards(id);
ALTER TABLE ONLY scorecard_question_answers
ADD CONSTRAINT scorecard_question_answers_scorecard_question_id_fk FOREIGN KEY (scorecard_question_id) REFERENCES scorecard_questions(id);
ALTER TABLE ONLY scorecards
ADD CONSTRAINT scorecards_application_id_fk FOREIGN KEY (application_id) REFERENCES applications(id);
ALTER TABLE ONLY scorecards_attributes
ADD CONSTRAINT scorecards_attributes_attribute_id_fk FOREIGN KEY (attribute_id) REFERENCES attributes(id);
ALTER TABLE ONLY scorecards_attributes
ADD CONSTRAINT scorecards_attributes_scorecard_id_fk FOREIGN KEY (scorecard_id) REFERENCES scorecards(id);
ALTER TABLE ONLY scorecards
ADD CONSTRAINT scorecards_interview_id_fk FOREIGN KEY (interview_id) REFERENCES interviews(id);
ALTER TABLE ONLY scorecards
ADD CONSTRAINT scorecards_interviewer_id_fk FOREIGN KEY (interviewer_id) REFERENCES users(id);
ALTER TABLE ONLY scorecards
ADD CONSTRAINT scorecards_stage_id_fk FOREIGN KEY (stage_id) REFERENCES stages(id);
ALTER TABLE ONLY scorecards
ADD CONSTRAINT scorecards_submitter_id_fk FOREIGN KEY (submitter_id) REFERENCES users(id);
ALTER TABLE ONLY sources
ADD CONSTRAINT sources_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY stage_snapshots
ADD CONSTRAINT stage_snapshots_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY stage_snapshots
ADD CONSTRAINT stage_snapshots_stage_id_fk FOREIGN KEY (stage_id) REFERENCES stages(id);
ALTER TABLE ONLY stages
ADD CONSTRAINT stages_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY tags
ADD CONSTRAINT tags_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organizations(id);
ALTER TABLE ONLY user_actions
ADD CONSTRAINT user_actions_job_id_fk FOREIGN KEY (job_id) REFERENCES jobs(id);
ALTER TABLE ONLY user_actions
ADD CONSTRAINT user_actions_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY user_attribute_custom_fields
ADD CONSTRAINT user_attribute_custom_fields_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY user_attribute_custom_fields
ADD CONSTRAINT user_attribute_custom_fields_user_id_value_fk FOREIGN KEY (user_id_value) REFERENCES users(id);
ALTER TABLE ONLY user_candidate_links
ADD CONSTRAINT user_candidate_links_candidate_id_fk FOREIGN KEY (candidate_id) REFERENCES candidates(id);
ALTER TABLE ONLY user_candidate_links
ADD CONSTRAINT user_candidate_links_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE ONLY users
ADD CONSTRAINT users_organization_id_fk FOREIGN KEY (organization_id) REFERENCES organizations(id);