first couple models working, now let's add more

This commit is contained in:
counterweight 2025-03-10 12:47:09 +01:00
parent f5ced9888e
commit 9d4967a41d
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C

View file

@ -1,28 +1,54 @@
'use strict'; 'use strict';
module.exports = { module.exports = {
up: (queryInterface, Sequelize) => { up: (queryInterface, Sequelize) => {
return queryInterface.createTable( return queryInterface.sequelize.transaction((t) => {
'AppInviteCreated', return Promise.all([
{ queryInterface.createTable(
uuid: { 'app_invite_created',
type: Sequelize.UUID, {
allowNull: false, uuid: {
unique: true, type: Sequelize.UUID,
primaryKey: true, allowNull: false,
}, unique: true,
inviter_pub_key: { primaryKey: true,
type: Sequelize.STRING, },
allowNull: false, inviter_pub_key: {
}, type: Sequelize.STRING,
created_at: { allowNull: false,
type: Sequelize.DATE, },
allowNull: false, created_at: {
}, type: Sequelize.DATE,
}, allowNull: false,
{ },
tableName: 'app_invite_created', },
} { transaction: t }
); ),
queryInterface.createTable(
'contact_details_set',
{
uuid: {
type: Sequelize.UUID,
allowNull: false,
unique: true,
primaryKey: true,
},
public_key: {
type: Sequelize.STRING,
allowNull: false,
},
encrypted_contact_details: {
type: Sequelize.TEXT,
allowNull: false,
},
created_at: {
type: Sequelize.DATE,
allowNull: false,
},
},
{ transaction: t }
),
]);
});
}, },
down: (queryInterface, Sequelize) => { down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('Users'); return queryInterface.dropTable('Users');