feature: add company and link person to company and workspace
This commit is contained in:
@ -1,3 +1,10 @@
|
||||
table:
|
||||
name: person
|
||||
schema: public
|
||||
object_relationships:
|
||||
- name: company
|
||||
using:
|
||||
foreign_key_constraint_on: company_id
|
||||
- name: workspace
|
||||
using:
|
||||
foreign_key_constraint_on: workspace_id
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
table:
|
||||
name: company
|
||||
schema: public
|
||||
@ -1,2 +1,3 @@
|
||||
- "!include public_company.yaml"
|
||||
- "!include public_person.yaml"
|
||||
- "!include public_workspaces.yaml"
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."person" add column "workspace_id" integer
|
||||
-- not null;
|
||||
@ -0,0 +1,2 @@
|
||||
alter table "public"."person" add column "workspace_id" integer
|
||||
not null;
|
||||
@ -0,0 +1 @@
|
||||
alter table "public"."person" drop constraint "person_workspace_id_fkey";
|
||||
@ -0,0 +1,5 @@
|
||||
alter table "public"."person"
|
||||
add constraint "person_workspace_id_fkey"
|
||||
foreign key ("workspace_id")
|
||||
references "public"."workspaces"
|
||||
("id") on update restrict on delete restrict;
|
||||
@ -0,0 +1 @@
|
||||
DROP TABLE "public"."company";
|
||||
@ -0,0 +1 @@
|
||||
CREATE TABLE "public"."company" ("id" serial NOT NULL, "company_name" text NOT NULL, "company_domain" text NOT NULL, "workspace_id" integer NOT NULL, PRIMARY KEY ("id") , FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON UPDATE restrict ON DELETE restrict);
|
||||
@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."person" add column "company_id" integer
|
||||
-- null;
|
||||
@ -0,0 +1,2 @@
|
||||
alter table "public"."person" add column "company_id" integer
|
||||
null;
|
||||
@ -0,0 +1 @@
|
||||
alter table "public"."person" drop constraint "person_company_id_fkey";
|
||||
@ -0,0 +1,5 @@
|
||||
alter table "public"."person"
|
||||
add constraint "person_company_id_fkey"
|
||||
foreign key ("company_id")
|
||||
references "public"."company"
|
||||
("id") on update restrict on delete restrict;
|
||||
@ -0,0 +1,2 @@
|
||||
alter table "public"."person" alter column "company_domain" drop not null;
|
||||
alter table "public"."person" add column "company_domain" text;
|
||||
@ -0,0 +1 @@
|
||||
alter table "public"."person" drop column "company_domain" cascade;
|
||||
@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."person" add column "email" text
|
||||
-- null;
|
||||
@ -0,0 +1,2 @@
|
||||
alter table "public"."person" add column "email" text
|
||||
null;
|
||||
Reference in New Issue
Block a user