diff --git a/packages/sync-engine/package.json b/packages/sync-engine/package.json index 524f7f40..111b1aa4 100644 --- a/packages/sync-engine/package.json +++ b/packages/sync-engine/package.json @@ -26,7 +26,6 @@ ], "dependencies": { "pg": "^8.16.3", - "pg-node-migrations": "0.0.8", "yesql": "^7.0.0" }, "peerDependencies": { diff --git a/packages/sync-engine/src/database/migrate.ts b/packages/sync-engine/src/database/migrate.ts index 2ba5f43e..82181f1d 100644 --- a/packages/sync-engine/src/database/migrate.ts +++ b/packages/sync-engine/src/database/migrate.ts @@ -1,66 +1,137 @@ import { Client } from 'pg' -import { migrate } from 'pg-node-migrations' import fs from 'node:fs' -import pino from 'pino' import path from 'node:path' +import type { Logger } from 'pino' import type { ConnectionOptions } from 'node:tls' type MigrationConfig = { schema: string databaseUrl: string ssl?: ConnectionOptions - logger?: pino.Logger + logger?: Logger } -async function connectAndMigrate( - client: Client, - migrationsDirectory: string, - config: MigrationConfig, - logOnError = false -) { - if (!fs.existsSync(migrationsDirectory)) { - config.logger?.info(`Migrations directory ${migrationsDirectory} not found, skipping`) - return - } +const MIGRATION_LOCK_ID = 72987329 +const MIGRATIONS_DIR = path.join(__dirname, 'migrations') - const optionalConfig = { - schemaName: config.schema, - tableName: 'migrations', - } +function parseFileName(fileName: string): { id: number; name: string } | null { + const match = /^(\d+)[-_](.*)\.sql$/i.exec(fileName) + if (!match) return null + return { id: parseInt(match[1], 10), name: match[2] } +} + +export type Migration = { id: number; name: string; sql: string } + +/** + * Returns all migrations with schema placeholders replaced. + * Useful for inspecting migrations or running them manually with psql. + */ +export function getMigrations(schema: string = 'stripe'): Migration[] { + if (!fs.existsSync(MIGRATIONS_DIR)) return [] + + return fs + .readdirSync(MIGRATIONS_DIR) + .filter((f) => f.endsWith('.sql')) + .sort() + .map((fileName) => { + const parsed = parseFileName(fileName) + if (!parsed) return null + + const raw = fs.readFileSync(path.join(MIGRATIONS_DIR, fileName), 'utf8') + const sql = raw.replace(/\{\{schema\}\}/g, schema) + + return { id: parsed.id, name: parsed.name, sql } + }) + .filter((m): m is Migration => m !== null) +} + +/** + * Applies a single migration file within a transaction. + * Supports disabling transactions via `-- postgres-migrations disable-transaction` comment. + */ +async function applyMigration( + client: Client, + tableName: string, + migration: { id: number; name: string; sql: string } +): Promise { + const useTransaction = !migration.sql.includes('-- postgres-migrations disable-transaction') try { - await migrate({ client }, migrationsDirectory, optionalConfig) - } catch (error) { - if (logOnError && error instanceof Error) { - config.logger?.error(error, 'Migration error:') - } else { - throw error + if (useTransaction) await client.query('START TRANSACTION') + await client.query(migration.sql) + await client.query(`INSERT INTO ${tableName} (id, name) VALUES ($1, $2)`, [ + migration.id, + migration.name, + ]) + if (useTransaction) await client.query('COMMIT') + } catch (err) { + if (useTransaction) { + try { + await client.query('ROLLBACK') + } catch { + // Connection may already be broken + } } + throw new Error( + `Migration ${migration.id} (${migration.name}) failed: ${err instanceof Error ? err.message : String(err)}` + ) } } export async function runMigrations(config: MigrationConfig): Promise { - // Init DB const client = new Client({ connectionString: config.databaseUrl, ssl: config.ssl, connectionTimeoutMillis: 10_000, }) + const tableName = `"${config.schema}"."migrations"` + const migrations = getMigrations(config.schema) + try { - // Run migrations await client.connect() - // Ensure schema exists, not doing it via migration to not break current migration checksums - await client.query(`CREATE SCHEMA IF NOT EXISTS ${config.schema};`) + if (migrations.length === 0) { + config.logger?.info(`No migrations found, skipping`) + return + } config.logger?.info('Running migrations') - await connectAndMigrate(client, path.resolve(__dirname, './migrations'), config) + await client.query(`SELECT pg_advisory_lock(${MIGRATION_LOCK_ID})`) + + try { + await client.query(`CREATE SCHEMA IF NOT EXISTS "${config.schema}"`) + + await client.query(` + CREATE TABLE IF NOT EXISTS ${tableName} ( + id integer PRIMARY KEY, + name varchar(100) UNIQUE NOT NULL, + executed_at timestamp DEFAULT current_timestamp + ) + `) + + // Remove legacy hash column from pg-node-migrations (checksums no longer validated) + await client.query(`ALTER TABLE ${tableName} DROP COLUMN IF EXISTS hash`) + + const { rows: applied } = await client.query<{ id: number }>(`SELECT id FROM ${tableName}`) + const appliedIds = new Set(applied.map((r) => r.id)) + + for (const migration of migrations) { + if (appliedIds.has(migration.id)) continue + + config.logger?.info(`Applying migration ${migration.id}: ${migration.name}`) + await applyMigration(client, tableName, migration) + } + } finally { + await client.query(`SELECT pg_advisory_unlock(${MIGRATION_LOCK_ID})`) + } + + config.logger?.info('Finished migrations') } catch (err) { config.logger?.error(err, 'Error running migrations') + throw err } finally { await client.end() - config.logger?.info('Finished migrations') } } diff --git a/packages/sync-engine/src/database/migrations/0001_products.sql b/packages/sync-engine/src/database/migrations/0001_products.sql index 49ee08a7..43975b2d 100644 --- a/packages/sync-engine/src/database/migrations/0001_products.sql +++ b/packages/sync-engine/src/database/migrations/0001_products.sql @@ -1,4 +1,4 @@ -create table if not exists "stripe"."products" ( +create table if not exists "{{schema}}"."products" ( "id" text primary key, "object" text, "active" boolean, diff --git a/packages/sync-engine/src/database/migrations/0002_customers.sql b/packages/sync-engine/src/database/migrations/0002_customers.sql index c8132f0e..8ff0af09 100644 --- a/packages/sync-engine/src/database/migrations/0002_customers.sql +++ b/packages/sync-engine/src/database/migrations/0002_customers.sql @@ -1,4 +1,4 @@ -create table if not exists "stripe"."customers" ( +create table if not exists "{{schema}}"."customers" ( "id" text primary key, "object" text, "address" jsonb, diff --git a/packages/sync-engine/src/database/migrations/0003_prices.sql b/packages/sync-engine/src/database/migrations/0003_prices.sql index e133637a..219f55bb 100644 --- a/packages/sync-engine/src/database/migrations/0003_prices.sql +++ b/packages/sync-engine/src/database/migrations/0003_prices.sql @@ -1,17 +1,24 @@ DO $$ BEGIN - IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'pricing_type') THEN - create type "stripe"."pricing_type" as enum ('one_time', 'recurring'); + IF NOT EXISTS ( + SELECT 1 FROM pg_type t + JOIN pg_namespace n ON t.typnamespace = n.oid + WHERE t.typname = 'pricing_type' AND n.nspname = '{{schema}}' + ) THEN + create type "{{schema}}"."pricing_type" as enum ('one_time', 'recurring'); END IF; - IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'pricing_tiers') THEN - create type "stripe"."pricing_tiers" as enum ('graduated', 'volume'); + IF NOT EXISTS ( + SELECT 1 FROM pg_type t + JOIN pg_namespace n ON t.typnamespace = n.oid + WHERE t.typname = 'pricing_tiers' AND n.nspname = '{{schema}}' + ) THEN + create type "{{schema}}"."pricing_tiers" as enum ('graduated', 'volume'); END IF; - --more types here... END $$; -create table if not exists "stripe"."prices" ( +create table if not exists "{{schema}}"."prices" ( "id" text primary key, "object" text, "active" boolean, @@ -19,16 +26,16 @@ create table if not exists "stripe"."prices" ( "metadata" jsonb, "nickname" text, "recurring" jsonb, - "type" stripe.pricing_type, + "type" "{{schema}}"."pricing_type", "unit_amount" integer, "billing_scheme" text, "created" integer, "livemode" boolean, "lookup_key" text, - "tiers_mode" stripe.pricing_tiers, + "tiers_mode" "{{schema}}"."pricing_tiers", "transform_quantity" jsonb, "unit_amount_decimal" text, - "product" text references stripe.products + "product" text references "{{schema}}"."products" ); diff --git a/packages/sync-engine/src/database/migrations/0004_subscriptions.sql b/packages/sync-engine/src/database/migrations/0004_subscriptions.sql index bd9e5753..6e95f306 100644 --- a/packages/sync-engine/src/database/migrations/0004_subscriptions.sql +++ b/packages/sync-engine/src/database/migrations/0004_subscriptions.sql @@ -1,8 +1,12 @@ DO $$ BEGIN - IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'subscription_status') THEN - create type "stripe"."subscription_status" as enum ( + IF NOT EXISTS ( + SELECT 1 FROM pg_type t + JOIN pg_namespace n ON t.typnamespace = n.oid + WHERE t.typname = 'subscription_status' AND n.nspname = '{{schema}}' + ) THEN + create type "{{schema}}"."subscription_status" as enum ( 'trialing', 'active', 'canceled', @@ -15,7 +19,7 @@ BEGIN END $$; -create table if not exists "stripe"."subscriptions" ( +create table if not exists "{{schema}}"."subscriptions" ( "id" text primary key, "object" text, "cancel_at_period_end" boolean, @@ -26,7 +30,7 @@ create table if not exists "stripe"."subscriptions" ( "metadata" jsonb, "pending_setup_intent" text, "pending_update" jsonb, - "status" "stripe"."subscription_status", + "status" "{{schema}}"."subscription_status", "application_fee_percent" double precision, "billing_cycle_anchor" integer, "billing_thresholds" jsonb, @@ -49,7 +53,7 @@ create table if not exists "stripe"."subscriptions" ( "trial_start" jsonb, "schedule" text, - "customer" text references "stripe"."customers", + "customer" text references "{{schema}}"."customers", "latest_invoice" text, -- not yet joined "plan" text -- not yet joined ); diff --git a/packages/sync-engine/src/database/migrations/0005_invoices.sql b/packages/sync-engine/src/database/migrations/0005_invoices.sql index 0b664eda..13482f91 100644 --- a/packages/sync-engine/src/database/migrations/0005_invoices.sql +++ b/packages/sync-engine/src/database/migrations/0005_invoices.sql @@ -1,14 +1,18 @@ DO $$ BEGIN - IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'invoice_status') THEN - create type "stripe"."invoice_status" as enum ('draft', 'open', 'paid', 'uncollectible', 'void'); + IF NOT EXISTS ( + SELECT 1 FROM pg_type t + JOIN pg_namespace n ON t.typnamespace = n.oid + WHERE t.typname = 'invoice_status' AND n.nspname = '{{schema}}' + ) THEN + create type "{{schema}}"."invoice_status" as enum ('draft', 'open', 'paid', 'uncollectible', 'void'); END IF; END $$; -create table if not exists "stripe"."invoices" ( +create table if not exists "{{schema}}"."invoices" ( "id" text primary key, "object" text, "auto_advance" boolean, @@ -20,7 +24,7 @@ create table if not exists "stripe"."invoices" ( "metadata" jsonb, "period_end" integer, "period_start" integer, - "status" "stripe"."invoice_status", + "status" "{{schema}}"."invoice_status", "total" bigint, "account_country" text, "account_name" text, @@ -67,8 +71,8 @@ create table if not exists "stripe"."invoices" ( "transfer_data" jsonb, "webhooks_delivered_at" integer, - "customer" text references "stripe"."customers", - "subscription" text references "stripe"."subscriptions", + "customer" text references "{{schema}}"."customers", + "subscription" text references "{{schema}}"."subscriptions", "payment_intent" text, -- not yet implemented "default_payment_method" text, -- not yet implemented "default_source" text, -- not yet implemented diff --git a/packages/sync-engine/src/database/migrations/0006_charges.sql b/packages/sync-engine/src/database/migrations/0006_charges.sql index c364a6c7..24839bf8 100644 --- a/packages/sync-engine/src/database/migrations/0006_charges.sql +++ b/packages/sync-engine/src/database/migrations/0006_charges.sql @@ -1,5 +1,5 @@ -create table if not exists "stripe".charges ( +create table if not exists "{{schema}}"."charges" ( id text primary key, object text, card jsonb, diff --git a/packages/sync-engine/src/database/migrations/0007_coupons.sql b/packages/sync-engine/src/database/migrations/0007_coupons.sql index 78a90d3a..afba349c 100644 --- a/packages/sync-engine/src/database/migrations/0007_coupons.sql +++ b/packages/sync-engine/src/database/migrations/0007_coupons.sql @@ -1,4 +1,4 @@ -create table if not exists "stripe".coupons ( +create table if not exists "{{schema}}"."coupons" ( id text primary key, object text, name text, diff --git a/packages/sync-engine/src/database/migrations/0008_disputes.sql b/packages/sync-engine/src/database/migrations/0008_disputes.sql index 6d2e38e0..a37f519c 100644 --- a/packages/sync-engine/src/database/migrations/0008_disputes.sql +++ b/packages/sync-engine/src/database/migrations/0008_disputes.sql @@ -1,4 +1,4 @@ -create table if not exists "stripe".disputes ( +create table if not exists "{{schema}}"."disputes" ( id text primary key, object text, amount bigint, diff --git a/packages/sync-engine/src/database/migrations/0009_events.sql b/packages/sync-engine/src/database/migrations/0009_events.sql index bdc984fb..190d51ae 100644 --- a/packages/sync-engine/src/database/migrations/0009_events.sql +++ b/packages/sync-engine/src/database/migrations/0009_events.sql @@ -1,4 +1,4 @@ -create table if not exists "stripe".events ( +create table if not exists "{{schema}}"."events" ( id text primary key, object text, data jsonb, diff --git a/packages/sync-engine/src/database/migrations/0010_payouts.sql b/packages/sync-engine/src/database/migrations/0010_payouts.sql index 6bf4e599..d2ff2f38 100644 --- a/packages/sync-engine/src/database/migrations/0010_payouts.sql +++ b/packages/sync-engine/src/database/migrations/0010_payouts.sql @@ -1,4 +1,4 @@ -create table if not exists "stripe".payouts ( +create table if not exists "{{schema}}"."payouts" ( id text primary key, object text, date text, diff --git a/packages/sync-engine/src/database/migrations/0011_plans.sql b/packages/sync-engine/src/database/migrations/0011_plans.sql index 9551c44d..dad0fab0 100644 --- a/packages/sync-engine/src/database/migrations/0011_plans.sql +++ b/packages/sync-engine/src/database/migrations/0011_plans.sql @@ -1,4 +1,4 @@ -create table if not exists "stripe"."plans" ( +create table if not exists "{{schema}}"."plans" ( id text primary key, object text, name text, diff --git a/packages/sync-engine/src/database/migrations/0012_add_updated_at.sql b/packages/sync-engine/src/database/migrations/0012_add_updated_at.sql index 81837c2f..b68f9926 100644 --- a/packages/sync-engine/src/database/migrations/0012_add_updated_at.sql +++ b/packages/sync-engine/src/database/migrations/0012_add_updated_at.sql @@ -8,103 +8,101 @@ begin end; $$; -alter function set_updated_at() owner to postgres; - -alter table stripe.subscriptions +alter table "{{schema}}"."subscriptions" add updated_at timestamptz default timezone('utc'::text, now()) not null; create trigger handle_updated_at before update - on stripe.subscriptions + on "{{schema}}"."subscriptions" for each row execute procedure set_updated_at(); -alter table stripe.products +alter table "{{schema}}"."products" add updated_at timestamptz default timezone('utc'::text, now()) not null; create trigger handle_updated_at before update - on stripe.products + on "{{schema}}"."products" for each row execute procedure set_updated_at(); -alter table stripe.customers +alter table "{{schema}}"."customers" add updated_at timestamptz default timezone('utc'::text, now()) not null; create trigger handle_updated_at before update - on stripe.customers + on "{{schema}}"."customers" for each row execute procedure set_updated_at(); -alter table stripe.prices +alter table "{{schema}}"."prices" add updated_at timestamptz default timezone('utc'::text, now()) not null; create trigger handle_updated_at before update - on stripe.prices + on "{{schema}}"."prices" for each row execute procedure set_updated_at(); -alter table stripe.invoices +alter table "{{schema}}"."invoices" add updated_at timestamptz default timezone('utc'::text, now()) not null; create trigger handle_updated_at before update - on stripe.invoices + on "{{schema}}"."invoices" for each row execute procedure set_updated_at(); -alter table stripe.charges +alter table "{{schema}}"."charges" add updated_at timestamptz default timezone('utc'::text, now()) not null; create trigger handle_updated_at before update - on stripe.charges + on "{{schema}}"."charges" for each row execute procedure set_updated_at(); -alter table stripe.coupons +alter table "{{schema}}"."coupons" add updated_at timestamptz default timezone('utc'::text, now()) not null; create trigger handle_updated_at before update - on stripe.coupons + on "{{schema}}"."coupons" for each row execute procedure set_updated_at(); -alter table stripe.disputes +alter table "{{schema}}"."disputes" add updated_at timestamptz default timezone('utc'::text, now()) not null; create trigger handle_updated_at before update - on stripe.disputes + on "{{schema}}"."disputes" for each row execute procedure set_updated_at(); -alter table stripe.events +alter table "{{schema}}"."events" add updated_at timestamptz default timezone('utc'::text, now()) not null; create trigger handle_updated_at before update - on stripe.events + on "{{schema}}"."events" for each row execute procedure set_updated_at(); -alter table stripe.payouts +alter table "{{schema}}"."payouts" add updated_at timestamptz default timezone('utc'::text, now()) not null; create trigger handle_updated_at before update - on stripe.payouts + on "{{schema}}"."payouts" for each row execute procedure set_updated_at(); -alter table stripe.plans +alter table "{{schema}}"."plans" add updated_at timestamptz default timezone('utc'::text, now()) not null; create trigger handle_updated_at before update - on stripe.plans + on "{{schema}}"."plans" for each row execute procedure set_updated_at(); diff --git a/packages/sync-engine/src/database/migrations/0013_add_subscription_items.sql b/packages/sync-engine/src/database/migrations/0013_add_subscription_items.sql index ff1c40b7..ec8a271e 100644 --- a/packages/sync-engine/src/database/migrations/0013_add_subscription_items.sql +++ b/packages/sync-engine/src/database/migrations/0013_add_subscription_items.sql @@ -1,4 +1,4 @@ -create table if not exists "stripe"."subscription_items" ( +create table if not exists "{{schema}}"."subscription_items" ( "id" text primary key, "object" text, "billing_thresholds" jsonb, @@ -6,7 +6,7 @@ create table if not exists "stripe"."subscription_items" ( "deleted" boolean, "metadata" jsonb, "quantity" integer, - "price" text references "stripe"."prices", - "subscription" text references "stripe"."subscriptions", + "price" text references "{{schema}}"."prices", + "subscription" text references "{{schema}}"."subscriptions", "tax_rates" jsonb ); \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0014_migrate_subscription_items.sql b/packages/sync-engine/src/database/migrations/0014_migrate_subscription_items.sql index c593957a..1e00c9e9 100644 --- a/packages/sync-engine/src/database/migrations/0014_migrate_subscription_items.sql +++ b/packages/sync-engine/src/database/migrations/0014_migrate_subscription_items.sql @@ -1,7 +1,7 @@ WITH subscriptions AS ( - select jsonb_array_elements(items->'data') as obj from "stripe"."subscriptions" + select jsonb_array_elements(items->'data') as obj from "{{schema}}"."subscriptions" ) -insert into "stripe"."subscription_items" +insert into "{{schema}}"."subscription_items" select obj->>'id' as "id", obj->>'object' as "object", obj->'billing_thresholds' as "billing_thresholds", diff --git a/packages/sync-engine/src/database/migrations/0015_add_customer_deleted.sql b/packages/sync-engine/src/database/migrations/0015_add_customer_deleted.sql index 23c0fc3d..ad09fedf 100644 --- a/packages/sync-engine/src/database/migrations/0015_add_customer_deleted.sql +++ b/packages/sync-engine/src/database/migrations/0015_add_customer_deleted.sql @@ -1,2 +1,2 @@ -alter table stripe.customers +alter table "{{schema}}"."customers" add deleted boolean default false not null; \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0016_add_invoice_indexes.sql b/packages/sync-engine/src/database/migrations/0016_add_invoice_indexes.sql index a4b8c3a0..96fff55c 100644 --- a/packages/sync-engine/src/database/migrations/0016_add_invoice_indexes.sql +++ b/packages/sync-engine/src/database/migrations/0016_add_invoice_indexes.sql @@ -1,2 +1,2 @@ -CREATE INDEX stripe_invoices_customer_idx ON "stripe"."invoices" USING btree (customer); -CREATE INDEX stripe_invoices_subscription_idx ON "stripe"."invoices" USING btree (subscription); \ No newline at end of file +CREATE INDEX stripe_invoices_customer_idx ON "{{schema}}"."invoices" USING btree (customer); +CREATE INDEX stripe_invoices_subscription_idx ON "{{schema}}"."invoices" USING btree (subscription); \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0017_drop_charges_unavailable_columns.sql b/packages/sync-engine/src/database/migrations/0017_drop_charges_unavailable_columns.sql index 4874897e..36356b4b 100644 --- a/packages/sync-engine/src/database/migrations/0017_drop_charges_unavailable_columns.sql +++ b/packages/sync-engine/src/database/migrations/0017_drop_charges_unavailable_columns.sql @@ -1,6 +1,6 @@ -- drop columns that are duplicated / not available anymore -- card is not available on webhook v.2020-03-02. We can get the detail from payment_method_details -- statement_description is not available on webhook v.2020-03-02 -alter table "stripe"."charges" +alter table "{{schema}}"."charges" drop column if exists "card", drop column if exists "statement_description"; \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0018_setup_intents.sql b/packages/sync-engine/src/database/migrations/0018_setup_intents.sql index 8a85f8a2..2f9b0b40 100644 --- a/packages/sync-engine/src/database/migrations/0018_setup_intents.sql +++ b/packages/sync-engine/src/database/migrations/0018_setup_intents.sql @@ -1,4 +1,4 @@ -create table if not exists "stripe"."setup_intents" ( +create table if not exists "{{schema}}"."setup_intents" ( id text primary key, object text, created integer, @@ -14,4 +14,4 @@ create table if not exists "stripe"."setup_intents" ( on_behalf_of text ); -CREATE INDEX stripe_setup_intents_customer_idx ON "stripe"."setup_intents" USING btree (customer); \ No newline at end of file +CREATE INDEX stripe_setup_intents_customer_idx ON "{{schema}}"."setup_intents" USING btree (customer); \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0019_payment_methods.sql b/packages/sync-engine/src/database/migrations/0019_payment_methods.sql index 4040544a..d99bca66 100644 --- a/packages/sync-engine/src/database/migrations/0019_payment_methods.sql +++ b/packages/sync-engine/src/database/migrations/0019_payment_methods.sql @@ -1,4 +1,4 @@ -create table if not exists "stripe"."payment_methods" ( +create table if not exists "{{schema}}"."payment_methods" ( id text primary key, object text, created integer, @@ -9,4 +9,4 @@ create table if not exists "stripe"."payment_methods" ( card jsonb ); -CREATE INDEX stripe_payment_methods_customer_idx ON "stripe"."payment_methods" USING btree (customer); \ No newline at end of file +CREATE INDEX stripe_payment_methods_customer_idx ON "{{schema}}"."payment_methods" USING btree (customer); \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0020_disputes_payment_intent_created_idx.sql b/packages/sync-engine/src/database/migrations/0020_disputes_payment_intent_created_idx.sql index a6ad6584..d887e999 100644 --- a/packages/sync-engine/src/database/migrations/0020_disputes_payment_intent_created_idx.sql +++ b/packages/sync-engine/src/database/migrations/0020_disputes_payment_intent_created_idx.sql @@ -1,3 +1,3 @@ -ALTER TABLE "stripe"."disputes" ADD COLUMN IF NOT EXISTS payment_intent TEXT; +ALTER TABLE "{{schema}}"."disputes" ADD COLUMN IF NOT EXISTS payment_intent TEXT; -CREATE INDEX IF NOT EXISTS stripe_dispute_created_idx ON "stripe"."disputes" USING btree (created); \ No newline at end of file +CREATE INDEX IF NOT EXISTS stripe_dispute_created_idx ON "{{schema}}"."disputes" USING btree (created); \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0021_payment_intent.sql b/packages/sync-engine/src/database/migrations/0021_payment_intent.sql index a4b8853a..369d4b73 100644 --- a/packages/sync-engine/src/database/migrations/0021_payment_intent.sql +++ b/packages/sync-engine/src/database/migrations/0021_payment_intent.sql @@ -1,4 +1,4 @@ -create table if not exists "stripe"."payment_intents" ( +create table if not exists "{{schema}}"."payment_intents" ( id text primary key, object text, amount integer, @@ -38,5 +38,5 @@ create table if not exists "stripe"."payment_intents" ( transfer_group text ); -CREATE INDEX stripe_payment_intents_customer_idx ON "stripe"."payment_intents" USING btree (customer); -CREATE INDEX stripe_payment_intents_invoice_idx ON "stripe"."payment_intents" USING btree (invoice); \ No newline at end of file +CREATE INDEX stripe_payment_intents_customer_idx ON "{{schema}}"."payment_intents" USING btree (customer); +CREATE INDEX stripe_payment_intents_invoice_idx ON "{{schema}}"."payment_intents" USING btree (invoice); \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0022_adjust_plans.sql b/packages/sync-engine/src/database/migrations/0022_adjust_plans.sql index eb8decbb..559c8372 100644 --- a/packages/sync-engine/src/database/migrations/0022_adjust_plans.sql +++ b/packages/sync-engine/src/database/migrations/0022_adjust_plans.sql @@ -1,5 +1,5 @@ -ALTER TABLE if exists "stripe"."plans" DROP COLUMN name; -ALTER TABLE if exists "stripe"."plans" DROP COLUMN updated; -ALTER TABLE if exists "stripe"."plans" DROP COLUMN tiers; -ALTER TABLE if exists "stripe"."plans" DROP COLUMN statement_descriptor; -ALTER TABLE if exists "stripe"."plans" DROP COLUMN statement_description; \ No newline at end of file +ALTER TABLE if exists "{{schema}}"."plans" DROP COLUMN name; +ALTER TABLE if exists "{{schema}}"."plans" DROP COLUMN updated; +ALTER TABLE if exists "{{schema}}"."plans" DROP COLUMN tiers; +ALTER TABLE if exists "{{schema}}"."plans" DROP COLUMN statement_descriptor; +ALTER TABLE if exists "{{schema}}"."plans" DROP COLUMN statement_description; \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0023_invoice_deleted.sql b/packages/sync-engine/src/database/migrations/0023_invoice_deleted.sql index 238f1b53..1b295578 100644 --- a/packages/sync-engine/src/database/migrations/0023_invoice_deleted.sql +++ b/packages/sync-engine/src/database/migrations/0023_invoice_deleted.sql @@ -1 +1 @@ -ALTER TYPE "stripe"."invoice_status" ADD VALUE 'deleted'; \ No newline at end of file +ALTER TYPE "{{schema}}"."invoice_status" ADD VALUE 'deleted'; \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0024_subscription_schedules.sql b/packages/sync-engine/src/database/migrations/0024_subscription_schedules.sql index a095509b..501eb6ea 100644 --- a/packages/sync-engine/src/database/migrations/0024_subscription_schedules.sql +++ b/packages/sync-engine/src/database/migrations/0024_subscription_schedules.sql @@ -1,13 +1,17 @@ -do $$ +DO $$ BEGIN - IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'subscription_schedule_status') THEN - create type "stripe"."subscription_schedule_status" as enum ('not_started', 'active', 'completed', 'released', 'canceled'); + IF NOT EXISTS ( + SELECT 1 FROM pg_type t + JOIN pg_namespace n ON t.typnamespace = n.oid + WHERE t.typname = 'subscription_schedule_status' AND n.nspname = '{{schema}}' + ) THEN + create type "{{schema}}"."subscription_schedule_status" as enum ('not_started', 'active', 'completed', 'released', 'canceled'); END IF; END $$; create table if not exists - "stripe"."subscription_schedules" ( + "{{schema}}"."subscription_schedules" ( id text primary key, object text, application text, @@ -23,7 +27,7 @@ create table if not exists phases jsonb not null, released_at integer, released_subscription text, - status stripe.subscription_schedule_status not null, + status "{{schema}}"."subscription_schedule_status" not null, subscription text, test_clock text ); \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0025_tax_ids.sql b/packages/sync-engine/src/database/migrations/0025_tax_ids.sql index c0d063a0..34c55354 100644 --- a/packages/sync-engine/src/database/migrations/0025_tax_ids.sql +++ b/packages/sync-engine/src/database/migrations/0025_tax_ids.sql @@ -1,5 +1,5 @@ create table if not exists - "stripe"."tax_ids" ( + "{{schema}}"."tax_ids" ( "id" text primary key, "object" text, "country" text, @@ -11,4 +11,4 @@ create table if not exists "owner" jsonb ); -create index stripe_tax_ids_customer_idx on "stripe"."tax_ids" using btree (customer); \ No newline at end of file +create index stripe_tax_ids_customer_idx on "{{schema}}"."tax_ids" using btree (customer); \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0026_credit_notes.sql b/packages/sync-engine/src/database/migrations/0026_credit_notes.sql index 11b04bf8..8037b6e0 100644 --- a/packages/sync-engine/src/database/migrations/0026_credit_notes.sql +++ b/packages/sync-engine/src/database/migrations/0026_credit_notes.sql @@ -1,5 +1,5 @@ create table if not exists - "stripe"."credit_notes" ( + "{{schema}}"."credit_notes" ( "id" text primary key, object text, amount integer, @@ -31,6 +31,6 @@ create table if not exists voided_at text ); -create index stripe_credit_notes_customer_idx on "stripe"."credit_notes" using btree (customer); +create index stripe_credit_notes_customer_idx on "{{schema}}"."credit_notes" using btree (customer); -create index stripe_credit_notes_invoice_idx on "stripe"."credit_notes" using btree (invoice); \ No newline at end of file +create index stripe_credit_notes_invoice_idx on "{{schema}}"."credit_notes" using btree (invoice); \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0027_add_marketing_features_to_products.sql b/packages/sync-engine/src/database/migrations/0027_add_marketing_features_to_products.sql index 3cff7d72..dfef5e87 100644 --- a/packages/sync-engine/src/database/migrations/0027_add_marketing_features_to_products.sql +++ b/packages/sync-engine/src/database/migrations/0027_add_marketing_features_to_products.sql @@ -1,2 +1,2 @@ -ALTER TABLE IF EXISTS stripe.products ADD COLUMN IF NOT EXISTS marketing_features JSONB; +ALTER TABLE IF EXISTS "{{schema}}"."products" ADD COLUMN IF NOT EXISTS marketing_features JSONB; diff --git a/packages/sync-engine/src/database/migrations/0028_early_fraud_warning.sql b/packages/sync-engine/src/database/migrations/0028_early_fraud_warning.sql index 603b595a..4061c144 100644 --- a/packages/sync-engine/src/database/migrations/0028_early_fraud_warning.sql +++ b/packages/sync-engine/src/database/migrations/0028_early_fraud_warning.sql @@ -1,5 +1,5 @@ create table - if not exists "stripe"."early_fraud_warnings" ( + if not exists "{{schema}}"."early_fraud_warnings" ( "id" text primary key, object text, actionable boolean, @@ -11,12 +11,12 @@ create table updated_at timestamptz default timezone('utc'::text, now()) not null ); -create index stripe_early_fraud_warnings_charge_idx on "stripe"."early_fraud_warnings" using btree (charge); +create index stripe_early_fraud_warnings_charge_idx on "{{schema}}"."early_fraud_warnings" using btree (charge); -create index stripe_early_fraud_warnings_payment_intent_idx on "stripe"."early_fraud_warnings" using btree (payment_intent); +create index stripe_early_fraud_warnings_payment_intent_idx on "{{schema}}"."early_fraud_warnings" using btree (payment_intent); create trigger handle_updated_at before update - on stripe.early_fraud_warnings + on "{{schema}}"."early_fraud_warnings" for each row execute procedure set_updated_at(); diff --git a/packages/sync-engine/src/database/migrations/0029_reviews.sql b/packages/sync-engine/src/database/migrations/0029_reviews.sql index af254bec..234485fa 100644 --- a/packages/sync-engine/src/database/migrations/0029_reviews.sql +++ b/packages/sync-engine/src/database/migrations/0029_reviews.sql @@ -1,5 +1,5 @@ create table - if not exists "stripe"."reviews" ( + if not exists "{{schema}}"."reviews" ( "id" text primary key, object text, billing_zip text, @@ -17,12 +17,12 @@ create table updated_at timestamptz default timezone('utc'::text, now()) not null ); -create index stripe_reviews_charge_idx on "stripe"."reviews" using btree (charge); +create index stripe_reviews_charge_idx on "{{schema}}"."reviews" using btree (charge); -create index stripe_reviews_payment_intent_idx on "stripe"."reviews" using btree (payment_intent); +create index stripe_reviews_payment_intent_idx on "{{schema}}"."reviews" using btree (payment_intent); create trigger handle_updated_at before update - on stripe.reviews + on "{{schema}}"."reviews" for each row execute procedure set_updated_at(); diff --git a/packages/sync-engine/src/database/migrations/0030_refunds.sql b/packages/sync-engine/src/database/migrations/0030_refunds.sql index aa243495..47bcbfb5 100644 --- a/packages/sync-engine/src/database/migrations/0030_refunds.sql +++ b/packages/sync-engine/src/database/migrations/0030_refunds.sql @@ -1,5 +1,5 @@ create table - if not exists "stripe"."refunds" ( + if not exists "{{schema}}"."refunds" ( "id" text primary key, object text, amount integer, @@ -18,12 +18,12 @@ create table updated_at timestamptz default timezone('utc'::text, now()) not null ); -create index stripe_refunds_charge_idx on "stripe"."refunds" using btree (charge); +create index stripe_refunds_charge_idx on "{{schema}}"."refunds" using btree (charge); -create index stripe_refunds_payment_intent_idx on "stripe"."refunds" using btree (payment_intent); +create index stripe_refunds_payment_intent_idx on "{{schema}}"."refunds" using btree (payment_intent); create trigger handle_updated_at before update - on stripe.refunds + on "{{schema}}"."refunds" for each row execute procedure set_updated_at(); diff --git a/packages/sync-engine/src/database/migrations/0031_add_default_price.sql b/packages/sync-engine/src/database/migrations/0031_add_default_price.sql index 26f662c4..5e922890 100644 --- a/packages/sync-engine/src/database/migrations/0031_add_default_price.sql +++ b/packages/sync-engine/src/database/migrations/0031_add_default_price.sql @@ -1,2 +1,2 @@ -alter table "stripe"."products" +alter table "{{schema}}"."products" add column IF NOT EXISTS "default_price" text; diff --git a/packages/sync-engine/src/database/migrations/0032_update_subscription_items.sql b/packages/sync-engine/src/database/migrations/0032_update_subscription_items.sql index b362e463..69c05b53 100644 --- a/packages/sync-engine/src/database/migrations/0032_update_subscription_items.sql +++ b/packages/sync-engine/src/database/migrations/0032_update_subscription_items.sql @@ -1,3 +1,3 @@ -ALTER TABLE "stripe"."subscription_items" +ALTER TABLE "{{schema}}"."subscription_items" ADD COLUMN IF NOT EXISTS "current_period_end" integer, ADD COLUMN IF NOT EXISTS "current_period_start" integer; diff --git a/packages/sync-engine/src/database/migrations/0033_add_last_synced_at.sql b/packages/sync-engine/src/database/migrations/0033_add_last_synced_at.sql index 7f552fe7..2e59fae8 100644 --- a/packages/sync-engine/src/database/migrations/0033_add_last_synced_at.sql +++ b/packages/sync-engine/src/database/migrations/0033_add_last_synced_at.sql @@ -1,85 +1,85 @@ -- Add last_synced_at column to all Stripe tables for tracking sync status -- Charges -alter table "stripe"."charges" +alter table "{{schema}}"."charges" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Coupons -alter table "stripe"."coupons" +alter table "{{schema}}"."coupons" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Credit Notes -alter table "stripe"."credit_notes" +alter table "{{schema}}"."credit_notes" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Customers -alter table "stripe"."customers" +alter table "{{schema}}"."customers" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Disputes -alter table "stripe"."disputes" +alter table "{{schema}}"."disputes" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Early Fraud Warnings -alter table "stripe"."early_fraud_warnings" +alter table "{{schema}}"."early_fraud_warnings" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Events -alter table "stripe"."events" +alter table "{{schema}}"."events" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Invoices -alter table "stripe"."invoices" +alter table "{{schema}}"."invoices" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Payment Intents -alter table "stripe"."payment_intents" +alter table "{{schema}}"."payment_intents" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Payment Methods -alter table "stripe"."payment_methods" +alter table "{{schema}}"."payment_methods" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Payouts -alter table "stripe"."payouts" +alter table "{{schema}}"."payouts" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Plans -alter table "stripe"."plans" +alter table "{{schema}}"."plans" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Prices -alter table "stripe"."prices" +alter table "{{schema}}"."prices" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Products -alter table "stripe"."products" +alter table "{{schema}}"."products" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Refunds -alter table "stripe"."refunds" +alter table "{{schema}}"."refunds" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Reviews -alter table "stripe"."reviews" +alter table "{{schema}}"."reviews" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Setup Intents -alter table "stripe"."setup_intents" +alter table "{{schema}}"."setup_intents" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Subscription Items -alter table "stripe"."subscription_items" +alter table "{{schema}}"."subscription_items" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Subscription Schedules -alter table "stripe"."subscription_schedules" +alter table "{{schema}}"."subscription_schedules" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Subscriptions -alter table "stripe"."subscriptions" +alter table "{{schema}}"."subscriptions" add column IF NOT EXISTS "last_synced_at" timestamptz; -- Tax IDs -alter table "stripe"."tax_ids" +alter table "{{schema}}"."tax_ids" add column IF NOT EXISTS "last_synced_at" timestamptz; diff --git a/packages/sync-engine/src/database/migrations/0034_remove_foreign_keys.sql b/packages/sync-engine/src/database/migrations/0034_remove_foreign_keys.sql index b4cd73a4..018a18b0 100644 --- a/packages/sync-engine/src/database/migrations/0034_remove_foreign_keys.sql +++ b/packages/sync-engine/src/database/migrations/0034_remove_foreign_keys.sql @@ -1,13 +1,13 @@ -- Remove all foreign key constraints -ALTER TABLE "stripe"."subscriptions" DROP CONSTRAINT IF EXISTS "subscriptions_customer_fkey"; +ALTER TABLE "{{schema}}"."subscriptions" DROP CONSTRAINT IF EXISTS "subscriptions_customer_fkey"; -ALTER TABLE "stripe"."prices" DROP CONSTRAINT IF EXISTS "prices_product_fkey"; +ALTER TABLE "{{schema}}"."prices" DROP CONSTRAINT IF EXISTS "prices_product_fkey"; -ALTER TABLE "stripe"."invoices" DROP CONSTRAINT IF EXISTS "invoices_customer_fkey"; +ALTER TABLE "{{schema}}"."invoices" DROP CONSTRAINT IF EXISTS "invoices_customer_fkey"; -ALTER TABLE "stripe"."invoices" DROP CONSTRAINT IF EXISTS "invoices_subscription_fkey"; +ALTER TABLE "{{schema}}"."invoices" DROP CONSTRAINT IF EXISTS "invoices_subscription_fkey"; -ALTER TABLE "stripe"."subscription_items" DROP CONSTRAINT IF EXISTS "subscription_items_price_fkey"; +ALTER TABLE "{{schema}}"."subscription_items" DROP CONSTRAINT IF EXISTS "subscription_items_price_fkey"; -ALTER TABLE "stripe"."subscription_items" DROP CONSTRAINT IF EXISTS "subscription_items_subscription_fkey"; +ALTER TABLE "{{schema}}"."subscription_items" DROP CONSTRAINT IF EXISTS "subscription_items_subscription_fkey"; diff --git a/packages/sync-engine/src/database/migrations/0035_checkout_sessions.sql b/packages/sync-engine/src/database/migrations/0035_checkout_sessions.sql index 7fe2fb23..fd7c743e 100644 --- a/packages/sync-engine/src/database/migrations/0035_checkout_sessions.sql +++ b/packages/sync-engine/src/database/migrations/0035_checkout_sessions.sql @@ -1,5 +1,5 @@ create table - if not exists "stripe"."checkout_sessions" ( + if not exists "{{schema}}"."checkout_sessions" ( "id" text primary key, "object" text, "adaptive_pricing" jsonb, @@ -65,13 +65,13 @@ create table "last_synced_at" timestamptz ); -create index stripe_checkout_sessions_customer_idx on "stripe"."checkout_sessions" using btree (customer); -create index stripe_checkout_sessions_subscription_idx on "stripe"."checkout_sessions" using btree (subscription); -create index stripe_checkout_sessions_payment_intent_idx on "stripe"."checkout_sessions" using btree (payment_intent); -create index stripe_checkout_sessions_invoice_idx on "stripe"."checkout_sessions" using btree (invoice); +create index stripe_checkout_sessions_customer_idx on "{{schema}}"."checkout_sessions" using btree (customer); +create index stripe_checkout_sessions_subscription_idx on "{{schema}}"."checkout_sessions" using btree (subscription); +create index stripe_checkout_sessions_payment_intent_idx on "{{schema}}"."checkout_sessions" using btree (payment_intent); +create index stripe_checkout_sessions_invoice_idx on "{{schema}}"."checkout_sessions" using btree (invoice); create trigger handle_updated_at before update - on stripe.checkout_sessions + on "{{schema}}"."checkout_sessions" for each row execute procedure set_updated_at(); diff --git a/packages/sync-engine/src/database/migrations/0036_checkout_session_line_items.sql b/packages/sync-engine/src/database/migrations/0036_checkout_session_line_items.sql index 848eb062..d57c591f 100644 --- a/packages/sync-engine/src/database/migrations/0036_checkout_session_line_items.sql +++ b/packages/sync-engine/src/database/migrations/0036_checkout_session_line_items.sql @@ -1,4 +1,4 @@ -create table if not exists "stripe"."checkout_session_line_items" ( +create table if not exists "{{schema}}"."checkout_session_line_items" ( "id" text primary key, "object" text, "amount_discount" integer, @@ -7,18 +7,18 @@ create table if not exists "stripe"."checkout_session_line_items" ( "amount_total" integer, "currency" text, "description" text, - "price" text references "stripe"."prices" on delete cascade, + "price" text references "{{schema}}"."prices" on delete cascade, "quantity" integer, - "checkout_session" text references "stripe"."checkout_sessions" on delete cascade, + "checkout_session" text references "{{schema}}"."checkout_sessions" on delete cascade, "updated_at" timestamptz default timezone('utc'::text, now()) not null, "last_synced_at" timestamptz ); -create index stripe_checkout_session_line_items_session_idx on "stripe"."checkout_session_line_items" using btree (checkout_session); -create index stripe_checkout_session_line_items_price_idx on "stripe"."checkout_session_line_items" using btree (price); +create index stripe_checkout_session_line_items_session_idx on "{{schema}}"."checkout_session_line_items" using btree (checkout_session); +create index stripe_checkout_session_line_items_price_idx on "{{schema}}"."checkout_session_line_items" using btree (price); create trigger handle_updated_at before update - on stripe.checkout_session_line_items + on "{{schema}}"."checkout_session_line_items" for each row execute procedure set_updated_at(); \ No newline at end of file diff --git a/packages/sync-engine/src/database/migrations/0037_add_features.sql b/packages/sync-engine/src/database/migrations/0037_add_features.sql index 73e81b0b..2005b8df 100644 --- a/packages/sync-engine/src/database/migrations/0037_add_features.sql +++ b/packages/sync-engine/src/database/migrations/0037_add_features.sql @@ -1,5 +1,5 @@ create table - if not exists "stripe"."features" ( + if not exists "{{schema}}"."features" ( "id" text primary key, object text, livemode boolean, @@ -13,6 +13,6 @@ create table create trigger handle_updated_at before update - on stripe.features + on "{{schema}}"."features" for each row execute procedure set_updated_at(); diff --git a/packages/sync-engine/src/database/migrations/0038_active_entitlement.sql b/packages/sync-engine/src/database/migrations/0038_active_entitlement.sql index 2a216533..0efc36c5 100644 --- a/packages/sync-engine/src/database/migrations/0038_active_entitlement.sql +++ b/packages/sync-engine/src/database/migrations/0038_active_entitlement.sql @@ -1,5 +1,5 @@ create table - if not exists "stripe"."active_entitlements" ( + if not exists "{{schema}}"."active_entitlements" ( "id" text primary key, "object" text, "livemode" boolean, @@ -10,11 +10,11 @@ create table "last_synced_at" timestamptz ); -create index stripe_active_entitlements_customer_idx on "stripe"."active_entitlements" using btree (customer); -create index stripe_active_entitlements_feature_idx on "stripe"."active_entitlements" using btree (feature); +create index stripe_active_entitlements_customer_idx on "{{schema}}"."active_entitlements" using btree (customer); +create index stripe_active_entitlements_feature_idx on "{{schema}}"."active_entitlements" using btree (feature); create trigger handle_updated_at before update - on stripe.active_entitlements + on "{{schema}}"."active_entitlements" for each row execute procedure set_updated_at(); diff --git a/packages/sync-engine/src/database/migrations/0039_add_paused_to_subscription_status.sql b/packages/sync-engine/src/database/migrations/0039_add_paused_to_subscription_status.sql index 442f6456..ba77a7f9 100644 --- a/packages/sync-engine/src/database/migrations/0039_add_paused_to_subscription_status.sql +++ b/packages/sync-engine/src/database/migrations/0039_add_paused_to_subscription_status.sql @@ -1 +1 @@ -ALTER TYPE "stripe"."subscription_status" ADD VALUE 'paused'; \ No newline at end of file +ALTER TYPE "{{schema}}"."subscription_status" ADD VALUE 'paused'; \ No newline at end of file diff --git a/packages/sync-engine/src/index.ts b/packages/sync-engine/src/index.ts index b463d495..bb75773e 100644 --- a/packages/sync-engine/src/index.ts +++ b/packages/sync-engine/src/index.ts @@ -2,5 +2,5 @@ export { StripeSync } from './stripeSync' export type * from './types' -export { runMigrations } from './database/migrate' +export { runMigrations, getMigrations, type Migration } from './database/migrate' export { PostgresClient } from './database/postgres' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index db5aad99..fd377732 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -91,9 +91,6 @@ importers: pg: specifier: ^8.16.3 version: 8.16.3 - pg-node-migrations: - specifier: 0.0.8 - version: 0.0.8 stripe: specifier: '> 11' version: 18.2.0(@types/node@24.10.1) @@ -1676,11 +1673,6 @@ packages: resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} engines: {node: '>=4.0.0'} - pg-node-migrations@0.0.8: - resolution: {integrity: sha512-44cMl9umOmCv0hzZyEcvjEq8Bm8u7mrzggZ06qXTJVSsMMB4j2OsjG+rSp+uzeKWyP2Vu0K9Ye2wKtjFUJwrdw==} - engines: {node: '>10.17.0'} - hasBin: true - pg-pool@3.10.1: resolution: {integrity: sha512-Tu8jMlcX+9d8+QVzKIvM/uJtp07PKr82IUOYEphaWcoBhIYkoHpLXN3qO59nAI11ripznDsEzEv8nUxBVWajGg==} peerDependencies: @@ -1933,10 +1925,6 @@ packages: resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} engines: {node: '>= 10.x'} - sql-template-strings@2.2.2: - resolution: {integrity: sha512-UXhXR2869FQaD+GMly8jAMCRZ94nU5KcrFetZfWEMd+LVVG6y0ExgHAhatEcKZ/wk8YcKPdi+hiD2wm75lq3/Q==} - engines: {node: '>=4.0.0'} - stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} @@ -3636,13 +3624,6 @@ snapshots: pg-int8@1.0.1: {} - pg-node-migrations@0.0.8: - dependencies: - pg: 8.16.3 - sql-template-strings: 2.2.2 - transitivePeerDependencies: - - pg-native - pg-pool@3.10.1(pg@8.16.3): dependencies: pg: 8.16.3 @@ -3937,8 +3918,6 @@ snapshots: split2@4.2.0: {} - sql-template-strings@2.2.2: {} - stackback@0.0.2: {} statuses@2.0.1: {}