Skip to content

Commit

Permalink
全てのSQLiteを1つにまとめる
Browse files Browse the repository at this point in the history
  • Loading branch information
utgwkk committed Jul 23, 2022
1 parent 97e3889 commit de515a1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions sql/merge-sqlite-db.sh
@@ -0,0 +1,17 @@
#!/bin/sh
set -exu
cd `dirname $0`

MASTER_DB=../../master.db

for tenant_db in ../../initial_data/*.db; do
cat <<SQL | sqlite3 $MASTER_DB
attach '$tenant_db' as fromMerge;
BEGIN;
insert into competition select * from fromMerge.competition;
insert into player select * from fromMerge.player;
insert into player_score select * from fromMerge.player_score;
COMMIT;
detach fromMerge;
SQL
done

0 comments on commit de515a1

Please sign in to comment.