-- migrate:up CREATE EXTENSION IF NOT EXISTS pgcrypto; CREATE TABLE tenants ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), key text NOT NULL UNIQUE, name text NOT NULL, created_at timestamptz NOT NULL DEFAULT now() ); create table wa_identity_map ( tenant_id uuid not null references tenants(id) on delete cascade, wa_chat_id text not null, woo_customer_id bigint not null, created_at timestamptz not null default now(), updated_at timestamptz not null default now(), primary key (tenant_id, wa_chat_id) ); -- migrate:down drop table if exists wa_identity_map; DROP TABLE IF EXISTS tenants; DROP EXTENSION IF EXISTS pgcrypto;