mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 15:34:13 +00:00 
			
		
		
		
	rename with execution order, add desc & initial creation script
This commit is contained in:
		
							parent
							
								
									12d815dc42
								
							
						
					
					
						commit
						04dd2cb12b
					
				
					 8 changed files with 40 additions and 0 deletions
				
			
		
							
								
								
									
										37
									
								
								tools/init-migration-file.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										37
									
								
								tools/init-migration-file.sh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -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"
 | 
			
		||||
| 
						 | 
				
			
			@ -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 が生成されます
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue