Parcourir la source

finished converter

tags/v0.3.2
Big Bad Waffle il y a 5 ans
Parent
révision
d135846576
2 fichiers modifiés avec 41 ajouts et 4 suppressions
  1. +30
    -0
      helpers/sqlite-to-rethink/cheatsheet.js
  2. +11
    -4
      helpers/sqlite-to-rethink/index.js

+ 30
- 0
helpers/sqlite-to-rethink/cheatsheet.js Voir le fichier

@@ -0,0 +1,30 @@
//Count the amount of permadead characters
r.db('test').table('character').filter({
value: {
permadead: true
}
}).count();

//Count the amount of permadead characters per spirit
r.db('test').table('character')
.filter({
value: {
permadead: true
}
})
.group(row => {
return row('value')('class');
})
.count();

//All players that are level 20
r.db('test').table('character')
.filter(row => {
return row('value')('components').contains(cpn => {
return cpn('type').eq('stats').and(cpn('values')('level').ge(20));
});
});

//Group by mod action source,a ggregate and order by count
r.db('test').table('modLog')
.group(r => r('value')('source')).count().ungroup().orderBy('reduction');

+ 11
- 4
helpers/sqlite-to-rethink/index.js Voir le fichier

@@ -7,12 +7,11 @@ const config = {

dbName: 'dev',

dropTables: true,
dropTables: false,

maxBusy: 100,

tables: [
'character'/*,
'characterList',
'stash',
'skins',
@@ -23,7 +22,8 @@ const config = {
'customChannels',
'error',
'modLog',
'accountInfo'*/
'accountInfo',
'character'
]
};

@@ -80,6 +80,7 @@ let converter = {
this.records = await util.promisify(this.dbS.all.bind(this.dbS))(`SELECT * FROM ${table}`);
console.log(`${table}: ${this.records.length} records`);
await this.startConvert();
console.log('done');
}
},

@@ -114,7 +115,13 @@ let converter = {
.split('`')
.join('\'');

let obj = JSON.parse(value);
let obj = value;
if (!['login'].includes(this.currentTable)) {
if (this.currentTable === 'mail' && value === '')
value = '{}';
obj = JSON.parse(value);
}

await r.table(this.currentTable)
.insert({


Chargement…
Annuler
Enregistrer