Last active
August 29, 2015 13:55
-
-
Save pefoley2/8762811 to your computer and use it in GitHub Desktop.
ircbot sqlite->postgres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
dbname="msbob" | |
sqlite3 db.sqlite .dump >dump | |
sed -i -e "/PRAGMA/d" -e "/sqlite_sequence/d" -e "s/INTEGER PRIMARY KEY AUTOINCREMENT/SERIAL PRIMARY KEY/g" dump | |
dropdb --if-exists $dbname | |
createdb -O ircbot $dbname | |
cat dump | psql -U ircbot -q $dbname | |
rm dump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alter table polls rename column pid to id; | |
alter table log rename column operator to flags; | |
alter table log add column id serial primary key; | |
alter table commands add column id serial primary key; | |
alter table weather_prefs add column id serial primary key; | |
alter table nicks add column id serial primary key; | |
alter table urls add column id serial primary key; | |
alter table poll_responses rename column id to pid; | |
alter table poll_responses add column id serial primary key; | |
alter table poll_responses add FOREIGN KEY(pid) REFERENCES polls(id); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment