@fonderie/billing 1.0.0 → 1.1.0
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.
- package/dist/index.cjs +41 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -1
- package/dist/index.d.ts +48 -1
- package/dist/index.js +47 -5
- package/dist/index.js.map +1 -1
- package/dist/migrations/index.d.ts +3 -0
- package/package.json +7 -4
- package/dist/migrations/sql/001_billing.sql +0 -38
- package/dist/migrations/sql/002_billing_plan_fields.sql +0 -5
- package/dist/migrations/sql/003_drop_limits.sql +0 -1
- package/dist/migrations/sql/004_polymorphic_subscribers.sql +0 -49
- package/dist/migrations/sql/005_billing_notifications.sql +0 -13
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
-- Tracks which threshold notifications have been sent per subscriber/key/window.
|
|
2
|
-
-- Prevents duplicate emails when a subscriber hovers around a threshold.
|
|
3
|
-
CREATE TABLE IF NOT EXISTS fonderie_billing_notifications (
|
|
4
|
-
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
5
|
-
subscriber_type TEXT NOT NULL,
|
|
6
|
-
subscriber_id UUID NOT NULL,
|
|
7
|
-
policy_key TEXT NOT NULL,
|
|
8
|
-
notification TEXT NOT NULL, -- 'warning' | 'reached' | 'blocked'
|
|
9
|
-
window_key TEXT NOT NULL, -- e.g. '2026-05-13' for a 1-day window
|
|
10
|
-
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
11
|
-
CONSTRAINT fonderie_billing_notifications_unique
|
|
12
|
-
UNIQUE (subscriber_type, subscriber_id, policy_key, notification, window_key)
|
|
13
|
-
);
|