Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix migration arborescence * Fix linter * Fix build
- Loading branch information
1 parent
1c51bdb
commit ab26a58
Showing
7 changed files
with
999 additions
and
1 deletion.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
twake/backend/node/src/cli/cmds/migration_cmds/drive-links.ts
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,71 @@ | ||
import ora from "ora"; | ||
import globalResolver from "../../../services/global-resolver"; | ||
import twake from "../../../twake"; | ||
import yargs from "yargs"; | ||
import DriveLinksMigrator from "./php-drive-file/drive-links-migrator-service"; | ||
|
||
const services = [ | ||
"search", | ||
"database", | ||
"webserver", | ||
"auth", | ||
"counter", | ||
"cron", | ||
"message-queue", | ||
"push", | ||
"realtime", | ||
"storage", | ||
"tracker", | ||
"websocket", | ||
"email-pusher", | ||
"files", | ||
]; | ||
|
||
const command: yargs.CommandModule<unknown, unknown> = { | ||
command: "drive-links", | ||
describe: "migrate php drive links items to node", | ||
builder: { | ||
from: { | ||
default: null, | ||
type: "string", | ||
description: "Start migration from this company ID", | ||
}, | ||
onlyCompany: { | ||
default: null, | ||
type: "string", | ||
description: "Migrate only this company ID", | ||
}, | ||
fromItem: { | ||
default: null, | ||
type: "string", | ||
description: "Start migration from this item ID", | ||
}, | ||
fromWorkspace: { | ||
default: null, | ||
type: "string", | ||
description: "Start migration from this workspace ID", | ||
}, | ||
}, | ||
handler: async argv => { | ||
const fromCompany = argv.from as string | null; | ||
const onlyCompany = argv.onlyCompany as string | null; | ||
const fromItem = argv.fromItem as string | null; | ||
const fromWorkspace = argv.fromWorkspace as string | null; | ||
|
||
const spinner = ora({ text: "Migrating php drive - " }).start(); | ||
const platform = await twake.run(services); | ||
await globalResolver.doInit(platform); | ||
const migrator = new DriveLinksMigrator(platform, { | ||
fromCompany, | ||
onlyCompany, | ||
fromItem, | ||
fromWorkspace, | ||
}); | ||
|
||
await migrator.run(); | ||
|
||
return spinner.stop(); | ||
}, | ||
}; | ||
|
||
export default command; |
71 changes: 71 additions & 0 deletions
71
twake/backend/node/src/cli/cmds/migration_cmds/drive-paths.ts
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,71 @@ | ||
import ora from "ora"; | ||
import globalResolver from "../../../services/global-resolver"; | ||
import twake from "../../../twake"; | ||
import yargs from "yargs"; | ||
import DrivePathMigrator from "./php-drive-file/drive-paths-migrator-service"; | ||
|
||
const services = [ | ||
"search", | ||
"database", | ||
"webserver", | ||
"auth", | ||
"counter", | ||
"cron", | ||
"message-queue", | ||
"push", | ||
"realtime", | ||
"storage", | ||
"tracker", | ||
"websocket", | ||
"email-pusher", | ||
"files", | ||
]; | ||
|
||
const command: yargs.CommandModule<unknown, unknown> = { | ||
command: "drive-paths", | ||
describe: "migrate php drive paths items to node", | ||
builder: { | ||
from: { | ||
default: null, | ||
type: "string", | ||
description: "Start migration from this company ID", | ||
}, | ||
onlyCompany: { | ||
default: null, | ||
type: "string", | ||
description: "Migrate only this company ID", | ||
}, | ||
fromItem: { | ||
default: null, | ||
type: "string", | ||
description: "Start migration from this item ID", | ||
}, | ||
fromWorkspace: { | ||
default: null, | ||
type: "string", | ||
description: "Start migration from this workspace ID", | ||
}, | ||
}, | ||
handler: async argv => { | ||
const fromCompany = argv.from as string | null; | ||
const onlyCompany = argv.onlyCompany as string | null; | ||
const fromItem = argv.fromItem as string | null; | ||
const fromWorkspace = argv.fromWorkspace as string | null; | ||
|
||
const spinner = ora({ text: "Migrating php drive - " }).start(); | ||
const platform = await twake.run(services); | ||
await globalResolver.doInit(platform); | ||
const migrator = new DrivePathMigrator(platform, { | ||
fromCompany, | ||
onlyCompany, | ||
fromItem, | ||
fromWorkspace, | ||
}); | ||
|
||
await migrator.run(); | ||
|
||
return spinner.stop(); | ||
}, | ||
}; | ||
|
||
export default command; |
Oops, something went wrong.