Skip to content
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

#624 feat: user_info table #631

Merged
merged 13 commits into from
Feb 22, 2025
8 changes: 8 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ Everything prepended with `_` is either a hidden file or a build artifact.
└── tsconfig.json
```

Database migrations scripts are in `src/migrations` and run in chronological order.

Filename format:
- Old files are prefixed with numbers
- Newer files are `<year><timestamp>.ts`

See [Knex migrations](https://knexjs.org/guide/migrations.html)

Ways to Contribute
----------------

Expand Down
26 changes: 26 additions & 0 deletions src/migrations/20251740066033_user_info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Knex } from 'knex';

export async function up(knex: Knex): Promise<void> {

await knex.schema.createTable('user_info', table => {
table.integer('principal_id').unsigned().notNullable().primary().references('principals.id');
table.string('name', 200).nullable().comment('End-User\'s full name in displayable form including all name parts, possibly including titles and suffixes, ordered according to the End-User\'s locale and preferences.');
table.string('middle_name').nullable().comment('Middle name(s) of the End-User.');
table.string('given_name', 30).nullable().comment('Given name(s) or first name(s) of the End-User.');
table.string('family_name', 30).nullable().comment('Surname(s) or last name(s) of the End-User.');
table.date('birthdate').nullable().comment('End-User\'s birthday');
table.text('address').nullable().comment('End-User\'s preferred postal address. ');
table.string('locale', 5).nullable().comment('End-User\'s locale. For example, en-US or fr-CA.');
table.string('zoneinfo').nullable().comment('End-User\'s time zone. For example, Europe/Paris or America/Los_Angeles.');
table.integer('created_at').unsigned().comment('Time the user_info record was created.');
table.integer('modified_at').unsigned().nullable().comment('Time the End-User\'s information was last updated.');
table.text('metadata');
});

}

export async function down(knex: Knex): Promise<void> {

throw new Error('This migration doesn\'t have a "down" script');

}