1
0
mirror of https://github.com/GOSTSec/gostexplr synced 2025-01-29 16:04:32 +00:00
gostexplr/models/transaction.js

32 lines
693 B
JavaScript

'use strict';
module.exports = (sequelize, DataTypes) => {
const Transaction = sequelize.define('Transaction', {
txid: DataTypes.STRING(64),
}, {
timestamps: false,
indexes: [{
unique: true,
fields: ['txid']
}],
});
const TransactionVouts = sequelize.define('TransactionVouts', {
'direction': DataTypes.TINYINT(1),
}, {
timestamps: false,
});
Transaction.associate = function (models) {
models.Transaction.belongsTo(models.Block, {
onDelete: "CASCADE",
foreignKey: {
allowNull: false
},
});
models.Transaction.belongsToMany(models.Vout, { through: 'TransactionVouts' });
};
return Transaction;
};