forked from Hay1tsme/artemis
add database downgrading
This commit is contained in:
parent
bc2b883fa9
commit
c4deff9d1c
@ -118,7 +118,13 @@ class Data:
|
||||
def schema_upgrade(self, ver: str = None):
|
||||
self.__alembic_cmd(
|
||||
"upgrade",
|
||||
"head",
|
||||
"head" if not ver else ver,
|
||||
)
|
||||
|
||||
def schema_downgrade(self, ver: str):
|
||||
self.__alembic_cmd(
|
||||
"downgrade",
|
||||
ver,
|
||||
)
|
||||
|
||||
async def create_owner(self, email: Optional[str] = None, code: Optional[str] = "00000000000000000000") -> None:
|
||||
|
@ -48,6 +48,12 @@ if __name__ == "__main__":
|
||||
elif args.action == "upgrade":
|
||||
data.schema_upgrade(args.version)
|
||||
|
||||
elif args.action == "downgrade":
|
||||
if not args.version:
|
||||
logging.getLogger("database").error(f"Version argument required for downgrade")
|
||||
exit(1)
|
||||
data.schema_downgrade(args.version)
|
||||
|
||||
elif args.action == "create-owner":
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(data.create_owner(args.email, args.access_code))
|
||||
|
Loading…
Reference in New Issue
Block a user