1
0
mirror of https://github.com/GOSTSec/gostexplr synced 2025-01-19 19:21:03 +00:00
gostexplr/models/block.js
2018-02-03 21:14:56 +05:00

33 lines
846 B
JavaScript

'use strict';
module.exports = (sequelize, DataTypes) => {
const Block = sequelize.define('Block', {
height: {
type: DataTypes.INTEGER.UNSIGNED,
primaryKey: true,
},
hash: DataTypes.STRING(64),
confirmations: DataTypes.MEDIUMINT.UNSIGNED,
size: DataTypes.MEDIUMINT.UNSIGNED,
version: DataTypes.TINYINT.UNSIGNED,
merkleroot: DataTypes.STRING(64),
time: DataTypes.DATE,
nonce: DataTypes.BIGINT,
bits: DataTypes.STRING(8),
difficulty: DataTypes.DECIMAL(16, 8),
previousblockhash: DataTypes.STRING(64),
nextblockhash: DataTypes.STRING(64),
}, {
timestamps: false,
indexes: [{
unique: true,
fields: ['hash', 'height']
}],
freezeTableName: true,
});
Block.associate = function(models) {
models.Block.hasMany(models.Transaction);
};
return Block;
};