mirror of
https://github.com/GOSTSec/gostexplr
synced 2025-01-15 09:10:06 +00:00
32 lines
667 B
JavaScript
32 lines
667 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 TxToTx = sequelize.define('TxToTx', {}, {
|
|
timestamps: false,
|
|
});
|
|
|
|
Transaction.belongsToMany(Transaction, { through: TxToTx, as: 'txtx' });
|
|
|
|
Transaction.associate = function (models) {
|
|
models.Transaction.belongsTo(models.Block, {
|
|
onDelete: "CASCADE",
|
|
foreignKey: {
|
|
allowNull: false
|
|
}
|
|
});
|
|
|
|
models.Transaction.hasMany(models.Vout);
|
|
};
|
|
|
|
return Transaction;
|
|
}; |