人类迁移管理器

nomade的Python项目详细描述


^{1}$ 在

Python Migration Manager for Humans :camel:

Nomade是一个简单的迁移管理器工具,其目标是易于与任何ORM(例如SQLAlchemyPeeweePony)和数据库(例如SQLiteMySQLPostgreSQL)集成。它基本上是一个命令行界面(CLI)工具,它通过将更改应用于数据库模式并存储当前迁移ID来管理迁移(Python文件)

这个工具的灵感来源于alembic(如果您使用SQLAlchemy作为ORM,那么应该考虑使用alembic)。在

Note: this project is still under development so you may find bugs. If you find any bug, feel free to contribute by creating an issue and/or submitting a PR to fix it.

安装

使用pip安装Nomade:

$ pip install nomade

快速入门

初始化Nomade项目:

^{pr2}$

它将创建以下项目结构:

.
├── nomade
│   ├── template.py.j2
│   └── migrations
└── pyproject.toml

pyproject.toml文件中定义Nomade设置,例如:

[tool.nomade]migrations="nomade/migrations"template="nomade/template.py.j2"connection-string="sqlite:///nomade.db"date-format="%d/%m/%Y"name-format="{date}_{time}_{id}_{slug}"

然后,创建第一个迁移:

$ nomade migrate "Create first table"

在迁移文件中实现upgradedowngrade函数。在

然后将迁移应用到数据库:

$ nomade upgrade head

要了解更多Nomade功能,请阅读文档或致电寻求帮助:

$ nomade --help

Usage: nomade [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  current    Show the current migration.
  downgrade  Downgrade migrations.
  history    Show migrations history.
  init       Init a Nomade project.
  migrate    Create a new migration.
  stamp      Stamp a specific migration to the database.
  upgrade    Upgrade migrations.
  version    Show Nomade version.

如何作出贡献

  • 检查是否存在未解决的问题,或者打开一个新的问题,围绕一个特性想法或一个bug展开讨论。在
  • 通过阅读Contributor's Guide对项目更加熟悉。在

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

推荐PyPI第三方库


热门话题
jsoup有效文件路径抛出java。木卫一。FileNotFoundException   java如何在不删除和添加Mapbox中的层的情况下更改SymbolLayer的Z值?   java计算用户定义年数内四个季度的降雨量   如何在Java中轻松地将格式为“20 0F 01”的字符串更改为十六进制值?   java在JPA或Hibernate中“持久类”和“实体”之间有什么区别?   java Android:AlarmManager“缺少对unregisterReceiver()的调用?”当按下后退按钮时   logcat中的java错误“isDataSchedulerEnabled():false”   java i/p col特性必须是字符串或数字类型,但不能是org。阿帕奇。火花利纳格小姐。向量   java如何从Post请求url和浏览器转储中隐藏密码   多线程javamail中的java问题   java我的用户应该直接连接到数据库吗?如何将用户连接到数据库;   java如何获得Spring数据JPA存储库工厂?   windows java字节数组转换为字符串,但不同的操作系统会产生不同的结果   java代码在eclipse中编译,但不在命令行上编译