feat(scripts): ✨ Add automatic migration handling to update.py.

This commit is contained in:
2025-03-15 23:30:58 -03:00
parent 0e2a0553e6
commit 9445a9de29
3 changed files with 17 additions and 14 deletions
+2 -11
View File
@@ -1,19 +1,10 @@
[project] [project]
name = "payphone" name = "payphone"
version = "0.42.0" version = "0.43.0"
description = "Add your description here" description = "Add your description here"
readme = "README.md" readme = "README.md"
requires-python = ">=3.12" requires-python = ">=3.12"
dependencies = [ dependencies = [ "aerich>=0.8.2", "aiohttp>=3.10.10", "orjson>=3.10.11", "py-cord>=2.6.1", "redis[hiredis]>=5.2.0", "rich>=13.9.4", "tortoise-orm[accel,asyncpg]>=0.21.7", "typer>=0.13.0",]
"aerich>=0.8.2",
"aiohttp>=3.10.10",
"orjson>=3.10.11",
"py-cord>=2.6.1",
"redis[hiredis]>=5.2.0",
"rich>=13.9.4",
"tortoise-orm[accel,asyncpg]>=0.21.7",
"typer>=0.13.0",
]
[dependency-groups] [dependency-groups]
dev = [ "python-dotenv>=1.0.1", "toml>=0.10.2",] dev = [ "python-dotenv>=1.0.1", "toml>=0.10.2",]
+11
View File
@@ -1,4 +1,5 @@
import os import os
import time
import getpass import getpass
username = input("Username for git.nyeki.dev: ") username = input("Username for git.nyeki.dev: ")
@@ -24,4 +25,14 @@ microk8s kubectl set image pod/tasks \
""" """
) )
print("Waiting 15 seconds to run migrations...")
time.sleep(15)
shards = input("How many shards are there deployed?: ")
os.system(f"microk8s kubectl exec bot-{int(shards) - 1} -- uv run aerich upgrade")
print("Done!")
# expire=registry.nyeki.dev/payphone/payphone/shard:v{latest_version} # expire=registry.nyeki.dev/payphone/payphone/shard:v{latest_version}
Generated
+4 -3
View File
@@ -1,4 +1,5 @@
version = 1 version = 1
revision = 1
requires-python = ">=3.12" requires-python = ">=3.12"
[[package]] [[package]]
@@ -127,7 +128,7 @@ version = "8.1.8"
source = { registry = "https://pypi.org/simple" } source = { registry = "https://pypi.org/simple" }
dependencies = [ dependencies = [
{ name = "anyio" }, { name = "anyio" },
{ name = "colorama", marker = "platform_system == 'Windows'" }, { name = "colorama", marker = "sys_platform == 'win32'" },
] ]
sdist = { url = "https://files.pythonhosted.org/packages/cb/b5/e1e5fdf1c1bb7e6e614987c120a98d9324bf8edfaa5f5cd16a6235c9d91b/asyncclick-8.1.8.tar.gz", hash = "sha256:0f0eb0f280e04919d67cf71b9fcdfb4db2d9ff7203669c40284485c149578e4c", size = 232900 } sdist = { url = "https://files.pythonhosted.org/packages/cb/b5/e1e5fdf1c1bb7e6e614987c120a98d9324bf8edfaa5f5cd16a6235c9d91b/asyncclick-8.1.8.tar.gz", hash = "sha256:0f0eb0f280e04919d67cf71b9fcdfb4db2d9ff7203669c40284485c149578e4c", size = 232900 }
wheels = [ wheels = [
@@ -188,7 +189,7 @@ name = "click"
version = "8.1.8" version = "8.1.8"
source = { registry = "https://pypi.org/simple" } source = { registry = "https://pypi.org/simple" }
dependencies = [ dependencies = [
{ name = "colorama", marker = "platform_system == 'Windows'" }, { name = "colorama", marker = "sys_platform == 'win32'" },
] ]
sdist = { url = "https://files.pythonhosted.org/packages/b9/2e/0090cbf739cee7d23781ad4b89a9894a41538e4fcf4c31dcdd705b78eb8b/click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a", size = 226593 } sdist = { url = "https://files.pythonhosted.org/packages/b9/2e/0090cbf739cee7d23781ad4b89a9894a41538e4fcf4c31dcdd705b78eb8b/click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a", size = 226593 }
wheels = [ wheels = [
@@ -404,7 +405,7 @@ wheels = [
[[package]] [[package]]
name = "payphone" name = "payphone"
version = "0.41.0" version = "0.42.0"
source = { virtual = "." } source = { virtual = "." }
dependencies = [ dependencies = [
{ name = "aerich" }, { name = "aerich" },