stripe-experiment-sync 1.0.9-beta.1765909347 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,61 +0,0 @@
1
- -- event_timestamp and event_type are not generated columns because they are not immutable.
2
- -- Postgres requires generated expressions to be immutable.
3
-
4
- CREATE TABLE IF NOT EXISTS "stripe"."subscription_item_change_events_v2_beta" (
5
- "_raw_data" jsonb NOT NULL,
6
- "_last_synced_at" timestamptz,
7
- "_updated_at" timestamptz DEFAULT now(),
8
- "_account_id" text NOT NULL,
9
-
10
- "event_timestamp" timestamptz NOT NULL,
11
- "event_type" text NOT NULL,
12
- "subscription_item_id" text NOT NULL,
13
-
14
- PRIMARY KEY ("_account_id", "event_timestamp", "event_type", "subscription_item_id")
15
- );
16
-
17
- -- Foreign key to stripe.accounts
18
- ALTER TABLE "stripe"."subscription_item_change_events_v2_beta"
19
- DROP CONSTRAINT IF EXISTS fk_subscription_item_change_events_v2_beta_account;
20
- ALTER TABLE "stripe"."subscription_item_change_events_v2_beta"
21
- ADD CONSTRAINT fk_subscription_item_change_events_v2_beta_account
22
- FOREIGN KEY ("_account_id") REFERENCES "stripe"."accounts" (id);
23
-
24
- -- Maintain _updated_at on UPDATE
25
- DROP TRIGGER IF EXISTS handle_updated_at ON "stripe"."subscription_item_change_events_v2_beta";
26
- CREATE TRIGGER handle_updated_at
27
- BEFORE UPDATE ON "stripe"."subscription_item_change_events_v2_beta"
28
- FOR EACH ROW EXECUTE FUNCTION set_updated_at();
29
-
30
- ALTER TABLE "stripe"."subscription_item_change_events_v2_beta"
31
- ADD COLUMN IF NOT EXISTS "currency" text
32
- GENERATED ALWAYS AS ((NULLIF(_raw_data->>'currency', ''))::text) STORED;
33
-
34
- ALTER TABLE "stripe"."subscription_item_change_events_v2_beta"
35
- ADD COLUMN IF NOT EXISTS "mrr_change" bigint
36
- GENERATED ALWAYS AS ((NULLIF(_raw_data->>'mrr_change', ''))::bigint) STORED;
37
-
38
- ALTER TABLE "stripe"."subscription_item_change_events_v2_beta"
39
- ADD COLUMN IF NOT EXISTS "quantity_change" bigint
40
- GENERATED ALWAYS AS ((NULLIF(_raw_data->>'quantity_change', ''))::bigint) STORED;
41
-
42
- ALTER TABLE "stripe"."subscription_item_change_events_v2_beta"
43
- ADD COLUMN IF NOT EXISTS "subscription_id" text
44
- GENERATED ALWAYS AS ((NULLIF(_raw_data->>'subscription_id', ''))::text) STORED;
45
-
46
- ALTER TABLE "stripe"."subscription_item_change_events_v2_beta"
47
- ADD COLUMN IF NOT EXISTS "customer_id" text
48
- GENERATED ALWAYS AS ((NULLIF(_raw_data->>'customer_id', ''))::text) STORED;
49
-
50
- ALTER TABLE "stripe"."subscription_item_change_events_v2_beta"
51
- ADD COLUMN IF NOT EXISTS "price_id" text
52
- GENERATED ALWAYS AS ((NULLIF(_raw_data->>'price_id', ''))::text) STORED;
53
-
54
- ALTER TABLE "stripe"."subscription_item_change_events_v2_beta"
55
- ADD COLUMN IF NOT EXISTS "product_id" text
56
- GENERATED ALWAYS AS ((NULLIF(_raw_data->>'product_id', ''))::text) STORED;
57
-
58
- -- Keep as text to avoid non-immutable timestamp casts in a generated column
59
- ALTER TABLE "stripe"."subscription_item_change_events_v2_beta"
60
- ADD COLUMN IF NOT EXISTS "local_event_timestamp" text
61
- GENERATED ALWAYS AS ((NULLIF(_raw_data->>'local_event_timestamp', ''))::text) STORED;
@@ -1,38 +0,0 @@
1
-
2
- CREATE TABLE IF NOT EXISTS "stripe"."exchange_rates_from_usd" (
3
- "_raw_data" jsonb NOT NULL,
4
- "_last_synced_at" timestamptz,
5
- "_updated_at" timestamptz DEFAULT now(),
6
- "_account_id" text NOT NULL,
7
-
8
- "date" date NOT NULL,
9
- "sell_currency" text NOT NULL,
10
-
11
- PRIMARY KEY ("_account_id", "date", "sell_currency")
12
- );
13
-
14
- -- Foreign key to stripe.accounts
15
- ALTER TABLE "stripe"."exchange_rates_from_usd"
16
- DROP CONSTRAINT IF EXISTS fk_exchange_rates_from_usd_account;
17
- ALTER TABLE "stripe"."exchange_rates_from_usd"
18
- ADD CONSTRAINT fk_exchange_rates_from_usd_account
19
- FOREIGN KEY ("_account_id") REFERENCES "stripe"."accounts" (id);
20
-
21
- -- Maintain _updated_at on UPDATE
22
- DROP TRIGGER IF EXISTS handle_updated_at ON "stripe"."exchange_rates_from_usd";
23
- CREATE TRIGGER handle_updated_at
24
- BEFORE UPDATE ON "stripe"."exchange_rates_from_usd"
25
- FOR EACH ROW EXECUTE FUNCTION set_updated_at();
26
-
27
- ALTER TABLE "stripe"."exchange_rates_from_usd"
28
- ADD COLUMN IF NOT EXISTS "buy_currency_exchange_rates" text
29
- GENERATED ALWAYS AS ((NULLIF(_raw_data->>'buy_currency_exchange_rates', ''))::text) STORED;
30
-
31
- -- Index on date for efficient range queries
32
- CREATE INDEX IF NOT EXISTS idx_exchange_rates_from_usd_date
33
- ON "stripe"."exchange_rates_from_usd" ("date");
34
-
35
- -- Index on sell_currency for filtering by currency
36
- CREATE INDEX IF NOT EXISTS idx_exchange_rates_from_usd_sell_currency
37
- ON "stripe"."exchange_rates_from_usd" ("sell_currency");
38
-