mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
74 lines
2.5 KiB
Python
74 lines
2.5 KiB
Python
# 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.
|
|
"""remove sl_tables
|
|
|
|
Revision ID: 007a1abffe7e
|
|
Revises: a6b32d2d07b1
|
|
Create Date: 2024-08-13 15:31:31.478017
|
|
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
from superset.migrations.shared.utils import create_table, drop_fks_for_table, has_table
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "007a1abffe7e"
|
|
down_revision = "a6b32d2d07b1"
|
|
|
|
table_name = "sl_tables"
|
|
|
|
|
|
def upgrade():
|
|
if has_table(table_name):
|
|
drop_fks_for_table(table_name)
|
|
op.drop_table(table_name)
|
|
|
|
|
|
def downgrade():
|
|
create_table(
|
|
table_name,
|
|
sa.Column("uuid", sa.Numeric(precision=16), nullable=True),
|
|
sa.Column("created_on", sa.DateTime(), nullable=True),
|
|
sa.Column("changed_on", sa.DateTime(), nullable=True),
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
sa.Column("database_id", sa.Integer(), nullable=False),
|
|
sa.Column("is_managed_externally", sa.Boolean(), nullable=False),
|
|
sa.Column("catalog", sa.Text(), nullable=True),
|
|
sa.Column("schema", sa.Text(), nullable=True),
|
|
sa.Column("name", sa.Text(), nullable=True),
|
|
sa.Column("external_url", sa.Text(), nullable=True),
|
|
sa.Column("extra_json", sa.Text(), nullable=True),
|
|
sa.Column("created_by_fk", sa.Integer(), nullable=True),
|
|
sa.Column("changed_by_fk", sa.Integer(), nullable=True),
|
|
sa.ForeignKeyConstraint(
|
|
["changed_by_fk"],
|
|
["ab_user.id"],
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["created_by_fk"],
|
|
["ab_user.id"],
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["database_id"],
|
|
["dbs.id"],
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.UniqueConstraint("uuid"),
|
|
)
|