1
0
Fork 0

Create table employee_contacts

This commit is contained in:
Alex Kotov 2020-10-21 10:29:13 +05:00
parent eb4508aea8
commit 6de32a2a04
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 24 additions and 2 deletions

View file

@ -1,6 +1,8 @@
-- This file should undo anything in `up.sql`
DROP INDEX index_employee_contacts_on_employee_id;
DROP INDEX index_employee_infos_on_employee_id_and_locale;
DROP TABLE employee_contacts;
DROP TABLE employee_infos;
DROP TABLE employees;

View file

@ -16,5 +16,17 @@ CREATE TABLE employee_infos (
CONSTRAINT employee_id_fk FOREIGN KEY (employee_id) REFERENCES employees(id)
);
CREATE TABLE employee_contacts (
id SERIAL PRIMARY KEY,
employee_id SERIAL NOT NULL,
name VARCHAR NOT NULL,
link VARCHAR NOT NULL,
CONSTRAINT employee_id_fk FOREIGN KEY (employee_id) REFERENCES employees(id)
);
CREATE UNIQUE INDEX index_employee_infos_on_employee_id_and_locale
ON employee_infos USING btree (employee_id, locale);
CREATE UNIQUE INDEX index_employee_contacts_on_employee_id
ON employee_contacts USING btree (employee_id);

View file

@ -1,3 +1,12 @@
table! {
employee_contacts (id) {
id -> Int4,
employee_id -> Int4,
name -> Varchar,
link -> Varchar,
}
}
table! {
employee_infos (id) {
id -> Int4,
@ -24,9 +33,8 @@ table! {
}
}
joinable!(employee_infos -> employees (employee_id));
allow_tables_to_appear_in_same_query!(
employee_contacts,
employee_infos,
employees,
users,