From ee76bbb8694fbbef291b546ef92919bb89d0cd15 Mon Sep 17 00:00:00 2001 From: avdata99 Date: Fri, 8 Nov 2024 16:15:30 -0300 Subject: [PATCH] Undo hotfix Migration run twice because of the extension renam --- .../001_95aed1f25344_init_extension_models.py | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/ckanext/api_tracking/migration/api_tracking/versions/001_95aed1f25344_init_extension_models.py b/ckanext/api_tracking/migration/api_tracking/versions/001_95aed1f25344_init_extension_models.py index 04bb6a5..39eedff 100644 --- a/ckanext/api_tracking/migration/api_tracking/versions/001_95aed1f25344_init_extension_models.py +++ b/ckanext/api_tracking/migration/api_tracking/versions/001_95aed1f25344_init_extension_models.py @@ -6,8 +6,8 @@ """ from alembic import op -# import sqlalchemy as sa -# from sqlalchemy.dialects import postgresql +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. @@ -18,20 +18,18 @@ def upgrade(): - # Skip first tima after renaming extension - # op.create_table( - # "tracking_usage", - # sa.Column("id", sa.UnicodeText, primary_key=True), - # sa.Column("timestamp", sa.DateTime, server_default=sa.func.current_timestamp()), - # sa.Column("user_id", sa.UnicodeText, nullable=True), - # sa.Column("tracking_type", sa.UnicodeText, nullable=True), - # sa.Column("tracking_sub_type", sa.UnicodeText, nullable=True), - # sa.Column("extras", postgresql.JSONB(astext_type=sa.Text()), nullable=True), - # sa.Column("token_name", sa.UnicodeText, nullable=True), - # sa.Column("object_id", sa.UnicodeText, nullable=True), - # sa.Column("object_type", sa.UnicodeText, nullable=True), - # ) - pass + op.create_table( + "tracking_usage", + sa.Column("id", sa.UnicodeText, primary_key=True), + sa.Column("timestamp", sa.DateTime, server_default=sa.func.current_timestamp()), + sa.Column("user_id", sa.UnicodeText, nullable=True), + sa.Column("tracking_type", sa.UnicodeText, nullable=True), + sa.Column("tracking_sub_type", sa.UnicodeText, nullable=True), + sa.Column("extras", postgresql.JSONB(astext_type=sa.Text()), nullable=True), + sa.Column("token_name", sa.UnicodeText, nullable=True), + sa.Column("object_id", sa.UnicodeText, nullable=True), + sa.Column("object_type", sa.UnicodeText, nullable=True), + ) def downgrade():