2018-02-03 21:14:56 +05:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
module.exports = (sequelize, DataTypes) => {
|
|
|
|
const Transaction = sequelize.define('Transaction', {
|
|
|
|
txid: DataTypes.STRING(64),
|
|
|
|
}, {
|
|
|
|
timestamps: false,
|
|
|
|
indexes: [{
|
|
|
|
unique: true,
|
|
|
|
fields: ['txid']
|
|
|
|
}],
|
|
|
|
});
|
|
|
|
|
2018-02-11 03:36:42 +05:00
|
|
|
const TransactionVouts = sequelize.define('TransactionVouts', {
|
|
|
|
'direction': DataTypes.TINYINT(1),
|
|
|
|
}, {
|
2018-02-03 21:14:56 +05:00
|
|
|
timestamps: false,
|
|
|
|
});
|
|
|
|
|
|
|
|
Transaction.associate = function (models) {
|
|
|
|
models.Transaction.belongsTo(models.Block, {
|
|
|
|
onDelete: "CASCADE",
|
|
|
|
foreignKey: {
|
|
|
|
allowNull: false
|
2018-02-11 03:36:42 +05:00
|
|
|
},
|
2018-02-03 21:14:56 +05:00
|
|
|
});
|
|
|
|
|
2018-02-11 03:36:42 +05:00
|
|
|
models.Transaction.belongsToMany(models.Vout, { through: 'TransactionVouts' });
|
2018-02-03 21:14:56 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
return Transaction;
|
|
|
|
};
|