禁欲主义的数据库迁移。使用原始数据库迁移来增强python应用程序的最简单方法

amigrations的Python项目详细描述


禁欲主义迁移

Travis CI statusCoveralls status

对于我的个人项目,我想使用原始sql迁移。例如,django生成丑陋的 密钥名称:类似于:密钥号

安装

只需在bash中运行:

pip install amigrations

用法

fromamigratonsimportAMigrationsamigrations=AMigrations('mysql://root:123456@localhost:3306/amigrations_test',path_to_folder_with_migrations)files_created=amigrations.create(migraiton_message)# files_created is a dictionary with two keys: up and down. If you want immediately update migration content, please# do followingwithfiles_created['up'].open('w')asfpu,files_created['down'].open('w')asfpd:fpu.write('CREATE TABLE test (id int(11) not null AUTO_INCREMENT, PRIMARY KEY(id))')fpd.write('drop table test')# run db upgradeamigrations.upgrade()# please pass migration id you want to downgrade to, includingamigrations.downgrade_to(downgrade_to_id)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java SimpleFramework和工厂方法   Java适当地处理异常   java单例类不起作用   java小程序和Swing在eclipse中不显示组件   多个键上的java Redisson FastRemove不起作用   java验证请求正文不等于模式   在Java中从URL读取数据   eche RecyclerView项的java Set自定义字体   string Java如何从Date获取HH:mm:ss   当Java应用程序落后于负载均衡器时,在某些URL上强制使用SSL   使用esapi时发生java错误   java使用流根据第二个列表中的值更新一个列表中的对象   组织。openqa。硒。Java中的NoTouchElementException WebDriver?   从JSON字符串Java创建CSV文件