Snippets

RuWeb.net sqlite2mydump.sh

Created by Andrey Chesnakov last modified
#!/bin/sh
umask 0077
echo "SET NAMES utf8;" >dump.sql
echo "SET foreign_key_checks = 0;" >>dump.sql
for table in $(sqlite3 .sqlite.db .tables); do
    newtable=${table#rw}
    [ "$newtable" != "$table" ] || continue
    echo -e ".headers on\n.mode insert $newtable\nselect * from $table;" | sqlite3 .sqlite.db >>dump.sql
done
echo "SET foreign_key_checks = 1;" >>dump.sql
replace ',reply-to,' ',`reply-to`,' -- dump.sql
replace ',"reply-to",' ',`reply-to`,' -- dump.sql

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.