You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
389 B

# 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
cat migration.sql | sqlite3 data/c3stream.sqlite