From ba075e817c09f6b1a59c8ff864233a9b05d78738 Mon Sep 17 00:00:00 2001 From: Pedro Nascimento Date: Mon, 8 Jul 2024 14:28:11 -0300 Subject: [PATCH] Creating migration --- api/migrations/app/19_20240708142702_update.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 api/migrations/app/19_20240708142702_update.py diff --git a/api/migrations/app/19_20240708142702_update.py b/api/migrations/app/19_20240708142702_update.py new file mode 100644 index 0000000..bb65134 --- /dev/null +++ b/api/migrations/app/19_20240708142702_update.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +from tortoise import BaseDBAsyncClient + + +async def upgrade(db: BaseDBAsyncClient) -> str: + return """ + ALTER TABLE "mrg__patientaddress" ADD "created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP; + ALTER TABLE "mrg__patientcns" ADD "created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP; + ALTER TABLE "mrg__patienttelecom" ADD "created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP;""" + + +async def downgrade(db: BaseDBAsyncClient) -> str: + return """ + ALTER TABLE "mrg__patientcns" DROP COLUMN "created_at"; + ALTER TABLE "mrg__patientaddress" DROP COLUMN "created_at"; + ALTER TABLE "mrg__patienttelecom" DROP COLUMN "created_at";"""