From 556c49e53d10155c4ea648324f8e8d2aadb1682c Mon Sep 17 00:00:00 2001 From: Lucas Tettamanti <757326+lkzwieder@users.noreply.github.com> Date: Fri, 2 Jan 2026 15:31:10 -0300 Subject: [PATCH] migrations for 2 tables --- .../20260102182136_tenant_ecommerce_config.sql | 18 ++++++++++++++++++ .../20260102182938_wa_identity_map_change.sql | 13 +++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 db/migrations/20260102182136_tenant_ecommerce_config.sql create mode 100644 db/migrations/20260102182938_wa_identity_map_change.sql diff --git a/db/migrations/20260102182136_tenant_ecommerce_config.sql b/db/migrations/20260102182136_tenant_ecommerce_config.sql new file mode 100644 index 0000000..f28b682 --- /dev/null +++ b/db/migrations/20260102182136_tenant_ecommerce_config.sql @@ -0,0 +1,18 @@ +-- migrate:up +CREATE TABLE tenant_ecommerce_config ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid(), + tenant_id uuid NOT NULL REFERENCES tenants(id) ON DELETE CASCADE, + provider text NOT NULL CHECK (provider IN ('woo', 'shopify', 'custom', 'none')), + base_url text NOT NULL, + credential_key text NOT NULL, + credential_secret text NOT NULL, + api_version text, + timeout_ms integer DEFAULT 8000, + enabled boolean DEFAULT true, + created_at timestamptz NOT NULL DEFAULT now(), + updated_at timestamptz NOT NULL DEFAULT now(), + UNIQUE (tenant_id, provider) +); + +-- migrate:down +drop table if exists tenant_ecommerce_config; diff --git a/db/migrations/20260102182938_wa_identity_map_change.sql b/db/migrations/20260102182938_wa_identity_map_change.sql new file mode 100644 index 0000000..a0efe34 --- /dev/null +++ b/db/migrations/20260102182938_wa_identity_map_change.sql @@ -0,0 +1,13 @@ +-- migrate:up +ALTER TABLE wa_identity_map + ADD COLUMN provider text NOT NULL DEFAULT 'woo'; + +ALTER TABLE wa_identity_map + RENAME COLUMN woo_customer_id TO external_customer_id; + +-- migrate:down +ALTER TABLE wa_identity_map + DROP COLUMN provider; + +ALTER TABLE wa_identity_map + RENAME COLUMN external_customer_id TO woo_customer_id;