You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ta...@apache.org on 2023/03/30 04:17:26 UTC

[superset] branch tai/fix-tags-pg-enum created (now d3eeb9f92b)

This is an automated email from the ASF dual-hosted git repository.

tai pushed a change to branch tai/fix-tags-pg-enum
in repository https://gitbox.apache.org/repos/asf/superset.git


      at d3eeb9f92b fix(tags): convert postgres enum type to varchar

This branch includes the following new commits:

     new d3eeb9f92b fix(tags): convert postgres enum type to varchar

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[superset] 01/01: fix(tags): convert postgres enum type to varchar

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tai pushed a commit to branch tai/fix-tags-pg-enum
in repository https://gitbox.apache.org/repos/asf/superset.git

commit d3eeb9f92bdbad319d89ab8877a039a7dd00485c
Author: Tai Dupree <td...@gmail.com>
AuthorDate: Wed Mar 29 20:31:00 2023 -0700

    fix(tags): convert postgres enum type to varchar
---
 ...2af1b_drop_postgres_enum_constrains_for_tags.py | 47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/superset/migrations/versions/2023-03-29_20-30_07f9a902af1b_drop_postgres_enum_constrains_for_tags.py b/superset/migrations/versions/2023-03-29_20-30_07f9a902af1b_drop_postgres_enum_constrains_for_tags.py
new file mode 100644
index 0000000000..1b31ba1c0e
--- /dev/null
+++ b/superset/migrations/versions/2023-03-29_20-30_07f9a902af1b_drop_postgres_enum_constrains_for_tags.py
@@ -0,0 +1,47 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""drop postgres enum constrains for tags
+
+Revision ID: 07f9a902af1b
+Revises: b5ea9d343307
+Create Date: 2023-03-29 20:30:10.214951
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '07f9a902af1b'
+down_revision = 'b5ea9d343307'
+
+from alembic import op
+from sqlalchemy.dialects import postgresql
+
+
+def upgrade():
+    conn = op.get_bind()
+    if isinstance(conn.dialect, postgresql.dialect):
+        conn.execute(
+            'ALTER TABLE "tagged_object" ALTER COLUMN "object_type" TYPE VARCHAR'
+        )
+        conn.execute('ALTER TABLE "tag" ALTER COLUMN "type" TYPE VARCHAR')
+        conn.execute("DROP TYPE objecttypes")
+        conn.execute("DROP TYPE tagtypes")
+
+
+def downgrade():
+    # Leaving the column type as VARCHAR in case the column contains values that
+    # do not comply with the previous enum type
+    pass