Skip to main content

搞定一些小事情

Project description

gaoding

“搞定”一些小事情。

安装

pip install gaoding

命令

update_env_file - 升级 .env 文件

根据示例文件和旧文件生成新的 .env 文件,保留用户修改。

合并规则:

  1. 优先使用用户的修改
  2. 在示例文件中不存在的变量将写入到新文件的末尾,且按字母顺序排序
gaoding update_env_file -d .env.dist -o .env -n .env.new

参数:

  • -d, --dist - 示例 .env 文件路径
  • -o, --old - 旧的 .env 文件路径
  • -n, --new - 新的 .env 文件路径
  • -f, --force - 强制覆盖已存在的新文件

migrate - 数据库迁移管理

基于 golang-migrate 的数据库迁移管理工具。

# 创建新迁移
gaoding migrate create add_users_table

# 执行迁移
gaoding migrate up

# 回滚迁移
gaoding migrate down

# 查看版本
gaoding migrate version

# 强制设置版本
gaoding migrate force 20240101000000

参数:

  • -c, --config - JSON 配置文件路径(默认为当前目录的 migration-config.json)
  • --db - 数据库配置 key(默认:default)

配置文件示例 (migration-config.json):

{
  "databases": {
    "default": {
      "database_url": "postgres://user:pass@localhost:5432/dbname?sslmode=disable",
      "migrations_dir": "./migrations"
    }
  }
}

开发

# 安装开发依赖
pip install -e ".[dev]"

# 运行测试
pytest

许可证

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gaoding-0.0.2.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gaoding-0.0.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file gaoding-0.0.2.tar.gz.

File metadata

  • Download URL: gaoding-0.0.2.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for gaoding-0.0.2.tar.gz
Algorithm Hash digest
SHA256 9ef7f3fd59a82beb6a8d01ad5a1a7925f79b311ce8cb43fe6496406c9d490616
MD5 3585d8ddef8a18c1bd3b4f1054c8cdee
BLAKE2b-256 e2f4b23190f7035bbfb2557dfbbef924f0214a5f22bc183ac0c049acb83bfd3f

See more details on using hashes here.

File details

Details for the file gaoding-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: gaoding-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for gaoding-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3a3371bd8d4c14128da469fca18c1a763fb9704cc65ac851d95210186ca25bfe
MD5 93614edd83ecfe82661aaf69f4ffe0e6
BLAKE2b-256 83b033cc7e8143eeeaee00f51d289798404d8a009ad2d5634b2070d3a93b7d60

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page