-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: migrate to native UUID #530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
74de880
3e57e42
186e267
41ebc94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| /* eslint-disable max-len */ | ||
| import { NIL, v4 as uuidv4 } from 'uuid'; | ||
| import { randomUUID } from 'node:crypto'; | ||
|
|
||
| import { addAuditStamps } from '../utils/migrations/helpers.ts'; | ||
|
|
||
| import type { Knex } from 'knex'; | ||
|
|
||
| const NIL_UUID = '00000000-0000-0000-0000-000000000000'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be a app wide constant
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a holdover from when the system id was nil. We shouldn't be using nil elsewhere anymore. |
||
|
|
||
| export async function up(knex: Knex): Promise<void> { | ||
| return ( | ||
| Promise.resolve() | ||
|
|
@@ -421,18 +423,18 @@ export async function up(knex: Knex): Promise<void> { | |
| .then(() => { | ||
| const users = ['system']; | ||
| const items = users.map((user) => ({ | ||
| user_id: NIL, | ||
| user_id: NIL_UUID, | ||
| username: user, | ||
| active: true, | ||
| created_by: NIL | ||
| created_by: NIL_UUID | ||
| })); | ||
| return knex('user').insert(items); | ||
| }) | ||
|
|
||
| .then(() => { | ||
| const items = [ | ||
| { | ||
| initiative_id: uuidv4(), | ||
| initiative_id: randomUUID(), | ||
| code: 'HOUSING', | ||
| label: 'Housing' | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.