offercreated offerdeleted
This commit is contained in:
parent
8c4c9dfe99
commit
01c9fca093
2 changed files with 53 additions and 0 deletions
|
|
@ -1,4 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const { query } = require('express');
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return queryInterface.sequelize.transaction((t) => {
|
||||
|
|
@ -169,6 +172,46 @@ module.exports = {
|
|||
},
|
||||
{ transaction: t }
|
||||
),
|
||||
queryInterface.createTable(
|
||||
'offer_created',
|
||||
{
|
||||
uuid: {
|
||||
type: Sequelize.UUID,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
primaryKey: true,
|
||||
},
|
||||
public_key: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
created_at: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{ transaction: t }
|
||||
),
|
||||
queryInterface.createTable(
|
||||
'offer_deleted',
|
||||
{
|
||||
uuid: {
|
||||
type: Sequelize.UUID,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
primaryKey: true,
|
||||
},
|
||||
offer_uuid: {
|
||||
type: Sequelize.UUID,
|
||||
allowNull: false,
|
||||
},
|
||||
created_at: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{ transaction: t }
|
||||
),
|
||||
]);
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -33,6 +33,16 @@ module.exports = {
|
|||
onDelete: 'cascade',
|
||||
onUpdate: 'cascade',
|
||||
}),
|
||||
queryInterface.addConstraint('offer_deleted', {
|
||||
fields: ['offer_uuid'],
|
||||
type: 'foreign key',
|
||||
references: {
|
||||
table: 'offer_created',
|
||||
field: 'uuid',
|
||||
},
|
||||
onDelete: 'cascade',
|
||||
onUpdate: 'cascade',
|
||||
}),
|
||||
]);
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue