Created
November 14, 2009 18:08
-
-
Save clutchski/234667 to your computer and use it in GitHub Desktop.
an example of a caribou migration
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
""" | |
an example of a caribou migration | |
""" | |
def upgrade(connection): | |
sql = """ | |
create table animals | |
( name TEXT | |
, status TEXT | |
) """ | |
connection.execute(sql) | |
animals = [ ('caribou', 'least concerned') | |
, ('bengal tiger', 'threatened') | |
, ('eastern elk', 'extinct') | |
] | |
sql = 'insert into animals values (:1, :2) | |
for name, status in animals: | |
connection.execute(sql, [name, status]) | |
connection.commit() | |
def downgrade(connection): | |
connection.execute('drop table animals') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment