@intelligo-dev/core 1.0.0-beta.13 → 1.0.0-beta.14
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/db/schema/billing.d.ts +207 -2
- package/dist/db/schema/billing.d.ts.map +1 -1
- package/dist/db/schema/billing.js +32 -3
- package/dist/db/schema/billing.js.map +1 -1
- package/dist/identity/index.d.ts +4 -3
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +3 -2
- package/dist/identity/index.js.map +1 -1
- package/dist/identity/service.d.ts +20 -4
- package/dist/identity/service.d.ts.map +1 -1
- package/dist/identity/service.js +78 -3
- package/dist/identity/service.js.map +1 -1
- package/dist/identity/types.d.ts +28 -1
- package/dist/identity/types.d.ts.map +1 -1
- package/dist/notifications/index.d.ts +1 -1
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/types.d.ts +8 -1
- package/dist/notifications/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/db/migrations/0003_local_payments.sql +18 -0
- package/src/db/migrations/README.md +31 -2
- package/src/db/migrations/legacy-chain.json +13 -4
- package/src/db/migrations/meta/0003_snapshot.json +4501 -0
- package/src/db/migrations/meta/_journal.json +7 -0
- package/src/db/schema/billing.ts +39 -3
- package/src/identity/index.ts +4 -1
- package/src/identity/service.ts +106 -5
- package/src/identity/types.ts +30 -0
- package/src/notifications/index.ts +5 -1
- package/src/notifications/types.ts +9 -1
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
CREATE TABLE "payments" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"provider" text NOT NULL,
|
|
4
|
+
"invoice_id" text NOT NULL,
|
|
5
|
+
"workspace_id" text NOT NULL,
|
|
6
|
+
"user_id" text,
|
|
7
|
+
"reference" text NOT NULL,
|
|
8
|
+
"amount_minor" integer NOT NULL,
|
|
9
|
+
"currency" text NOT NULL,
|
|
10
|
+
"status" text DEFAULT 'pending' NOT NULL,
|
|
11
|
+
"fulfilled_at" timestamp,
|
|
12
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
13
|
+
CONSTRAINT "payments_invoice_id_unique" UNIQUE("invoice_id")
|
|
14
|
+
);
|
|
15
|
+
--> statement-breakpoint
|
|
16
|
+
ALTER TABLE "payments" ADD CONSTRAINT "payments_workspace_id_organization_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
17
|
+
ALTER TABLE "payments" ADD CONSTRAINT "payments_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
18
|
+
CREATE INDEX "payments_workspace_id_idx" ON "payments" USING btree ("workspace_id");
|
|
@@ -63,8 +63,37 @@ the few places where the old chain and the schema disagreed into line
|
|
|
63
63
|
created that the framework no longer defines are left untouched; a
|
|
64
64
|
product that still uses them keeps them in its own migrations.
|
|
65
65
|
|
|
66
|
-
A database that ran only part of the old chain is refused
|
|
67
|
-
|
|
66
|
+
A database that ran only part of the old chain is refused, and
|
|
67
|
+
`intelligo migrate --check` names the migrations it has not run
|
|
68
|
+
(`legacyMissing` in `--json`). No published version finishes the old
|
|
69
|
+
chain: `@intelligo-dev/core@1.0.0-beta.6`, the last one on npm before the
|
|
70
|
+
baseline, ships it through `0042_sessions_active_organization_id`, and
|
|
71
|
+
the versions that carried `0043_attachments`, `0044_money_micros`,
|
|
72
|
+
`0045_drop_legacy_money_columns` and `0046_user_quotas_per_workspace`
|
|
73
|
+
never reached npm. Their SQL is not in the public repository either:
|
|
74
|
+
its last revision before the baseline, `fdc6c3d`, lists all 48 in the
|
|
75
|
+
journal but carries no `.sql` files. That leaves three ways forward;
|
|
76
|
+
try each on a restored copy first.
|
|
77
|
+
|
|
78
|
+
1. **You have the missing SQL** — a source checkout of the pre-1.0
|
|
79
|
+
framework that contains the files. Apply each missing migration in
|
|
80
|
+
chain order and record it in `drizzle.__drizzle_migrations`: `hash`
|
|
81
|
+
is the sha256 of the file's contents, which must be the one
|
|
82
|
+
`legacy-chain.json` lists, and `created_at` its journal `when`. Once
|
|
83
|
+
the database holds the whole chain, `intelligo migrate` adopts it.
|
|
84
|
+
2. **You do not** — bring the schema to the baseline by hand, then
|
|
85
|
+
record the baseline as applied the way a push-provisioned database is
|
|
86
|
+
(next section). Create an empty database, run `intelligo migrate`
|
|
87
|
+
there, and compare the two schemas (`pg_dump --schema-only`); what
|
|
88
|
+
differs is what `0043`–`0046` would have done. Mind the data, not
|
|
89
|
+
only the columns: `0044` backfilled every money amount into
|
|
90
|
+
`*_micros` columns (MNT at ×1,000,000) with a currency, and `0045`
|
|
91
|
+
dropped the old `*_mnt` and cents columns only after that copy.
|
|
92
|
+
Clear the old chain's rows from `drizzle.__drizzle_migrations` and
|
|
93
|
+
insert the current chain's before the first `intelligo migrate`.
|
|
94
|
+
3. **Start over** — create the database from the baseline and move the
|
|
95
|
+
rows you keep across. For a deployment whose data is disposable this
|
|
96
|
+
is the shortest path.
|
|
68
97
|
|
|
69
98
|
## Baselining a push-provisioned database
|
|
70
99
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$comment": "The framework's migration chain before the 1.0 baseline: every entry's tag and the sha256 of its .sql file, as drizzle recorded it in drizzle.__drizzle_migrations. `intelligo migrate` reads it to adopt a database that ran the whole old chain \u2014 it records 0000_baseline as applied without running it. The SQL itself is not shipped.",
|
|
2
|
+
"$comment": "The framework's migration chain before the 1.0 baseline: every entry's tag and the sha256 of its .sql file, as drizzle recorded it in drizzle.__drizzle_migrations. `intelligo migrate` reads it to adopt a database that ran the whole old chain \u2014 it records 0000_baseline as applied without running it. The SQL itself is not shipped. `alternates`: other hashes the same migration was recorded under \u2014 the SQL npm shipped in 1.0.0-beta.6 differs from the repository's for three of them.",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
5
|
"tag": "0000_sharp_night_nurse",
|
|
@@ -151,7 +151,10 @@
|
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
"tag": "0036_executions_audit_jobs",
|
|
154
|
-
"hash": "8665606757ec96bbd48eaab2b2ebb1ee5b5a86d58ba73635b3229ff94c40e572"
|
|
154
|
+
"hash": "8665606757ec96bbd48eaab2b2ebb1ee5b5a86d58ba73635b3229ff94c40e572",
|
|
155
|
+
"alternates": [
|
|
156
|
+
"c93a93db58737ef13f25138b107711a86f4f21efb48d1c83c18f2ffa07831c3d"
|
|
157
|
+
]
|
|
155
158
|
},
|
|
156
159
|
{
|
|
157
160
|
"tag": "0037_rate_limit_minute_bucket",
|
|
@@ -159,7 +162,10 @@
|
|
|
159
162
|
},
|
|
160
163
|
{
|
|
161
164
|
"tag": "0038_user_quotas_generic_usage",
|
|
162
|
-
"hash": "658b6f64424522d955f2aa4d2ce1fe32b52f0e5adbdba14af75c1678389d7754"
|
|
165
|
+
"hash": "658b6f64424522d955f2aa4d2ce1fe32b52f0e5adbdba14af75c1678389d7754",
|
|
166
|
+
"alternates": [
|
|
167
|
+
"822df887955ddfdb138146ae47612dd0c37c5419b67223b6309b82253efc1c53"
|
|
168
|
+
]
|
|
163
169
|
},
|
|
164
170
|
{
|
|
165
171
|
"tag": "0039_platform_admin_impersonation",
|
|
@@ -167,7 +173,10 @@
|
|
|
167
173
|
},
|
|
168
174
|
{
|
|
169
175
|
"tag": "0040_ee_audit_chain",
|
|
170
|
-
"hash": "16b01fa704f75e13fe85cee307a2dd287e3cbd93e77fd58ce0eb18cc32e178e6"
|
|
176
|
+
"hash": "16b01fa704f75e13fe85cee307a2dd287e3cbd93e77fd58ce0eb18cc32e178e6",
|
|
177
|
+
"alternates": [
|
|
178
|
+
"3a432628f1dcf4c4efbda0421901421fdaaa99c498abdb22ee21c6baef24a005"
|
|
179
|
+
]
|
|
171
180
|
},
|
|
172
181
|
{
|
|
173
182
|
"tag": "0041_audit_events_append_only",
|