37 lines
948 B
JavaScript
37 lines
948 B
JavaScript
|
module.exports = function (sequelize, DataTypes, options) {
|
||
|
const model = sequelize.define("extendedPublicKey", {
|
||
|
id: {
|
||
|
type: DataTypes.STRING,
|
||
|
defaultValue: function() {
|
||
|
return options.generateUniqueId()
|
||
|
},
|
||
|
primaryKey: true,
|
||
|
unique: true
|
||
|
},
|
||
|
xpub: {
|
||
|
type: DataTypes.STRING,
|
||
|
// TODO add validation
|
||
|
allowNull: false,
|
||
|
unique: true
|
||
|
},
|
||
|
derivationPath: {
|
||
|
type: DataTypes.STRING,
|
||
|
// TODO add validation...
|
||
|
allowNull: false,
|
||
|
unique: true
|
||
|
},
|
||
|
name: {
|
||
|
type: DataTypes.STRING,
|
||
|
unique: true
|
||
|
}
|
||
|
}, {
|
||
|
comment: "Exteneded public keys."
|
||
|
});
|
||
|
|
||
|
model.associate = (db) => {
|
||
|
// TODO Update key to wallet...
|
||
|
model.Key = model.belongsTo(db.Key);
|
||
|
}
|
||
|
|
||
|
return model;
|
||
|
};
|