create-astram-app 0.9.1 → 0.9.2

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/README.md CHANGED
@@ -216,6 +216,40 @@ With `auth: true`, check every item before the first production deploy.
216
216
  in-flight `/auth/refresh` per session). Concurrent refreshes of the same token can trip reuse
217
217
  detection, which revokes the session (the user must sign in again).
218
218
 
219
+ ## Upgrading from 0.9.x
220
+
221
+ The next `@astram/identity` minor (KI #87) makes `shield_app.users.u_email` unique: identity
222
+ migration `1710000000021-AddUsersEmailUniqueIndex` adds `UNIQUE INDEX uq_users_email`. Bump
223
+ `@astram/identity` and `@astram/guard` (patch) in `server/package.json`, `npm install`, and run the
224
+ migrations with the DDL account (`astram-migrate migrate`) before starting the new version.
225
+
226
+ - **What counts as the same address** is the column collation, `utf8mb4_unicode_ci`: case,
227
+ trailing spaces, full-width letters, accents (`é` = `e`) and `ß` = `ss` all match. Leading
228
+ spaces and a trailing tab do not; the framework trims and lower-cases on write.
229
+ - **Empty addresses:** the migration first sets empty or whitespace-only `u_email` to NULL (NULL
230
+ may repeat). `migrate:revert` drops the index but does not restore the empty strings.
231
+ - **Out-of-order warning:** an app that already ran the dev seeds (`...099`/`...100`) sees
232
+ `WARNING out of order: pending migration 1710000000021`. That is expected; it is not a failure,
233
+ also under `--strict`.
234
+ - **If it fails with duplicates:** the migration stops and lists each duplicate address MASKED
235
+ (`a***@example.com: 2 users`), with no user ids. Nothing is changed and no index is created.
236
+ Find the users (the admin user list searches by email), give each a distinct address or clear
237
+ it (`PUT /identity/users/:uuid`, or your own data fix as a migration), then run the migrations
238
+ again. The framework never picks which user keeps the address.
239
+ - **After the upgrade:** a write of an address another user already holds fails in the database
240
+ (ER_DUP_ENTRY 1062) even when two requests race. The framework's own paths answer it: the
241
+ email-change confirm `409 email_unavailable`, `PUT /identity/users/:uuid` and
242
+ `POST /identity/users` 409 ("That username or email is already in use." — a taken username was
243
+ a 500 before). Because the collation folds accents, `ß` and width, `jose@example.com` and
244
+ `josé@example.com` are now the same address: the second one is refused with 409. If your own
245
+ code writes `shield_app.users` directly, handle errno 1062 as a conflict, and never log or
246
+ return the driver's message: it contains the full address.
247
+
248
+ Run migration `1710000000021` in a low-traffic window on a large `users` table: it scans the table to
249
+ normalise blank emails and holds those row locks until the index build commits. If it fails because
250
+ a duplicate was written during the build (rather than at the pre-check), blank emails have already
251
+ been set to NULL; resolve the reported addresses and re-run.
252
+
219
253
  ## Upgrading from 0.8.x
220
254
 
221
255
  create-astram-app 0.9.0 adds one lint rule (KI #82) and the verified email change (KI #14).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-astram-app",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "license": "MIT",
5
5
  "description": "Scaffolder for a new Astram app — emits a running, framework-enforced NestJS server (deny-by-default, built-in auth/identity to switch on) and, with --with-frontend, a React admin/auth UI, over the immutable @astram/* framework packages.",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  "@astram/engine": "^0.5.2",
25
25
  "@astram/guard": "^0.11.0",
26
26
  "@astram/guide": "^0.2.3",
27
- "@astram/identity": "^0.8.0",
27
+ "@astram/identity": "^0.9.0",
28
28
  "@astram/migrate": "^0.3.2",
29
29
  "@astram/sdk": "^0.2.0",
30
30
  "@nestjs/common": "^11.2.7",