From 3e0a4772aaf7fac7cbc1095dd871f139def40b47 Mon Sep 17 00:00:00 2001 From: counterweight Date: Mon, 10 Mar 2025 14:02:41 +0100 Subject: [PATCH] signupchallengecreated --- .../20250308000000-first-schema-tables.js | 24 +++++++++++++++++++ .../20250308000001-first-schema-fks.js | 20 ++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/src/database/migrations/20250308000000-first-schema-tables.js b/src/database/migrations/20250308000000-first-schema-tables.js index 7506bb8..73cba27 100644 --- a/src/database/migrations/20250308000000-first-schema-tables.js +++ b/src/database/migrations/20250308000000-first-schema-tables.js @@ -320,6 +320,30 @@ module.exports = { }, { transaction: t } ), + queryInterface.createTable( + 'sign_up_challenge_created', + { + uuid: { + type: Sequelize.UUID, + allowNull: false, + unique: true, + primaryKey: true, + }, + nostr_challenge_uuid: { + type: Sequelize.UUID, + allowNull: false, + }, + app_invite_uuid: { + type: Sequelize.UUID, + allowNull: false, + }, + created_at: { + type: Sequelize.DATE, + allowNull: false, + }, + }, + { transaction: t } + ), ]); }); }, diff --git a/src/database/migrations/20250308000001-first-schema-fks.js b/src/database/migrations/20250308000001-first-schema-fks.js index 54c86b6..573d238 100644 --- a/src/database/migrations/20250308000001-first-schema-fks.js +++ b/src/database/migrations/20250308000001-first-schema-fks.js @@ -63,6 +63,26 @@ module.exports = { onDelete: 'cascade', onUpdate: 'cascade', }), + queryInterface.addConstraint('sign_up_challenge_created', { + fields: ['nostr_challenge_uuid'], + type: 'foreign key', + references: { + table: 'nostr_challenge_created', + field: 'uuid', + }, + onDelete: 'cascade', + onUpdate: 'cascade', + }), + queryInterface.addConstraint('sign_up_challenge_created', { + fields: ['app_invite_uuid'], + type: 'foreign key', + references: { + table: 'app_invite_created', + field: 'uuid', + }, + onDelete: 'cascade', + onUpdate: 'cascade', + }), ]); }); },