Skip to content

Commit

Permalink
Update clone_schema function in managament command
Browse files Browse the repository at this point in the history
  • Loading branch information
samdoran committed Feb 14, 2024
1 parent a645540 commit 8790ae7
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from django.db.transaction import atomic
from psycopg2 import sql

from api.iam.models import Tenant
from koku.migration_sql_helpers import apply_sql_file


class Command(BaseCommand):
help = "Migrate all tables using 'serial' columns to use 'identity' instead."
Expand Down Expand Up @@ -89,6 +92,11 @@ def handle(self, *args: Any, database: str, write: bool, like: str, schema: str,
for table_name, column_name in column_specs:
migrate_serial_to_identity(database, write, self._output, cursor, table_name, column_name)

self._output("Updating clone_schema SQL function")
apply_sql_file(
connections[database].schema_editor(), Tenant._CLONE_SCHEMA_FUNC_FILENAME, literal_placeholder=True
)

def _output(self, text: str) -> None:
self.stdout.write(text)
self.stdout.flush()
Expand Down

0 comments on commit 8790ae7

Please sign in to comment.