diff --git a/.idea/.idea.c3stream/.idea/contentModel.xml b/.idea/.idea.c3stream/.idea/contentModel.xml index 47136ac..c34f6eb 100644 --- a/.idea/.idea.c3stream/.idea/contentModel.xml +++ b/.idea/.idea.c3stream/.idea/contentModel.xml @@ -53,6 +53,7 @@ + diff --git a/database.init.sqlite b/database.init.sqlite new file mode 100644 index 0000000..0344993 Binary files /dev/null and b/database.init.sqlite differ diff --git a/v4_to_v5_migrator.sh b/v4_to_v5_migrator.sh new file mode 100755 index 0000000..cb83c86 --- /dev/null +++ b/v4_to_v5_migrator.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Requires jq and sqlite3 + +cp database.init.sqlite data/c3stream.sqlite + +rm migration.sql + +for row in $(cat "data/c3stream.user.json" | jq -c '.[]'); do + echo "INSERT INTO States (TalkId, UserId, State) VALUES ($(echo $row | jq '.TalkId'),$(echo $row | jq '.UserId'),$(echo $row | jq '.State'));" | tee -a migration.sql +done + +cat migration.sql | sqlite3 data/c3stream.sqlite