1
0
mirror of synced 2024-11-24 06:20:10 +01:00

dbutils: add autocreate option to revision

This commit is contained in:
Kevin Trocolli 2024-03-11 21:24:57 -04:00
parent 6557cac55b
commit b63c2c2d12
2 changed files with 17 additions and 1 deletions

View File

@ -235,3 +235,15 @@ class Data:
"-m", "-m",
message, message,
) )
async def create_revision_auto(self, message: str) -> None:
if not message:
self.logger.info("Message is required for create-revision")
return
self.__alembic_cmd(
"revision",
"--autogenerate",
"-m",
message,
)

View File

@ -22,7 +22,7 @@ if __name__ == "__main__":
parser.add_argument("--email", "-e", type=str, help="Email for the new user") parser.add_argument("--email", "-e", type=str, help="Email for the new user")
parser.add_argument("--access_code", "-a", type=str, help="Access code for new/transfer user", default="00000000000000000000") parser.add_argument("--access_code", "-a", type=str, help="Access code for new/transfer user", default="00000000000000000000")
parser.add_argument("--message", "-m", type=str, help="Revision message") parser.add_argument("--message", "-m", type=str, help="Revision message")
parser.add_argument("action", type=str, help="create, upgrade, create-owner, migrate, create-revision") parser.add_argument("action", type=str, help="create, upgrade, downgrade, create-owner, migrate, create-revision, create-autorevision")
args = parser.parse_args() args = parser.parse_args()
cfg = CoreConfig() cfg = CoreConfig()
@ -66,5 +66,9 @@ if __name__ == "__main__":
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
loop.run_until_complete(data.create_revision(args.message)) loop.run_until_complete(data.create_revision(args.message))
elif args.action == "create-autorevision":
loop = asyncio.get_event_loop()
loop.run_until_complete(data.create_revision_auto(args.message))
else: else:
logging.getLogger("database").info(f"Unknown action {args.action}") logging.getLogger("database").info(f"Unknown action {args.action}")