From 1479440fffdc5d68e334bc27bac196c2056b1863 Mon Sep 17 00:00:00 2001 From: Rachid F Date: Sun, 7 Jul 2024 14:17:47 -0700 Subject: [PATCH] :card_file_box: Updated acc_ ats_ tables --- packages/api/scripts/init.sql | 1319 +++++++++++++++++++++++++++++---- 1 file changed, 1192 insertions(+), 127 deletions(-) diff --git a/packages/api/scripts/init.sql b/packages/api/scripts/init.sql index 0c42e5bcd..42ab122e5 100644 --- a/packages/api/scripts/init.sql +++ b/packages/api/scripts/init.sql @@ -276,6 +276,9 @@ CREATE TABLE fs_shared_links created_at timestamp with time zone NOT NULL, modified_at timestamp with time zone NOT NULL, id_connection uuid NOT NULL, + id_fs_folder uuid NULL, + id_fs_file uuid NULL, + remote_id text NULL, CONSTRAINT PK_fs_shared_links PRIMARY KEY ( id_fs_shared_link ) ); @@ -363,6 +366,8 @@ CREATE TABLE entity ( id_entity uuid NOT NULL, ressource_owner_id uuid NOT NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, CONSTRAINT PK_entity PRIMARY KEY ( id_entity ) ); @@ -532,6 +537,7 @@ CREATE TABLE ats_users remote_modified_at timestamp NULL, created_at timestamp NOT NULL, modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_users PRIMARY KEY ( id_ats_user ) ); @@ -543,21 +549,6 @@ COMMENT ON COLUMN ats_users.access_role IS 'The user''s role. Possible values in --- ************************************** ats_screening_questions - -CREATE TABLE ats_screening_questions -( - id_ats_screening_question uuid NOT NULL, - CONSTRAINT PK_1 PRIMARY KEY ( id_ats_screening_question ) -); - - - - - - - - -- ************************************** ats_reject_reasons CREATE TABLE ats_reject_reasons @@ -567,6 +558,7 @@ CREATE TABLE ats_reject_reasons remote_id text NULL, modified_at timestamp NOT NULL, created_at timestamp NOT NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_reject_reasons PRIMARY KEY ( id_ats_reject_reason ) ); @@ -587,6 +579,7 @@ CREATE TABLE ats_offices modified_at timestamp NOT NULL, name text NULL, location text NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_offices PRIMARY KEY ( id_ats_office ) ); @@ -617,6 +610,7 @@ CREATE TABLE ats_jobs remote_updated_at timestamp NULL, created_at timestamp NOT NULL, modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_jobs PRIMARY KEY ( id_ats_job ) ); @@ -643,6 +637,7 @@ CREATE TABLE ats_departments remote_id text NULL, created_at timestamp NOT NULL, modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_departments PRIMARY KEY ( id_ats_department ) ); @@ -672,6 +667,7 @@ CREATE TABLE ats_candidates email_reachable boolean NULL, locations text NULL, tags text[] NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_candidates PRIMARY KEY ( id_ats_candidate ) ); @@ -707,6 +703,313 @@ CREATE TABLE ats_candidate_tags +-- ************************************** acc_vendor_credits + +CREATE TABLE acc_vendor_credits +( + id_acc_vendor_credit uuid NOT NULL, + id_connection uuid NOT NULL, + remote_id text NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, + "number" text NULL, + transaction_date timestamp with time zone NULL, + vendor uuid NULL, + total_amount bigint NULL, + currency text NULL, + exchange_rate text NULL, + company uuid NULL, + tracking_categories text[] NULL, + accounting_period uuid NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_vendor_credit ) +); + + + +COMMENT ON COLUMN acc_vendor_credits.company IS 'The company the vendor credit belongs to.'; + + + + + +-- ************************************** acc_transactions + +CREATE TABLE acc_transactions +( + id_acc_transaction uuid NOT NULL, + transaction_type text NULL, + "number" bigint NULL, + transaction_date timestamp with time zone NULL, + total_amount text NULL, + exchange_rate text NULL, + currency text NULL, + tracking_categories text[] NULL, + id_acc_account uuid NULL, + id_acc_contact uuid NULL, + id_acc_company_info uuid NULL, + id_acc_accounting_period uuid NULL, + remote_id text NOT NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_acc_transactions PRIMARY KEY ( id_acc_transaction ) +); + +COMMENT ON TABLE acc_transactions IS 'Transactions +The Transaction common model includes records of all types of transactions that do not appear in other common models. The type of transaction can be identified through the type field. More specifically, it will contain all types of transactions outside of: + +Credit Notes +Expenses +Invoices +Journal Entries +Payments +Purchase Orders +Vendor Credits'; + +COMMENT ON COLUMN acc_transactions.total_amount IS 'The total amount being paid after taxes.'; + + + + + +-- ************************************** acc_tracking_categories + +CREATE TABLE acc_tracking_categories +( + id_acc_tracking_category uuid NOT NULL, + remote_id text NULL, + name text NULL, + status text NULL, + category_type text NULL, + parent_category uuid NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_acc_tracking_categories PRIMARY KEY ( id_acc_tracking_category ) +); + + + +COMMENT ON COLUMN acc_tracking_categories.status IS 'The tracking category''s status. Possible values include: ACTIVE, ARCHIVED. In cases where there is no clear mapping, the original value passed through will be returned.'; +COMMENT ON COLUMN acc_tracking_categories.category_type IS 'The tracking category’s type. Possible values include: CLASS, DEPARTMENT. In cases where there is no clear mapping, the original value passed through will be returned.'; +COMMENT ON COLUMN acc_tracking_categories.parent_category IS 'ID of the parent tracking category.'; + + + + + +-- ************************************** acc_tax_rates + +CREATE TABLE acc_tax_rates +( + id_acc_tax_rate uuid NOT NULL, + remote_id text NULL, + description text NULL, + total_tax_ratge bigint NULL, + effective_tax_rate bigint NULL, + company uuid NULL, + id_connection uuid NOT NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_tax_rate ) +); + + + +COMMENT ON COLUMN acc_tax_rates.total_tax_ratge IS 'The tax’s total tax rate - sum of the tax components (not compounded).'; +COMMENT ON COLUMN acc_tax_rates.company IS 'The subsidiary that the tax rate belongs to (in the case of multi-entity systems).'; + + + + + +-- ************************************** acc_report_items + +CREATE TABLE acc_report_items +( + id_acc_report_item uuid NOT NULL, + name text NULL, + value bigint NULL, + company uuid NULL, + parent_item uuid NULL, + remote_id text NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_report_item ) +); + + + + + + + + +-- ************************************** acc_income_statements + +CREATE TABLE acc_income_statements +( + id_acc_income_statement uuid NOT NULL, + name text NULL, + currency text NULL, + start_period timestamp with time zone NULL, + end_period timestamp with time zone NULL, + gross_profit bigint NULL, + net_operating_income bigint NULL, + net_income bigint NULL, + remote_id text NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_income_statement ) +); + + + + + + + + +-- ************************************** acc_credit_notes + +CREATE TABLE acc_credit_notes +( + id_acc_credit_note uuid NOT NULL, + transaction_date timestamp with time zone NULL, + status text NULL, + "number" text NULL, + id_acc_contact uuid NULL, + company uuid NULL, + exchange_rate text NULL, + total_amount bigint NULL, + remaining_credit bigint NULL, + tracking_categories text[] NULL, + currency text NULL, + remote_created_at timestamp with time zone NULL, + remote_updated_at timestamp with time zone NULL, + payments text[] NULL, + applied_payments text[] NULL, + id_acc_accounting_period uuid NULL, + remote_id text NULL, + modified_at time with time zone NOT NULL, + created_at time with time zone NOT NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_credit_note ) +); + + + +COMMENT ON COLUMN acc_credit_notes.status IS 'The credit note''s status. Possible values include: SUBMITTED, AUTHORIZED, PAID. In cases where there is no clear mapping, the original value passed through will be returned.'; +COMMENT ON COLUMN acc_credit_notes."number" IS 'The credit note''s number.'; +COMMENT ON COLUMN acc_credit_notes.payments IS 'array of id_acc_payment'; + + + + + +-- ************************************** acc_company_infos + +CREATE TABLE acc_company_infos +( + id_acc_company_info uuid NOT NULL, + name text NULL, + legal_name text NULL, + tax_number text NULL, + fiscal_year_end_month int NULL, + fiscal_year_end_day int NULL, + currency text NULL, + remote_created_at timestamp NULL, + remote_id text NULL, + urls text[] NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, + tracking_categories text[] NULL, + CONSTRAINT PK_acc_company_infos PRIMARY KEY ( id_acc_company_info ) +); + + + + + + + + +-- ************************************** acc_cash_flow_statements + +CREATE TABLE acc_cash_flow_statements +( + id_acc_cash_flow_statement uuid NOT NULL, + name text NULL, + currency text NULL, + company uuid NULL, + start_period timestamp with time zone NULL, + end_period timestamp with time zone NULL, + cash_at_beginning_of_period bigint NULL, + cash_at_end_of_period bigint NULL, + remote_generated_at timestamp with time zone NULL, + remote_id text NULL, + modified_at timestamp with time zone NOT NULL, + created_at timestamp with time zone NOT NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_cash_flow_statement ) +); + + + + + + + + +-- ************************************** acc_balance_sheets_report_items + +CREATE TABLE acc_balance_sheets_report_items +( + id_acc_balance_sheets_report_item uuid NOT NULL, + remote_id text NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, + name text NULL, + value bigint NULL, + parent_item uuid NULL, + id_acc_company_info uuid NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_balance_sheets_report_item ) +); + + + +COMMENT ON COLUMN acc_balance_sheets_report_items.parent_item IS 'uuid of another id_acc_balance_sheets_report_item'; + + + + + +-- ************************************** acc_accounting_periods + +CREATE TABLE acc_accounting_periods +( + id_acc_accounting_period uuid NOT NULL, + remote_id string NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + name text NULL, + status text NULL, + start_date timestamp NULL, + end_date timestamp NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_acc_accounting_periods PRIMARY KEY ( id_acc_accounting_period ) +); + + + +COMMENT ON COLUMN acc_accounting_periods.status IS 'Possible values include: ACTIVE, INACTIVE. In cases where there is no clear mapping, the original value passed through will be returned.'; + + + + + -- ************************************** tcg_tickets CREATE TABLE tcg_tickets @@ -821,27 +1124,21 @@ ex 3600 for one hour'; CREATE TABLE fs_folders ( - id_fs_folder uuid NOT NULL, - folder_url text NULL, - "size" bigint NULL, - name text 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_connection uuid NOT NULL, - id_fs_permission uuid NULL, - id_fs_shared_link uuid NULL, + id_fs_folder uuid NOT NULL, + folder_url text NULL, + "size" bigint NULL, + name text 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_connection uuid NOT NULL, + id_fs_permission uuid NULL, CONSTRAINT PK_fs_folders PRIMARY KEY ( id_fs_folder ) ); -CREATE INDEX FK_folder_shared_links ON fs_folders -( - id_fs_shared_link -); - CREATE INDEX FK_fs_folder_driveID ON fs_folders ( id_fs_drive @@ -937,6 +1234,8 @@ CREATE TABLE attribute id_project uuid NOT NULL, "scope" text NOT NULL, id_consumer uuid NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, CONSTRAINT PK_attribute PRIMARY KEY ( id_attribute ), CONSTRAINT FK_32 FOREIGN KEY ( id_entity ) REFERENCES entity ( id_entity ) ); @@ -979,6 +1278,7 @@ CREATE TABLE ats_job_interview_stages created_at timestamp NOT NULL, modified_at timestamp NOT NULL, id_ats_job uuid NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_job_interview_stages PRIMARY KEY ( id_ats_job_interview_stage ) ); @@ -1009,6 +1309,7 @@ CREATE TABLE ats_eeocs remote_id text NULL, created_at timestamp NOT NULL, modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_eeocs PRIMARY KEY ( id_ats_eeoc ) ); @@ -1118,6 +1419,7 @@ CREATE TABLE ats_candidate_attachments created_at timestamp NOT NULL, modified_at timestamp NOT NULL, id_ats_candidate uuid NOT NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_candidate_attachments PRIMARY KEY ( id_ats_candidate_attachment ) ); @@ -1151,6 +1453,7 @@ CREATE TABLE ats_applications id_ats_job uuid NULL, created_at timestamp NOT NULL, modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_applications PRIMARY KEY ( id_ats_application ) ); @@ -1188,6 +1491,7 @@ CREATE TABLE ats_activities remote_created_at timestamp NULL, created_at timestamp NOT NULL, modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_activities PRIMARY KEY ( id_ats_activity ) ); @@ -1208,163 +1512,454 @@ COMMENT ON COLUMN ats_activities.id_ats_candidate IS 'The activity’s candidate --- ************************************** value - -CREATE TABLE value -( - id_value uuid NOT NULL, - data text NOT NULL, - id_entity uuid NOT NULL, - id_attribute uuid NOT NULL, - CONSTRAINT PK_value PRIMARY KEY ( id_value ), - CONSTRAINT FK_33 FOREIGN KEY ( id_attribute ) REFERENCES attribute ( id_attribute ), - CONSTRAINT FK_34 FOREIGN KEY ( id_entity ) REFERENCES entity ( id_entity ) -); +-- ************************************** acc_vendor_credit_lines -CREATE INDEX FK_value_attributeID ON value +CREATE TABLE acc_vendor_credit_lines ( - id_attribute + id_acc_vendor_credit_line uuid NOT NULL, + id_acc_vendor_credit uuid NOT NULL, + net_amount bigint NULL, + tracking_categories text[] NULL, + description text NULL, + account uuid NULL, + id_acc_account uuid NULL, + exchange_rate text NULL, + id_acc_company_info uuid NULL, + remote_id text NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_vendor_credit_line ) ); -CREATE INDEX FK_value_entityID ON value +CREATE INDEX FK_1 ON acc_vendor_credit_lines ( - id_entity + id_acc_vendor_credit ); -COMMENT ON COLUMN value.data IS 'can be: true, false, 0, 1 , 2 3 , 4 , hello, world ...'; --- ************************************** tcg_tags +-- ************************************** acc_transactions_lines_items -CREATE TABLE tcg_tags +CREATE TABLE acc_transactions_lines_items ( - id_tcg_tag uuid NOT NULL, - name text NULL, - remote_id text NULL, - remote_platform text NULL, - id_tcg_ticket uuid NULL, - created_at timestamp NOT NULL, - modified_at timestamp NOT NULL, - id_linked_user uuid NULL, - id_connection uuid NOT NULL, - CONSTRAINT PK_tcg_tags PRIMARY KEY ( id_tcg_tag ), - CONSTRAINT FK_48 FOREIGN KEY ( id_tcg_ticket ) REFERENCES tcg_tickets ( id_tcg_ticket ) + id_acc_transactions_lines_item uuid NOT NULL, + memo text NULL, + unit_price text NULL, + quantity text NULL, + total_line_amount text NULL, + id_acc_tax_rate uuid NULL, + currency text NULL, + exchange_rate text NULL, + tracking_categories text[] NULL, + id_acc_company_info uuid NULL, + id_acc_item uuid NULL, + id_acc_account uuid NULL, + remote_id text NULL, + created_at time with time zone NOT NULL, + modified_at time with time zone NOT NULL, + id_acc_transaction uuid NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_transactions_lines_item ) ); -CREATE INDEX FK_tcg_tag_tcg_ticketID ON tcg_tags +CREATE INDEX FK_acc_transactions_lineItems ON acc_transactions_lines_items ( - id_tcg_ticket + id_acc_transaction ); +COMMENT ON COLUMN acc_transactions_lines_items.id_acc_company_info IS 'The company the line belongs to.'; --- ************************************** tcg_comments +-- ************************************** acc_purchase_orders -CREATE TABLE tcg_comments +CREATE TABLE acc_purchase_orders ( - id_tcg_comment uuid NOT NULL, - body text NULL, - html_body text NULL, - is_private boolean NULL, - remote_id text NULL, - remote_platform text NULL, - created_at timestamp NULL, - modified_at timestamp NULL, - creator_type text NULL, - id_tcg_attachment text[] NULL, - id_tcg_ticket uuid NULL, - id_tcg_contact uuid NULL, - id_tcg_user uuid NULL, - id_linked_user uuid NULL, - id_connection uuid NOT NULL, - CONSTRAINT PK_tcg_comments PRIMARY KEY ( id_tcg_comment ), - CONSTRAINT FK_41 FOREIGN KEY ( id_tcg_contact ) REFERENCES tcg_contacts ( id_tcg_contact ), - CONSTRAINT FK_40_1 FOREIGN KEY ( id_tcg_ticket ) REFERENCES tcg_tickets ( id_tcg_ticket ), - CONSTRAINT FK_42 FOREIGN KEY ( id_tcg_user ) REFERENCES tcg_users ( id_tcg_user ) + id_acc_purchase_order uuid NOT NULL, + remote_id text NULL, + status text NULL, + issue_date timestamp with time zone NULL, + purchase_order_number text NULL, + delivery_date timestamp with time zone NULL, + delivery_address uuid NULL, + customer uuid NULL, + vendor uuid NULL, + memo text NULL, + company uuid NULL, + total_amount bigint NULL, + currency text NULL, + exchange_rate text NULL, + tracking_categories text[] NULL, + remote_created_at timestamp with time zone NULL, + remote_updated_at timestamp with time zone NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, + id_connection uuid NOT NULL, + id_acc_accounting_period uuid NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_purchase_order ) ); -CREATE INDEX FK_tcg_comment_tcg_contact ON tcg_comments +CREATE INDEX FK_purchaseOrder_accountingPeriod ON acc_purchase_orders ( - id_tcg_contact + id_acc_accounting_period ); -CREATE INDEX FK_tcg_comment_tcg_ticket ON tcg_comments -( - id_tcg_ticket -); -CREATE INDEX FK_tcg_comment_tcg_userID ON tcg_comments -( - id_tcg_user -); -COMMENT ON TABLE tcg_comments IS 'The tcg_comment object represents a comment on a ticket.'; +COMMENT ON COLUMN acc_purchase_orders.status IS 'The purchase order''s status. Possible values include: DRAFT, SUBMITTED, AUTHORIZED, BILLED, DELETED. In cases where there is no clear mapping, the original value passed through will be returned.'; +COMMENT ON COLUMN acc_purchase_orders.delivery_address IS 'contains a id_acc_address'; +COMMENT ON COLUMN acc_purchase_orders.customer IS 'The contact making the purchase order. +Contains a id_acc_contact'; +COMMENT ON COLUMN acc_purchase_orders.vendor IS 'contains a id_acc_contact'; +COMMENT ON COLUMN acc_purchase_orders.id_acc_accounting_period IS 'The accounting period that the PurchaseOrder was generated in.'; -COMMENT ON COLUMN tcg_comments.creator_type IS 'Who created the comment. Can be a a id_tcg_contact or a id_tcg_user'; +-- ************************************** acc_journal_entries --- ************************************** linked_users +CREATE TABLE acc_journal_entries +( + id_acc_journal_entry uuid NOT NULL, + transaction_date timestamp with time zone NULL, + payments text[] NOT NULL, + applied_payments text[] NOT NULL, + memo text NULL, + currency text NULL, + exchange_rate text NULL, + id_acc_company_info uuid NOT NULL, + journal_number text NULL, + tracking_categories text[] NULL, + id_acc_accounting_period uuid NULL, + posting_status text NULL, + remote_created_at timestamp with time zone NULL, + remote_modiified_at timestamp with time zone NULL, + id_connection uuid NOT NULL, + remote_id text NOT NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, + CONSTRAINT PK_acc_journal_entries PRIMARY KEY ( id_acc_journal_entry ) +); -CREATE TABLE linked_users +CREATE INDEX FK_journal_entry_accounting_period ON acc_journal_entries ( - id_linked_user uuid NOT NULL, - linked_user_origin_id text NOT NULL, - alias text NOT NULL, - id_project uuid NOT NULL, - CONSTRAINT key_id_linked_users PRIMARY KEY ( id_linked_user ), - CONSTRAINT FK_10 FOREIGN KEY ( id_project ) REFERENCES projects ( id_project ) + id_acc_accounting_period ); -CREATE INDEX FK_proectID_linked_users ON linked_users +CREATE INDEX FK_journal_entry_companyInfo ON acc_journal_entries ( - id_project + id_acc_company_info ); -COMMENT ON COLUMN linked_users.linked_user_origin_id IS 'id of the customer, in our customers own systems'; -COMMENT ON COLUMN linked_users.alias IS 'human-readable alias, for UI (ex ACME company)'; --- ************************************** fs_files +-- ************************************** acc_contacts -CREATE TABLE fs_files +CREATE TABLE acc_contacts ( - id_fs_file uuid NOT NULL, - name text NULL, - type text NULL, - file_url text NULL, - mime_type text NULL, - "size" bigint NULL, - remote_id text NULL, - id_fs_permission uuid NULL, - id_fs_folder uuid NULL, - id_fs_shared_link uuid NULL, - created_at timestamp NOT NULL, - modified_at timestamp NOT NULL, + id_acc_contact uuid NOT NULL, + name text NULL, + is_supplier boolean NULL, + is_customer boolean NULL, + email_address text NULL, + tax_number text NULL, + status text NULL, + currency text NULL, + remote_updated_at text NULL, + id_acc_company_info uuid NULL, + id_connection uuid NOT NULL, + remote_id text NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + CONSTRAINT PK_acc_contacts PRIMARY KEY ( id_acc_contact ) +); + +CREATE INDEX FK_acc_contact_company ON acc_contacts +( + id_acc_company_info +); + + + +COMMENT ON COLUMN acc_contacts.status IS 'The contact''s status Possible values include: ACTIVE, ARCHIVED. In cases where there is no clear mapping, the original value passed through will be returned.'; + + + + + +-- ************************************** acc_cash_flow_statement_report_items + +CREATE TABLE acc_cash_flow_statement_report_items +( + id_acc_cash_flow_statement_report_item uuid NOT NULL, + name text NULL, + value bigint NULL, + type text NULL, + parent_item uuid NULL, + remote_generated_at timestamp with time zone NULL, + remote_id text NULL, + modified_at timestamp with time zone NOT NULL, + created_at timestamp with time zone NOT NULL, + id_acc_cash_flow_statement uuid NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_cash_flow_statement_report_item ) +); + +CREATE INDEX FK_cashflow_statement_acc_cash_flow_statement_report_item ON acc_cash_flow_statement_report_items +( + id_acc_cash_flow_statement +); + + + +COMMENT ON COLUMN acc_cash_flow_statement_report_items.type IS 'can be operating, investing, financing'; + + + + + +-- ************************************** acc_balance_sheets + +CREATE TABLE acc_balance_sheets +( + id_acc_balance_sheet uuid NOT NULL, + name text NULL, + currency text NULL, + id_acc_company_info uuid NULL, + "date" timestamp with time zone NULL, + net_assets bigint NULL, + assets text[] NULL, + liabilities text[] NULL, + equity text[] NULL, + remote_generated_at timestamp with time zone NULL, + remote_id text NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_acc_balance_sheets PRIMARY KEY ( id_acc_balance_sheet ) +); + +CREATE INDEX FK_balanceSheetCompanyInfoID ON acc_balance_sheets +( + id_acc_company_info +); + + + +COMMENT ON COLUMN acc_balance_sheets.net_assets IS 'The balance sheet''s net assets.'; +COMMENT ON COLUMN acc_balance_sheets.assets IS 'array of id_acc_balance_sheets_report_item objects'; +COMMENT ON COLUMN acc_balance_sheets.liabilities IS 'array of id_acc_balance_sheets_report_item objects'; +COMMENT ON COLUMN acc_balance_sheets.equity IS 'array of id_acc_balance_sheets_report_item objects'; + + + + + +-- ************************************** acc_accounts + +CREATE TABLE acc_accounts +( + id_acc_account uuid NOT NULL, + name text NULL, + description text NULL, + classification text NULL, + type text NULL, + status text NULL, + current_balance bigint NULL, + currency text NULL, + account_number text NULL, + parent_account uuid NULL, + remote_id text NULL, + id_acc_company_info uuid NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_acc_accounts PRIMARY KEY ( id_acc_account ) +); + +CREATE INDEX FK_accounts_companyinfo_ID ON acc_accounts +( + id_acc_company_info +); + + + +COMMENT ON COLUMN acc_accounts.classification IS 'The account''s broadest grouping. Possible values include: ASSET, EQUITY, EXPENSE, LIABILITY, REVENUE. In cases where there is no clear mapping, the original value passed through will be returned.'; +COMMENT ON COLUMN acc_accounts.type IS 'The account''s type is a narrower and more specific grouping within the account''s classification.'; +COMMENT ON COLUMN acc_accounts.status IS 'The account''s status. Possible values include: ACTIVE, PENDING, INACTIVE. In cases where there is no clear mapping, the original value passed through will be returned.'; +COMMENT ON COLUMN acc_accounts.current_balance IS 'Use cents. 100 USD would be 10000'; +COMMENT ON COLUMN acc_accounts.currency IS 'Possible values include: XUA, AFN, AFA, ALL, ALK, DZD, ADP, AOA, AOK, AON, AOR, ARA, ARS, ARM, ARP, ARL, AMD, AWG, AUD, ATS, AZN, AZM, BSD, BHD, BDT, BBD, BYN, BYB, BYR, BEF, BEC, BEL, BZD, BMD, BTN, BOB, BOL, BOV, BOP, BAM, BAD, BAN, BWP, BRC, BRZ, BRE, BRR, BRN, BRB, BRL, GBP, BND, BGL, BGN, BGO, BGM, BUK, BIF, XPF, KHR, CAD, CVE, KYD, XAF, CLE, CLP, CLF, CNX, CNY, CNH, COP, COU, KMF, CDF, CRC, HRD, HRK, CUC, CUP, CYP, CZK, CSK, DKK, DJF, DOP, NLG, XCD, DDM, ECS, ECV, EGP, GQE, ERN, EEK, ETB, EUR, XBA, XEU, XBB, XBC, XBD, FKP, FJD, FIM, FRF, XFO, XFU, GMD, GEK, GEL, DEM, GHS, GHC, GIP, XAU, GRD, GTQ, GWP, GNF, GNS, GYD, HTG, HNL, HKD, HUF, IMP, ISK, ISJ, INR, IDR, IRR, IQD, IEP, ILS, ILP, ILR, ITL, JMD, JPY, JOD, KZT, KES, KWD, KGS, LAK, LVL, LVR, LBP, LSL, LRD, LYD, LTL, LTT, LUL, LUC, LUF, MOP, MKD, MKN, MGA, MGF, MWK, MYR, MVR, MVP, MLF, MTL, MTP, MRU, MRO, MUR, MXV, MXN, MXP, MDC, MDL, MCF, MNT, MAD, MAF, MZE, MZN, MZM, MMK, NAD, NPR, ANG, TWD, NZD, NIO, NIC, NGN, KPW, NOK, OMR, PKR, XPD, PAB, PGK, PYG, PEI, PEN, PES, PHP, XPT, PLN, PLZ, PTE, GWE, QAR, XRE, RHD, RON, ROL, RUB, RUR, RWF, SVC, WST, SAR, RSD, CSD, SCR, SLL, XAG, SGD, SKK, SIT, SBD, SOS, ZAR, ZAL, KRH, KRW, KRO, SSP, SUR, ESP, ESA, ESB, XDR, LKR, SHP, XSU, SDD, SDG, SDP, SRD, SRG, SZL, SEK, CHF, SYP, STN, STD, TVD, TJR, TJS, TZS, XTS, THB, XXX, TPE, TOP, TTD, TND, TRY, TRL, TMT, TMM, USD, USN, USS, UGX, UGS, UAH, UAK, AED, UYW, UYU, UYP, UYI, UZS, VUV, VES, VEB, VEF, VND, VNN, CHE, CHW, XOF, YDD, YER, YUN, YUD, YUM, YUR, ZWN, ZRN, ZRZ, ZMW, ZMK, ZWD, ZWR, ZWL. In cases where there is no clear mapping, the original value passed through will be returned.'; + + + + + +-- ************************************** value + +CREATE TABLE value +( + id_value uuid NOT NULL, + data text NOT NULL, + id_entity uuid NOT NULL, + id_attribute uuid NOT NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, + CONSTRAINT PK_value PRIMARY KEY ( id_value ), + CONSTRAINT FK_33 FOREIGN KEY ( id_attribute ) REFERENCES attribute ( id_attribute ), + CONSTRAINT FK_34 FOREIGN KEY ( id_entity ) REFERENCES entity ( id_entity ) +); + +CREATE INDEX FK_value_attributeID ON value +( + id_attribute +); + +CREATE INDEX FK_value_entityID ON value +( + id_entity +); + + + +COMMENT ON COLUMN value.data IS 'can be: true, false, 0, 1 , 2 3 , 4 , hello, world ...'; + + + + + +-- ************************************** tcg_tags + +CREATE TABLE tcg_tags +( + id_tcg_tag uuid NOT NULL, + name text NULL, + remote_id text NULL, + remote_platform text NULL, + id_tcg_ticket uuid NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_linked_user uuid NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_tcg_tags PRIMARY KEY ( id_tcg_tag ), + CONSTRAINT FK_48 FOREIGN KEY ( id_tcg_ticket ) REFERENCES tcg_tickets ( id_tcg_ticket ) +); + +CREATE INDEX FK_tcg_tag_tcg_ticketID ON tcg_tags +( + id_tcg_ticket +); + + + + + + + + +-- ************************************** tcg_comments + +CREATE TABLE tcg_comments +( + id_tcg_comment uuid NOT NULL, + body text NULL, + html_body text NULL, + is_private boolean NULL, + remote_id text NULL, + remote_platform text NULL, + created_at timestamp NULL, + modified_at timestamp NULL, + creator_type text NULL, + id_tcg_attachment text[] NULL, + id_tcg_ticket uuid NULL, + id_tcg_contact uuid NULL, + id_tcg_user uuid NULL, + id_linked_user uuid NULL, id_connection uuid NOT NULL, - CONSTRAINT PK_fs_files PRIMARY KEY ( id_fs_file ) + CONSTRAINT PK_tcg_comments PRIMARY KEY ( id_tcg_comment ), + CONSTRAINT FK_41 FOREIGN KEY ( id_tcg_contact ) REFERENCES tcg_contacts ( id_tcg_contact ), + CONSTRAINT FK_40_1 FOREIGN KEY ( id_tcg_ticket ) REFERENCES tcg_tickets ( id_tcg_ticket ), + CONSTRAINT FK_42 FOREIGN KEY ( id_tcg_user ) REFERENCES tcg_users ( id_tcg_user ) +); + +CREATE INDEX FK_tcg_comment_tcg_contact ON tcg_comments +( + id_tcg_contact +); + +CREATE INDEX FK_tcg_comment_tcg_ticket ON tcg_comments +( + id_tcg_ticket ); -CREATE INDEX FK_file_shared_links ON fs_files +CREATE INDEX FK_tcg_comment_tcg_userID ON tcg_comments ( - id_fs_shared_link + id_tcg_user +); + +COMMENT ON TABLE tcg_comments IS 'The tcg_comment object represents a comment on a ticket.'; + +COMMENT ON COLUMN tcg_comments.creator_type IS 'Who created the comment. Can be a a id_tcg_contact or a id_tcg_user'; + + + + + +-- ************************************** linked_users + +CREATE TABLE linked_users +( + id_linked_user uuid NOT NULL, + linked_user_origin_id text NOT NULL, + alias text NOT NULL, + id_project uuid NOT NULL, + CONSTRAINT key_id_linked_users PRIMARY KEY ( id_linked_user ), + CONSTRAINT FK_10 FOREIGN KEY ( id_project ) REFERENCES projects ( id_project ) +); + +CREATE INDEX FK_proectID_linked_users ON linked_users +( + id_project +); + + + +COMMENT ON COLUMN linked_users.linked_user_origin_id IS 'id of the customer, in our customers own systems'; +COMMENT ON COLUMN linked_users.alias IS 'human-readable alias, for UI (ex ACME company)'; + + + + + +-- ************************************** fs_files + +CREATE TABLE fs_files +( + id_fs_file uuid NOT NULL, + name text NULL, + type text NULL, + file_url text NULL, + mime_type text NULL, + "size" bigint NULL, + remote_id text NULL, + id_fs_permission uuid NULL, + id_fs_folder uuid NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_fs_files PRIMARY KEY ( id_fs_file ) ); CREATE INDEX FK_fs_file_FolderID ON fs_files @@ -1605,6 +2200,7 @@ CREATE TABLE ats_offers created_at timestamp NOT NULL, modified_at timestamp NOT NULL, id_ats_application uuid NOT NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_offers PRIMARY KEY ( id_ats_offer ) ); @@ -1640,6 +2236,7 @@ CREATE TABLE ats_interviews id_ats_job_interview_stage uuid NULL, created_at timestamp NOT NULL, modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_interviews PRIMARY KEY ( id_ats_interview ) ); @@ -1696,6 +2293,317 @@ CREATE INDEX FK_api_keys_projects ON api_keys +-- ************************************** acc_purchase_orders_line_items + +CREATE TABLE acc_purchase_orders_line_items +( + id_acc_purchase_orders_line_item uuid NOT NULL, + id_acc_purchase_order uuid NOT NULL, + remote_id text NULL, + modified_at timestamp with time zone NOT NULL, + created_at timestamp with time zone NOT NULL, + description text NULL, + unit_price bigint NULL, + quantity bigint NULL, + tracking_categories text[] NULL, + tax_amount bigint NULL, + total_line_amount bigint NULL, + currency text NULL, + exchange_rate text NULL, + id_acc_account uuid NULL, + id_acc_company uuid NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_purchase_orders_line_item ) +); + +CREATE INDEX FK_purchaseorder_purchaseorderLineItems ON acc_purchase_orders_line_items +( + id_acc_purchase_order +); + + + + + + + + +-- ************************************** acc_phone_numbers + +CREATE TABLE acc_phone_numbers +( + id_acc_phone_number uuid NOT NULL, + "number" text NULL, + type text NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_acc_company_info uuid NULL, + id_acc_contact uuid NOT NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_acc_phone_numbers PRIMARY KEY ( id_acc_phone_number ) +); + +CREATE INDEX FK_acc_phone_number_contact ON acc_phone_numbers +( + id_acc_contact +); + +CREATE INDEX FK_company_infos_phone_number ON acc_phone_numbers +( + id_acc_company_info +); + + + +COMMENT ON COLUMN acc_phone_numbers.id_acc_company_info IS 'holds a valueif if the phone number belongs to a acc_company_infos objects'; +COMMENT ON COLUMN acc_phone_numbers.id_acc_contact IS 'holds a valueif if the phone number belongs to a acc_contact object'; + + + + + +-- ************************************** acc_journal_entries_lines + +CREATE TABLE acc_journal_entries_lines +( + id_acc_journal_entries_line uuid NOT NULL, + net_amount bigint NULL, + tracking_categories text[] NULL, + currency text NULL, + description text NULL, + company uuid NULL, + contact uuid NULL, + exchange_rate text NULL, + remote_id text NULL, + created_at timestamp with time zone NOT NULL, + modified_at timestamp with time zone NOT NULL, + id_acc_journal_entry uuid NOT NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_journal_entries_line ) +); + +CREATE INDEX FK_1 ON acc_journal_entries_lines +( + id_acc_journal_entry +); + + + + + + + + +-- ************************************** acc_items + +CREATE TABLE acc_items +( + id_acc_item uuid NOT NULL, + name text NULL, + status text NULL, + unit_price bigint NULL, + purchase_price bigint NULL, + remote_updated_at timestamp NULL, + remote_id text NULL, + sales_account uuid NULL, + purchase_account uuid NULL, + id_acc_company_info uuid NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_acc_items PRIMARY KEY ( id_acc_item ) +); + +CREATE INDEX FK_acc_item_acc_account ON acc_items +( + purchase_account +); + +CREATE INDEX FK_acc_item_acc_company_infos ON acc_items +( + id_acc_company_info +); + +CREATE INDEX FK_acc_items_sales_account ON acc_items +( + sales_account +); + + + +COMMENT ON COLUMN acc_items.status IS 'The item''s status. Possible values include: ACTIVE, ARCHIVED. In cases where there is no clear mapping, the original value passed through will be returned.'; + + + + + +-- ************************************** acc_invoices + +CREATE TABLE acc_invoices +( + id_acc_invoice uuid NOT NULL, + type text NULL, + "number" text NULL, + issue_date timestamp NULL, + due_date timestamp NULL, + paid_on_date timestamp NULL, + memo text NULL, + currency text NULL, + exchange_rate text NULL, + total_discount bigint NULL, + sub_total bigint NULL, + status text NULL, + total_tax_amount bigint NULL, + total_amount bigint NULL, + balance bigint NULL, + remote_updated_at timestamp NULL, + remote_id text NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_connection uuis NOT NULL, + id_acc_contact uuid NULL, + id_acc_accounting_period uuid NULL, + tracking_categories text[] NULL, + CONSTRAINT PK_acc_invoices PRIMARY KEY ( id_acc_invoice ) +); + +CREATE INDEX FK_acc_invoice_accounting_period_index ON acc_invoices +( + id_acc_accounting_period +); + +CREATE INDEX FK_invoice_contactID ON acc_invoices +( + id_acc_contact +); + + + +COMMENT ON COLUMN acc_invoices.type IS 'Whether the invoice is an accounts receivable or accounts payable. If type is ACCOUNTS_PAYABLE, the invoice is a bill. If type is ACCOUNTS_RECEIVABLE, it is an invoice. Possible values include: ACCOUNTS_RECEIVABLE, ACCOUNTS_PAYABLE. In cases where there is no clear mapping, the original value passed through will be returned.'; +COMMENT ON COLUMN acc_invoices.total_discount IS 'The total discounts applied to the total cost.'; +COMMENT ON COLUMN acc_invoices.status IS 'The status of the invoice. Possible values include: PAID, DRAFT, SUBMITTED, PARTIALLY_PAID, OPEN, VOID. In cases where there is no clear mapping, the original value passed through will be returned.'; + + + + + +-- ************************************** acc_expenses + +CREATE TABLE acc_expenses +( + id_acc_expense uuid NOT NULL, + transaction_date timestamp NULL, + total_amount bigint NULL, + sub_total bigint NULL, + total_tax_amount bigint NULL, + currency text NULL, + exchange_rate text NULL, + memo text NULL, + id_acc_account uuid NULL, + id_acc_contact uuid NULL, + id_acc_company_info uuid NULL, + remote_id text NULL, + remote_created_at timestamp NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, + tracking_categories text[] NULL, + CONSTRAINT PK_acc_expenses PRIMARY KEY ( id_acc_expense ) +); + +CREATE INDEX FK_acc_account_acc_expense_index ON acc_expenses +( + id_acc_account +); + +CREATE INDEX FK_acc_expense_acc_company_index ON acc_expenses +( + id_acc_company_info +); + +CREATE INDEX FK_acc_expense_acc_contact_index ON acc_expenses +( + id_acc_contact +); + + + +COMMENT ON COLUMN acc_expenses.transaction_date IS 'When the transaction occurred.'; +COMMENT ON COLUMN acc_expenses.remote_created_at IS 'When the expense was created.'; +COMMENT ON COLUMN acc_expenses.tracking_categories IS 'array of id_acc_tracking_category'; + + + + + +-- ************************************** acc_attachments + +CREATE TABLE acc_attachments +( + id_acc_attachment uuid NOT NULL, + file_name text NULL, + file_url text NULL, + remote_id text NULL, + id_acc_account uuid NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_acc_attachments PRIMARY KEY ( id_acc_attachment ) +); + +CREATE INDEX FK_acc_attachments_accountID ON acc_attachments +( + id_acc_account +); + + + + + + + + +-- ************************************** acc_addresses + +CREATE TABLE acc_addresses +( + id_acc_address uuid NOT NULL, + type text NULL, + street_1 text NULL, + street_2 text NULL, + city text NULL, + "state" text NULL, + country_subdivision text NULL, + country text NULL, + zip text NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_acc_contact uuid NULL, + id_acc_company_info uuid NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_acc_addresses PRIMARY KEY ( id_acc_address ) +); + +CREATE INDEX FK_acc_company_info_acc_adresses ON acc_addresses +( + id_acc_company_info +); + +CREATE INDEX FK_acc_contact_acc_addresses ON acc_addresses +( + id_acc_contact +); + +COMMENT ON TABLE acc_addresses IS 'The Address object is used to represent a contact''s or company''s address.'; + +COMMENT ON COLUMN acc_addresses.type IS 'can be SHIPPING, BILLING, OFFICES, PO....'; +COMMENT ON COLUMN acc_addresses."state" IS 'can also be a region'; +COMMENT ON COLUMN acc_addresses.country_subdivision IS 'Also called a "departement" in some countries (ex: france)'; +COMMENT ON COLUMN acc_addresses.id_acc_contact IS 'contains a value if the acc_address belongs to an acc_contact object'; +COMMENT ON COLUMN acc_addresses.id_acc_company_info IS 'contains a value if the acc_address belongs to an acc_company_info object'; + + + + + -- ************************************** tcg_attachments CREATE TABLE tcg_attachments @@ -1972,6 +2880,7 @@ CREATE TABLE ats_scorecards submitted_at timestamp NULL, created_at timestamp NOT NULL, modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, CONSTRAINT PK_ats_scorecards PRIMARY KEY ( id_ats_scorecard ) ); @@ -1995,6 +2904,132 @@ COMMENT ON COLUMN ats_scorecards.id_ats_interview IS 'The interview being scored +-- ************************************** acc_payments + +CREATE TABLE acc_payments +( + id_acc_payment uuid NOT NULL, + id_acc_invoice uuid NULL, + transaction_date timestamp NULL, + id_acc_contact uuid NULL, + id_acc_account uuid NULL, + currency text NULL, + exchange_rate text NULL, + total_amount bigint NULL, + type text NULL, + remote_updated_at timestamp NULL, + id_acc_company_info uuid NULL, + id_acc_accounting_period uuid NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, + tracking_categories text[] NULL, + CONSTRAINT PK_acc_payments PRIMARY KEY ( id_acc_payment ) +); + +CREATE INDEX FK_acc_payment_acc_account_index ON acc_payments +( + id_acc_account +); + +CREATE INDEX FK_acc_payment_acc_company_index ON acc_payments +( + id_acc_company_info +); + +CREATE INDEX FK_acc_payment_acc_contact ON acc_payments +( + id_acc_contact +); + +CREATE INDEX FK_acc_payment_accounting_period_index ON acc_payments +( + id_acc_accounting_period +); + +CREATE INDEX FK_acc_payment_invoiceID ON acc_payments +( + id_acc_invoice +); + + + +COMMENT ON COLUMN acc_payments.id_acc_contact IS 'The supplier, or customer involved in the payment.'; +COMMENT ON COLUMN acc_payments.id_acc_account IS 'The supplier’s or customer’s account in which the payment is made.'; +COMMENT ON COLUMN acc_payments.type IS 'The type of the invoice. Possible values include: ACCOUNTS_PAYABLE, ACCOUNTS_RECEIVABLE. In cases where there is no clear mapping, the original value passed through will be returned.'; +COMMENT ON COLUMN acc_payments.id_acc_company_info IS 'The company the payment belongs to.'; + + + + + +-- ************************************** acc_invoices_line_items + +CREATE TABLE acc_invoices_line_items +( + id_acc_invoices_line_item uuid NOT NULL, + remote_id text NULL, + description text NULL, + unit_price bigint NULL, + quantity bigint NULL, + total_amount bigint NULL, + currency text NULL, + exchange_rate text NULL, + id_acc_invoice uuid NOT NULL, + id_acc_item uuid NOT NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, + acc_tracking_categories text[] NULL, + CONSTRAINT PK_acc_invoices_line_items PRIMARY KEY ( id_acc_invoices_line_item ) +); + +CREATE INDEX FK_acc_invoice_line_items_index ON acc_invoices_line_items +( + id_acc_invoice +); + +CREATE INDEX FK_acc_items_lines_invoice_index ON acc_invoices_line_items +( + id_acc_item +); + + + + + + + + +-- ************************************** acc_expense_lines + +CREATE TABLE acc_expense_lines +( + id_acc_expense_line uuid NOT NULL, + id_acc_expense uuid NOT NULL, + remote_id text NULL, + net_amount bigint NULL, + currency text NULL, + description text NULL, + exchange_rate text NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_1 PRIMARY KEY ( id_acc_expense_line ) +); + +CREATE INDEX FK_acc_expense_expense_lines_index ON acc_expense_lines +( + id_acc_expense +); + + + + + + + + -- ************************************** webhook_delivery_attempts CREATE TABLE webhook_delivery_attempts @@ -2076,3 +3111,33 @@ COMMENT ON COLUMN jobs_status_history.new_status IS 'pending, retry_scheduled, f + +-- ************************************** acc_payments_line_items + +CREATE TABLE acc_payments_line_items +( + acc_payments_line_item uuid NOT NULL, + id_acc_payment uuid NOT NULL, + applied_amount bigint NULL, + applied_date timestamp NULL, + related_object_id uuid NULL, + related_object_type text NULL, + remote_id text NULL, + created_at timestamp NOT NULL, + modified_at timestamp NOT NULL, + id_connection uuid NOT NULL, + CONSTRAINT PK_acc_payments_line_items PRIMARY KEY ( acc_payments_line_item ) +); + +CREATE INDEX FK_acc_payment_line_items_index ON acc_payments_line_items +( + id_acc_payment +); + + + +COMMENT ON COLUMN acc_payments_line_items.related_object_type IS 'can either be a Invoice, CreditNote, or JournalEntry'; + + + +