IntroductionPyMigrate can be used in two ways: stand-alone; inclusion in an application. In either case all that is needed in an initial configuration dictionary, a version to run to and the environment to run in. When PyMigrate runs it will attempt to find a database table called schema_info. If this is not found then one will be created and the default version number will be 0. If one is found the version will be recorded and compared to any/none versions you pass in to run against. Depending on the version of the database and the version you wish to migrate to PyMigrate will run either the up or down sections of the appropriate migration files in order to bring the database into your desired standards. What is a migration manager that doesn't allow the use of native code? Yes PyMigrate will allow you to run native and your Python code as needed. One of the command blocks is code: to allow you to do that. Now, if need be you can create synching classes and code as you see fit. DetailsBy placing the PyMigrate files in the directory you wish you can run: python pymigrate.py on the command line to bring your database up to your migration level. You can include PyMigrate into your application by calling: pm = PyMigrate(<config dictionay>). Then executing the migrations with: pm.run(<version to run None>, <environment> )
|