Moved claim address data into its own collection

-Created a new claimaddress collection to hold claim address data to make it easier to work with and preserve that data if necessary in the future without being cluttered into the address collection
-The database init function has been updated to move claim address data to the new collection and remove the data from the address collection. This process will update existing explorer databases automatically and is smart enough to only run this process one time to prevent from slowing down startup of the explorer on each run
-The claim name field has been changed from "name" to "claim_name" wherever possible to be easier to find in the future. Searching for the keyword "name" brings back way too many matches and makes it difficult to find all the correct code snippets for future changes
-Added a newer_claim_address field to the stats collection to determine if the claim address data needs to be moved to the new collection or not
-All previous claim address code has been updated to pull from the new table and/or join to the address table if/when necessary
This commit is contained in:
Joe Uhren
2023-09-26 18:22:28 -06:00
parent cf6732f70f
commit 09cf474562
8 changed files with 284 additions and 64 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ var mongoose = require('mongoose'),
var AddressSchema = new Schema({
a_id: { type: String, unique: true, index: true},
name: { type: String, default: '', index: true},
name: { type: String }, // no longer used but cannot be removed or else older versions that have data here will not be able to auto move claim name data to the new claimaddress collection
received: { type: Number, default: 0, index: true },
sent: { type: Number, default: 0, index: true },
balance: {type: Number, default: 0, index: true},
+9
View File
@@ -0,0 +1,9 @@
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var ClaimAddressSchema = new Schema({
a_id: {type: String, unique: true, index: true},
claim_name: {type: String, default: '', index: true}
}, {id: false});
module.exports = mongoose.model('ClaimAddress', ClaimAddressSchema);
+2 -1
View File
@@ -17,7 +17,8 @@ var StatsSchema = new Schema({
richlist_last_updated: { type: Number, default: 0 },
markets_last_updated: { type: Number, default: 0 },
orphan_index: { type: Number, default: 0 },
orphan_current: { type: Number, default: 0 }
orphan_current: { type: Number, default: 0 },
newer_claim_address: { type: Boolean, default: false }
});
module.exports = mongoose.model('coinstats', StatsSchema);