forked from Dniel97/artemis
dbutils: add create-revision command
This commit is contained in:
parent
19fd008598
commit
fc3f0900b3
@ -219,3 +219,13 @@ class Data:
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
async def create_revision(self, message: str) -> None:
|
||||||
|
if not message:
|
||||||
|
self.logger.info("Message is required for create-revision")
|
||||||
|
return
|
||||||
|
|
||||||
|
self.__alembic_cmd(
|
||||||
|
"revision",
|
||||||
|
"-m",
|
||||||
|
message,
|
||||||
|
)
|
||||||
|
@ -21,6 +21,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("action", type=str, help="create, upgrade, create-owner")
|
parser.add_argument("action", type=str, help="create, upgrade, create-owner")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@ -56,5 +57,9 @@ if __name__ == "__main__":
|
|||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
loop.run_until_complete(data.migrate())
|
loop.run_until_complete(data.migrate())
|
||||||
|
|
||||||
|
elif args.action == "create-revision":
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
|
loop.run_until_complete(data.create_revision(args.message))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logging.getLogger("database").info(f"Unknown action {args.action}")
|
logging.getLogger("database").info(f"Unknown action {args.action}")
|
||||||
|
Loading…
Reference in New Issue
Block a user