Skip to content

Commit

Permalink
馃搧 Fix paths migration (#2793)
Browse files Browse the repository at this point in the history
* Fix migration arborescence

* Fix linter

* Fix build
  • Loading branch information
RomaricMourgues committed May 9, 2023
1 parent 1c51bdb commit ab26a58
Show file tree
Hide file tree
Showing 7 changed files with 999 additions and 1 deletion.
71 changes: 71 additions & 0 deletions twake/backend/node/src/cli/cmds/migration_cmds/drive-links.ts
@@ -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 twake/backend/node/src/cli/cmds/migration_cmds/drive-paths.ts
@@ -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;

0 comments on commit ab26a58

Please sign in to comment.