-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #739 from podverse/develop
Release v4.16.9
- Loading branch information
Showing
7 changed files
with
113 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { getConnection } from 'typeorm' | ||
import { _logEnd, _logStart, logPerformance } from '~/lib/utility' | ||
const json2csv = require('json-2-csv') | ||
|
||
const generateDeadRowsCSV = async () => { | ||
logPerformance('generateDeadRowCSV', _logStart) | ||
const em = await getConnection().createEntityManager() | ||
const results = await em.query(` | ||
SELECT n_live_tup, n_dead_tup, relname | ||
FROM pg_stat_all_tables | ||
ORDER BY n_dead_tup DESC; | ||
`) | ||
|
||
const csv = json2csv.json2csv(results) | ||
console.log('csv', csv) | ||
|
||
logPerformance('generateDeadRowCSV', _logEnd) | ||
} | ||
|
||
export { generateDeadRowsCSV } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { generateDeadRowsCSV as generateDeadRowsCSVCont } from '~/controllers/devtools/db' | ||
import { connectToDb } from '~/lib/db' | ||
;(async function () { | ||
const generateDeadRowCSV = async () => { | ||
try { | ||
const connection = await connectToDb() | ||
|
||
if (connection && connection.isConnected) { | ||
await generateDeadRowsCSVCont() | ||
} | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
} | ||
|
||
generateDeadRowCSV() | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { removePodcasts } from '~/controllers/podcast' | ||
import { connectToDb } from '~/lib/db' | ||
;(async function () { | ||
const removePodcastsByIds = async () => { | ||
try { | ||
const podcastIdsString = process.argv.length > 2 ? process.argv[2] : '' | ||
|
||
if (!podcastIdsString) { | ||
console.log('Provide a comma delimited string of podcastIds as a parameter.') | ||
return | ||
} | ||
|
||
const podcastIds = podcastIdsString.split(',') | ||
const connection = await connectToDb() | ||
|
||
if (connection && connection.isConnected) { | ||
await removePodcasts(podcastIds) | ||
} | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
} | ||
|
||
removePodcastsByIds() | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters