summaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-15 11:57:33 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-15 11:57:33 +0900
commit69c452a9809d0af933b3137651b9a18327d3e8a7 (patch)
treef8e91109f95c91d3609cd6ef32c99d9cc31a0831 /migration
parenti18n (diff)
downloadmisskey-69c452a9809d0af933b3137651b9a18327d3e8a7.tar.gz
misskey-69c452a9809d0af933b3137651b9a18327d3e8a7.tar.bz2
misskey-69c452a9809d0af933b3137651b9a18327d3e8a7.zip
:pizza:
Diffstat (limited to 'migration')
-rw-r--r--migration/README.md11
-rw-r--r--migration/init-migration-file.sh37
2 files changed, 48 insertions, 0 deletions
diff --git a/migration/README.md b/migration/README.md
new file mode 100644
index 0000000000..d52e84b35a
--- /dev/null
+++ b/migration/README.md
@@ -0,0 +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/migration/init-migration-file.sh b/migration/init-migration-file.sh
new file mode 100644
index 0000000000..c6a2b862e6
--- /dev/null
+++ b/migration/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"