Commit 75c0f14
committed
feat: scope credit grant idempotency key to customer
The credit grant idempotency key was unique per (namespace, key), so two
different customers in the same namespace could not reuse the same key
even though grant creation and key lookup are both customer-scoped.
Re-scope the partial unique index to (namespace, customer_id, key) and
document the scope on the API field. Loosening the constraint cannot
fail on existing data: any rows violating the new index would have
violated the old one.1 parent 8123cc6 commit 75c0f14
11 files changed
Lines changed: 793 additions & 765 deletions
File tree
- api
- spec/packages
- aip-client-javascript/src/models
- aip/src/customers/credits
- v3
- client
- e2e
- openmeter/ent
- db/migrate
- schema
- tools/migrate/migrations
Lines changed: 12 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3429 | 3429 | | |
3430 | 3430 | | |
3431 | 3431 | | |
3432 | | - | |
3433 | | - | |
| 3432 | + | |
| 3433 | + | |
| 3434 | + | |
3434 | 3435 | | |
3435 | 3436 | | |
3436 | 3437 | | |
| |||
3493 | 3494 | | |
3494 | 3495 | | |
3495 | 3496 | | |
3496 | | - | |
3497 | | - | |
| 3497 | + | |
| 3498 | + | |
| 3499 | + | |
3498 | 3500 | | |
3499 | 3501 | | |
3500 | 3502 | | |
| |||
5944 | 5946 | | |
5945 | 5947 | | |
5946 | 5948 | | |
5947 | | - | |
5948 | | - | |
| 5949 | + | |
| 5950 | + | |
| 5951 | + | |
5949 | 5952 | | |
5950 | 5953 | | |
5951 | 5954 | | |
| |||
6008 | 6011 | | |
6009 | 6012 | | |
6010 | 6013 | | |
6011 | | - | |
6012 | | - | |
| 6014 | + | |
| 6015 | + | |
| 6016 | + | |
6013 | 6017 | | |
6014 | 6018 | | |
6015 | 6019 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
214 | 215 | | |
215 | 216 | | |
216 | 217 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5440 | 5440 | | |
5441 | 5441 | | |
5442 | 5442 | | |
5443 | | - | |
5444 | | - | |
| 5443 | + | |
| 5444 | + | |
| 5445 | + | |
5445 | 5446 | | |
5446 | 5447 | | |
5447 | 5448 | | |
| |||
9432 | 9433 | | |
9433 | 9434 | | |
9434 | 9435 | | |
9435 | | - | |
9436 | | - | |
| 9436 | + | |
| 9437 | + | |
| 9438 | + | |
9437 | 9439 | | |
9438 | 9440 | | |
9439 | 9441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
| 142 | + | |
142 | 143 | | |
143 | | - | |
144 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
145 | 149 | | |
146 | 150 | | |
147 | 151 | | |
| |||
331 | 335 | | |
332 | 336 | | |
333 | 337 | | |
334 | | - | |
335 | | - | |
| 338 | + | |
| 339 | + | |
336 | 340 | | |
337 | 341 | | |
338 | 342 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments