feat: add versioned migrations and kysely query layer

This commit is contained in:
Bastian Wagner
2026-08-17 14:33:28 +02:00
parent acfbb3ab22
commit ec95a8e527
17 changed files with 513 additions and 50 deletions

View File

@@ -0,0 +1,16 @@
exports.up = (pgm) => {
pgm.createExtension('pgcrypto', { ifNotExists: true });
pgm.createTable('users', {
id: { type: 'uuid', primaryKey: true, default: pgm.func('gen_random_uuid()') },
external_subject_id: { type: 'text', notNull: true },
display_name: { type: 'text', notNull: true },
email: { type: 'text', notNull: true },
created_at: { type: 'timestamptz', notNull: true, default: pgm.func('now()') },
updated_at: { type: 'timestamptz', notNull: true, default: pgm.func('now()') },
});
pgm.addConstraint('users', 'users_external_subject_id_key', 'UNIQUE(external_subject_id)');
};
exports.down = (pgm) => {
pgm.dropTable('users');
};