add db migration tool
This commit is contained in:
parent
5971c8ff5d
commit
9d882d2c4a
|
@ -53,6 +53,7 @@
|
||||||
</e>
|
</e>
|
||||||
</e>
|
</e>
|
||||||
<e p="packages" t="ExcludeRecursive" />
|
<e p="packages" t="ExcludeRecursive" />
|
||||||
|
<e p="v4_to_v5_migrator.sh" t="Include" />
|
||||||
<e p="wwwroot" t="Include">
|
<e p="wwwroot" t="Include">
|
||||||
<e p="css" t="Include">
|
<e p="css" t="Include">
|
||||||
<e p="fa.css" t="Include" />
|
<e p="fa.css" t="Include" />
|
||||||
|
|
Binary file not shown.
|
@ -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
|
Loading…
Reference in New Issue