Commit 7c3302f
committed
fix: let user API key migration run on populated databases
Version20260702123347 added user.api_key as NOT NULL and then put a unique
index on it, so every existing user got the same empty string and the index
collided on the second row. Any database holding more than one user failed
to migrate.
Generate a key for each existing user before creating the index, matching
App\Entity\User::__construct, which gives every user created since #88 a key
of its own. The keys come from PHP rather than SQL because they are
credentials and SQL's RAND() and UUID() are not cryptographically secure.1 parent ca17d7e commit 7c3302f
2 files changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
24 | 36 | | |
25 | 37 | | |
26 | 38 | | |
| |||
0 commit comments