-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rachid F
committed
Jun 9, 2024
1 parent
cb293c1
commit f283a03
Showing
2 changed files
with
203 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
-- ************************* SqlDBM: PostgreSQL ************************* | ||
-- *********** Generated by SqlDBM: Panora_DB by [email protected] ********** | ||
|
||
|
||
|
||
|
@@ -93,6 +95,7 @@ COMMENT ON CONSTRAINT force_stytch_id_unique ON users IS 'force unique on stytch | |
|
||
|
||
|
||
|
||
-- ************************************** tcg_users | ||
|
||
CREATE TABLE tcg_users | ||
|
@@ -208,6 +211,91 @@ COMMENT ON COLUMN remote_data."format" IS 'can be json, xml'; | |
|
||
|
||
|
||
-- ************************************** managed_webhooks | ||
|
||
CREATE TABLE managed_webhooks | ||
( | ||
id_managed_webhook uuid NOT NULL, | ||
active boolean NOT NULL, | ||
id_connection uuid NOT NULL, | ||
endpoint uuid NOT NULL, | ||
api_version text NULL, | ||
active_events text[] NULL, | ||
remote_signing_secret text NULL, | ||
modified_at timestamp NOT NULL, | ||
created_at timestamp NOT NULL, | ||
CONSTRAINT PK_managed_webhooks PRIMARY KEY ( id_managed_webhook ) | ||
); | ||
|
||
|
||
|
||
COMMENT ON COLUMN managed_webhooks.endpoint IS 'UUID that will be used in the final URL to help identify where to route data | ||
ex: api.panora.dev/mw/{managed_webhooks.endpoint}'; | ||
|
||
|
||
|
||
|
||
|
||
-- ************************************** fs_shared_links | ||
|
||
CREATE TABLE fs_shared_links | ||
( | ||
id_fs_shared_link uuid NOT NULL, | ||
created_at timestamp NOT NULL, | ||
modified_at timestamp NOT NULL, | ||
CONSTRAINT PK_fs_shared_links PRIMARY KEY ( id_fs_shared_link ) | ||
); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
-- ************************************** fs_permissions | ||
|
||
CREATE TABLE fs_permissions | ||
( | ||
id_fs_permission uuid NOT NULL, | ||
remote_id text NULL, | ||
created_at timestamp NOT NULL, | ||
modified_at timestamp NOT NULL, | ||
"user" uuid NOT NULL, | ||
"group" uuid NOT NULL, | ||
type text[] NOT NULL, | ||
roles text[] NOT NULL, | ||
CONSTRAINT PK_fs_permissions PRIMARY KEY ( id_fs_permission ) | ||
); | ||
|
||
|
||
|
||
COMMENT ON COLUMN fs_permissions.roles IS 'read, write, owner'; | ||
|
||
|
||
|
||
|
||
|
||
-- ************************************** fs_drives | ||
|
||
CREATE TABLE fs_drives | ||
( | ||
id_fs_drive uuid NOT NULL, | ||
remote_created_at timestamp NULL, | ||
drive_url text NULL, | ||
created_at timestamp NOT NULL, | ||
modified_at timestamp NOT NULL, | ||
remote_id text NULL, | ||
CONSTRAINT PK_fs_drives PRIMARY KEY ( id_fs_drive ) | ||
); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
-- ************************************** entity | ||
|
||
CREATE TABLE entity | ||
|
@@ -319,6 +407,31 @@ CREATE TABLE crm_deals_stages | |
|
||
|
||
|
||
-- ************************************** connector_sets | ||
|
||
CREATE TABLE connector_sets | ||
( | ||
id_connector_set uuid NOT NULL, | ||
crm_hubspot boolean NOT NULL, | ||
crm_freshsales boolean NOT NULL, | ||
crm_zoho boolean NOT NULL, | ||
crm_attio boolean NOT NULL, | ||
crm_pipedrive boolean NOT NULL, | ||
tcg_zendesk boolean NOT NULL, | ||
tcg_jira boolean NOT NULL, | ||
tcg_gorgias boolean NOT NULL, | ||
tcg_gitlab boolean NOT NULL, | ||
tcg_front boolean NOT NULL, | ||
CONSTRAINT PK_project_connector PRIMARY KEY ( id_connector_set ) | ||
); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
-- ************************************** connection_strategies | ||
|
||
CREATE TABLE connection_strategies | ||
|
@@ -419,16 +532,23 @@ CREATE INDEX FK_tcg_contact_tcg_account_id ON tcg_contacts | |
|
||
CREATE TABLE projects | ||
( | ||
id_project uuid NOT NULL, | ||
name text NOT NULL, | ||
sync_mode text NOT NULL, | ||
pull_frequency bigint NULL, | ||
redirect_url text NULL, | ||
id_user uuid NOT NULL, | ||
id_project uuid NOT NULL, | ||
name text NOT NULL, | ||
sync_mode text NOT NULL, | ||
pull_frequency bigint NULL, | ||
redirect_url text NULL, | ||
id_user uuid NOT NULL, | ||
id_connector_set uuid NOT NULL, | ||
CONSTRAINT PK_projects PRIMARY KEY ( id_project ), | ||
CONSTRAINT FK_project_connectorsetid FOREIGN KEY ( id_connector_set ) REFERENCES connector_sets ( id_connector_set ), | ||
CONSTRAINT FK_46_1 FOREIGN KEY ( id_user ) REFERENCES users ( id_user ) | ||
); | ||
|
||
CREATE INDEX FK_connectors_sets ON projects | ||
( | ||
id_connector_set | ||
); | ||
|
||
|
||
|
||
COMMENT ON COLUMN projects.sync_mode IS 'can be realtime or periodic_pull'; | ||
|
@@ -437,27 +557,43 @@ COMMENT ON COLUMN projects.pull_frequency IS 'frequency in seconds for pulls | |
ex 3600 for one hour'; | ||
|
||
|
||
-- ************************************** project_connectors | ||
|
||
CREATE TABLE project_connectors | ||
|
||
|
||
-- ************************************** fs_folders | ||
|
||
CREATE TABLE fs_folders | ||
( | ||
id_fs_folder uuid NOT NULL, | ||
folder_url text NULL, | ||
"size" bigint NULL, | ||
description text NULL, | ||
parent_folder uuid NULL, | ||
remote_id text NULL, | ||
created_at timestamp NOT NULL, | ||
modified_at timestamp NOT NULL, | ||
id_fs_drive uuid NULL, | ||
id_fs_permission uuid NOT NULL, | ||
CONSTRAINT PK_fs_folders PRIMARY KEY ( id_fs_folder ) | ||
); | ||
|
||
CREATE INDEX FK_fs_folder_driveID ON fs_folders | ||
( | ||
id_fs_drive | ||
); | ||
|
||
CREATE INDEX FK_fs_folder_permissionID ON fs_folders | ||
( | ||
id_project_connector uuid NOT NULL, | ||
id_project uuid NOT NULL, | ||
crm_hubspot boolean NOT NULL, | ||
crm_zoho boolean NOT NULL, | ||
crm_zendesk boolean NOT NULL, | ||
crm_pipedrive boolean NOT NULL, | ||
crm_attio boolean NOT NULL, | ||
tcg_zendesk boolean NOT NULL, | ||
tcg_gorgias boolean NOT NULL, | ||
tcg_front boolean NOT NULL, | ||
tcg_jira boolean NOT NULL, | ||
tcg_gitlab boolean NOT NULL, | ||
CONSTRAINT PK_project_connectors PRIMARY KEY ( id_project_connector ), | ||
CONSTRAINT FK_project_connectors FOREIGN KEY ( id_project ) REFERENCES projects ( id_project ) | ||
id_fs_permission | ||
); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
-- ************************************** crm_contacts | ||
|
||
CREATE TABLE crm_contacts | ||
|
@@ -697,6 +833,41 @@ COMMENT ON COLUMN linked_users.alias IS 'human-readable alias, for UI (ex ACME c | |
|
||
|
||
|
||
-- ************************************** fs_files | ||
|
||
CREATE TABLE fs_files | ||
( | ||
id_fs_file uuid NOT NULL, | ||
name text NULL, | ||
type text NULL, | ||
"path" text NULL, | ||
mime_type text NULL, | ||
"size" bigint NULL, | ||
remote_id text NULL, | ||
id_fs_folder uuid NULL, | ||
created_at timestamp NOT NULL, | ||
modified_at timestamp NOT NULL, | ||
id_fs_permission uuid NOT NULL, | ||
CONSTRAINT PK_fs_files PRIMARY KEY ( id_fs_file ) | ||
); | ||
|
||
CREATE INDEX FK_fs_file_FolderID ON fs_files | ||
( | ||
id_fs_folder | ||
); | ||
|
||
CREATE INDEX FK_fs_file_permissionID ON fs_files | ||
( | ||
id_fs_permission | ||
); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
-- ************************************** crm_phone_numbers | ||
|
||
CREATE TABLE crm_phone_numbers | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,16 +4,17 @@ | |
INSERT INTO users (id_user, identification_strategy, email, password_hash, first_name, last_name) VALUES | ||
('0ce39030-2901-4c56-8db0-5e326182ec6b', 'b2c','[email protected]', '$2b$10$Y7Q8TWGyGuc5ecdIASbBsuXMo3q/Rs3/cnY.mLZP4tUgfGUOCUBlG', 'local', 'Panora'); | ||
|
||
-- First, insert connector sets | ||
INSERT INTO connector_sets (id_connector_set, crm_hubspot, crm_freshsales, crm_zoho, crm_pipedrive, crm_attio, tcg_zendesk, tcg_gorgias, tcg_front, tcg_jira, tcg_gitlab) VALUES | ||
('1709da40-17f7-4d3a-93a0-96dc5da6ddd7', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), | ||
('852dfff8-ab63-4530-ae49-e4b2924407f8', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), | ||
('aed0f856-f802-4a79-8640-66d441581a99', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE); | ||
|
||
INSERT INTO projects (id_project, name, sync_mode, id_user) VALUES | ||
('1e468c15-aa57-4448-aa2b-7fed640d1e3d', 'Project 1', 'pool', '0ce39030-2901-4c56-8db0-5e326182ec6b'), | ||
('4c641a21-a7f8-4ffe-b7e8-e7d32db87557', 'Project 2', 'pool', '0ce39030-2901-4c56-8db0-5e326182ec6b'), | ||
('2b198012-c79c-4bb6-971e-9635830e8c15', 'Project 3', 'pool', '0ce39030-2901-4c56-8db0-5e326182ec6b'); | ||
|
||
INSERT INTO project_connectors (id_project_connector,id_project,crm_hubspot,crm_zoho,crm_zendesk,crm_pipedrive,crm_attio,tcg_zendesk,tcg_gorgias,tcg_front,tcg_jira,tcg_gitlab) VALUES | ||
('1709da40-17f7-4d3a-93a0-96dc5da6ddd7','1e468c15-aa57-4448-aa2b-7fed640d1e3d',TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE), | ||
('852dfff8-ab63-4530-ae49-e4b2924407f8','4c641a21-a7f8-4ffe-b7e8-e7d32db87557',TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE), | ||
('aed0f856-f802-4a79-8640-66d441581a99','2b198012-c79c-4bb6-971e-9635830e8c15',TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE); | ||
-- Then, insert projects with a reference to the connector sets | ||
INSERT INTO projects (id_project, name, sync_mode, id_user, id_connector_set) VALUES | ||
('1e468c15-aa57-4448-aa2b-7fed640d1e3d', 'Project 1', 'pool', '0ce39030-2901-4c56-8db0-5e326182ec6b', '1709da40-17f7-4d3a-93a0-96dc5da6ddd7'), | ||
('4c641a21-a7f8-4ffe-b7e8-e7d32db87557', 'Project 2', 'pool', '0ce39030-2901-4c56-8db0-5e326182ec6b', '852dfff8-ab63-4530-ae49-e4b2924407f8'), | ||
('2b198012-c79c-4bb6-971e-9635830e8c15', 'Project 3', 'pool', '0ce39030-2901-4c56-8db0-5e326182ec6b', 'aed0f856-f802-4a79-8640-66d441581a99'); | ||
|
||
-- DO $$ | ||
-- DECLARE | ||
|