Removed JJ and Whale Member fix tools.
This commit is contained in:
parent
f067a309a1
commit
22400ed954
|
@ -1,51 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
// const config = require('config');
|
||||
const initKnex = require('knex');
|
||||
// const unprint = require('unprint');
|
||||
// const args = require('yargs').argv;
|
||||
// const stashes = require('./julesjordan_stashes.json');
|
||||
const slugify = require('../utils/slugify');
|
||||
|
||||
async function init() {
|
||||
const knex = initKnex({
|
||||
client: 'pg',
|
||||
connection: {
|
||||
host: 'syskill.unknown.name',
|
||||
user: 'traxxx',
|
||||
password: 'YGDdBeXZXE25gKuzh5g7u4RV61G00XP6',
|
||||
database: 'traxxx',
|
||||
},
|
||||
asyncStackTraces: true,
|
||||
});
|
||||
|
||||
const results = await knex('releases')
|
||||
.select('releases.*', knex.raw('json_agg(actors.name) as actor_names'))
|
||||
.leftJoin('entities', 'entities.id', 'releases.entity_id')
|
||||
.leftJoin('releases_actors', 'releases_actors.release_id', 'releases.id')
|
||||
.leftJoin('actors', 'actors.id', 'releases_actors.actor_id')
|
||||
.whereIn('entities.slug', ['julesjordan'])
|
||||
.groupBy('releases.id');
|
||||
|
||||
await knex.transaction(async (trx) => {
|
||||
return results.reduce(async (chain, scene) => {
|
||||
await chain;
|
||||
|
||||
// const newEntryId = scene.entry_id.replace(/-\d{4}-\d{2}-\d{2}$/, ''); // remove date
|
||||
const newEntryId = slugify([scene.title, ...(scene.actor_names?.toSorted() || [])]);
|
||||
|
||||
console.log(newEntryId);
|
||||
|
||||
await trx('releases')
|
||||
.where('id', scene.id)
|
||||
.update({
|
||||
entry_id: newEntryId,
|
||||
comment: `old entry id: ${scene.entry_id}`,
|
||||
});
|
||||
}, Promise.resolve());
|
||||
});
|
||||
|
||||
knex.destroy();
|
||||
}
|
||||
|
||||
init();
|
|
@ -1,34 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
// const config = require('config');
|
||||
const initKnex = require('knex');
|
||||
// const args = require('yargs').argv;
|
||||
|
||||
async function init() {
|
||||
const knex = initKnex({
|
||||
client: 'pg',
|
||||
connection: {
|
||||
host: '135.125.235.53',
|
||||
user: 'traxxx',
|
||||
password: 'YGDdBeXZXE25gKuzh5g7u4RV61G00XP6',
|
||||
database: 'traxxx',
|
||||
},
|
||||
asyncStackTraces: true,
|
||||
});
|
||||
|
||||
const results = await knex('releases')
|
||||
.select('releases.*')
|
||||
.leftJoin('entities', 'entities.id', 'releases.entity_id')
|
||||
.leftJoin('entities as networks', 'networks.id', 'entities.parent_id')
|
||||
.whereIn('networks.slug', ['whalemember', 'pornpros']);
|
||||
|
||||
console.log(results.length);
|
||||
|
||||
await knex('releases')
|
||||
.whereIn('id', results.map((result) => result.id))
|
||||
.update('entry_id', knex.raw('split_part(releases.url, \'/\', -1)'));
|
||||
|
||||
knex.destroy();
|
||||
}
|
||||
|
||||
init();
|
Loading…
Reference in New Issue