From 04dd2cb12bdc5a72ad004802be68c9867efe05a6 Mon Sep 17 00:00:00 2001 From: otofune Date: Tue, 7 Nov 2017 23:38:18 +0900 Subject: [PATCH] rename with execution order, add desc & initial creation script --- tools/init-migration-file.sh | 37 +++++++++++++++++++ tools/migration/README.md | 3 ++ ...ridfs.js => node.1509958623.use-gridfs.js} | 0 ...hange-gridfs-metadata-name-to-filename.js} | 0 ...ue_882.js => node.1510056272.issue_882.js} | 0 ...le.js => shell.1487734995.user-profile.js} | 0 ... => shell.1489951459.like-to-reactions.js} | 0 ... => shell.1509507382.reply_to-to-reply.js} | 0 8 files changed, 40 insertions(+) create mode 100755 tools/init-migration-file.sh rename tools/migration/{use-gridfs.js => node.1509958623.use-gridfs.js} (100%) rename tools/migration/{change-gridfs-metadata-name-to-filename.js => node.1510016282.change-gridfs-metadata-name-to-filename.js} (100%) rename tools/migration/{issue_882.js => node.1510056272.issue_882.js} (100%) rename tools/migration/{user-profile.js => shell.1487734995.user-profile.js} (100%) rename tools/migration/{like-to-reactions.js => shell.1489951459.like-to-reactions.js} (100%) rename tools/migration/{reply_to-to-reply.js => shell.1509507382.reply_to-to-reply.js} (100%) diff --git a/tools/init-migration-file.sh b/tools/init-migration-file.sh new file mode 100755 index 000000000..c6a2b862e --- /dev/null +++ b/tools/init-migration-file.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +usage() { + echo "$0 [-t type] [-n name]" + echo " type: [node | shell]" + echo " name: if no present, set untitled" + exit 0 +} + +while getopts :t:n:h OPT +do + case $OPT in + t) type=$OPTARG + ;; + n) name=$OPTARG + ;; + h) usage + ;; + \?) usage + ;; + :) usage + ;; + esac +done + +if [ "$type" = "" ] +then + echo "no type present!!!" + usage +fi + +if [ "$name" = "" ] +then + name="untitled" +fi + +touch "$(realpath $(dirname $BASH_SOURCE))/migration/$type.$(date +%s).$name.js" diff --git a/tools/migration/README.md b/tools/migration/README.md index cd553efb9..d52e84b35 100644 --- a/tools/migration/README.md +++ b/tools/migration/README.md @@ -1,8 +1,11 @@ Misskeyの破壊的変更に対応するいくつかのスニペットがあります。 MongoDBシェルで実行する必要のあるものとnodeで直接実行する必要のあるものがあります。 +ファイル名が `shell.` から始まるものは前者、 `node.` から始まるものは後者です。 MongoDBシェルで実行する場合、`use`でデータベースを選択しておく必要があります。 nodeで実行するいくつかのスニペットは、並列処理させる数を引数で設定できるものがあります。 処理中にエラーで落ちる場合は、メモリが足りていない可能性があるので、少ない数に設定してみてください。 ※デフォルトは`5`です。 + +ファイルを作成する際は `../init-migration-file.sh -t _type_ -n _name_` を実行すると _type_._unixtime_._name_.js が生成されます diff --git a/tools/migration/use-gridfs.js b/tools/migration/node.1509958623.use-gridfs.js similarity index 100% rename from tools/migration/use-gridfs.js rename to tools/migration/node.1509958623.use-gridfs.js diff --git a/tools/migration/change-gridfs-metadata-name-to-filename.js b/tools/migration/node.1510016282.change-gridfs-metadata-name-to-filename.js similarity index 100% rename from tools/migration/change-gridfs-metadata-name-to-filename.js rename to tools/migration/node.1510016282.change-gridfs-metadata-name-to-filename.js diff --git a/tools/migration/issue_882.js b/tools/migration/node.1510056272.issue_882.js similarity index 100% rename from tools/migration/issue_882.js rename to tools/migration/node.1510056272.issue_882.js diff --git a/tools/migration/user-profile.js b/tools/migration/shell.1487734995.user-profile.js similarity index 100% rename from tools/migration/user-profile.js rename to tools/migration/shell.1487734995.user-profile.js diff --git a/tools/migration/like-to-reactions.js b/tools/migration/shell.1489951459.like-to-reactions.js similarity index 100% rename from tools/migration/like-to-reactions.js rename to tools/migration/shell.1489951459.like-to-reactions.js diff --git a/tools/migration/reply_to-to-reply.js b/tools/migration/shell.1509507382.reply_to-to-reply.js similarity index 100% rename from tools/migration/reply_to-to-reply.js rename to tools/migration/shell.1509507382.reply_to-to-reply.js