<commit_before>var db = require('../../config/initializers/sequelize');
var Sequelize = require("sequelize");
var RippleTransaction = require('./ripple_transaction');

var RippleAddress = db.define('ripple_address', {
  id: { 
		type: Sequelize.INTEGER, 
		primaryKey: true,
		autoIncrement: true
	},
  user_id: { type: Sequelize.INTEGER, notNull: true },
  managed: { type: Sequelize.BOOLEAN, notNull: true, default: false },
  address: { type: Sequelize.STRING, notNull: true },
  type: { type: Sequelize.STRING, notNull: true }, // hot, cold, hosted, independent
  secret: { type: Sequelize.STRING },
  tag: { type: Sequelize.STRING },
  previous_transaction_hash: { type: Sequelize.STRING }
}, {
  classMethods: {
    getHot: function(fn){
      RippleAddress.find({ where: { type: 'hot' }}).complete(fn);
    },
    getCold: function(fn){
      RippleAddress.find({ where: { type: 'cold' }}).complete(fn);
    },
    createHot: function(adminId, hotWallet, fn) {
      RippleAddress.create({
        managed: true,
        user_id: adminId,
        type: 'hot',
        address: hotWallet.address,
        secret: hotWallet.secret
      }).complete(fn)
    },
    createCold: function(fn) {
      RippleAddress.create({
        managed: true,
        user_id: admin.id,
        type: 'cold',
        address: hotWallet.address,
        secret: hotWallet.secret
      }).complete(fn)
    },
    setHot: function(adminId, hotWallet, fn) {
      var Klass = this;
      RippleAddress.getHot(function(err, address){
        if (address) {<commit_msg>[FEATURE] Change ripple_address tag to type Integer in model.<commit_after>var db = require('../../config/initializers/sequelize');
var Sequelize = require("sequelize");
var RippleTransaction = require('./ripple_transaction');

var RippleAddress = db.define('ripple_address', {
  id: { 
		type: Sequelize.INTEGER, 
		primaryKey: true,
		autoIncrement: true
	},
  user_id: { type: Sequelize.INTEGER, notNull: true },
  managed: { type: Sequelize.BOOLEAN, notNull: true, default: false },
  address: { type: Sequelize.STRING, notNull: true },
  type: { type: Sequelize.STRING, notNull: true }, // hot, cold, hosted, independent
  secret: { type: Sequelize.STRING },
  tag: { type: Sequelize.INTEGER },
  previous_transaction_hash: { type: Sequelize.STRING }
}, {
  classMethods: {
    getHot: function(fn){
      RippleAddress.find({ where: { type: 'hot' }}).complete(fn);
    },
    getCold: function(fn){
      RippleAddress.find({ where: { type: 'cold' }}).complete(fn);
    },
    createHot: function(adminId, hotWallet, fn) {
      RippleAddress.create({
        managed: true,
        user_id: adminId,
        type: 'hot',
        address: hotWallet.address,
        secret: hotWallet.secret
      }).complete(fn)
    },
    createCold: function(fn) {
      RippleAddress.create({
        managed: true,
        user_id: admin.id,
        type: 'cold',
        address: hotWallet.address,
        secret: hotWallet.secret
      }).complete(fn)
    },
    setHot: function(adminId, hotWallet, fn) {
      var Klass = this;
      RippleAddress.getHot(function(err, address){
        if (address) {
{'fraction_non_alphanumeric': 0.1437638844811171, 'fraction_numerical': 0.0, 'mean_word_length': 3.0935064935064935, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7363093', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1016, 'n_words': 228}