-
Notifications
You must be signed in to change notification settings - Fork 8
chore: exporte la base de données au format json #689
Conversation
Codecov Report
@@ Coverage Diff @@
## master #689 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 77 77
Lines 1974 1974
Branches 419 419
=========================================
Hits 1974 1974 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on a besoin de
- supprimer le dossier
sources
si il existe - dropper toutes les tables de la base de données
- ensuite
npm run db:init
doit fonctionner à partir du nouveau dossiersources
src/tools/exportDataBaseToJson.ts
Outdated
return field[key] | ||
} | ||
|
||
const camelToSnakeCase = (field: string) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je crois qu’on l’a déjà ça, @francoisromain ?
src/tools/exportDataBaseToJson.ts
Outdated
}) | ||
|
||
for (const tableName of tablesNames) { | ||
const jsonFileName = `${tableName.replace(/_/g, '-')}.json` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je crois qu’on a déjà un utilitaire pour ça, @francoisromain ?
src/tools/exportDataBaseToJson.ts
Outdated
field | ||
) | ||
|
||
const main = () => databaseToJsonExport() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T’as pas un pb avec le async/await ?
databaseToJsonExport() .then(() => { process.exit() }) .catch(() => { process.exit(1) })
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ce serait bien de faire le singleton knex avant de merger cette PR. @vmaubert
il est utilisé ici : https://github.com/MTES-MCT/camino-api/pull/689/files#diff-1db3872c94f6300144a0f207a1739031e79bfea3125bd0b78dd44a23e0ea7f3dR26
No description provided.