Create table employee_contacts
This commit is contained in:
parent
eb4508aea8
commit
6de32a2a04
3 changed files with 24 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
Reference in a new issue