Created
November 24, 2009 00:52
-
-
Save clutchski/241527 to your computer and use it in GitHub Desktop.
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
""" | |
A Caribou migration demonstrating an interface for database agnostic migrations | |
that doesn't force how you connect to the database. | |
""" | |
def upgrade(connector): | |
# a connector can give you a plain old db api connection | |
conn = connector.connect() | |
conn.execute("create table my_table ...") | |
# or maybe you want to connect with your favorite ORM | |
# like sqlalchemy or storm | |
url = connector.get_sqlachemy_url() | |
sqlalchemy.create_engine(url) | |
# or perhaps you want to do something all to yourself | |
user = connector.user | |
password = connector.user | |
do_something(user, password) | |
def downgrade(connector): | |
# same idea here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment