forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: try to prevent deadlocks when running upgrade (apache#29625)
- Loading branch information
1 parent
e8f5d76
commit 2cc07e6
Showing
8 changed files
with
448 additions
and
197 deletions.
There are no files selected for viewing
197 changes: 0 additions & 197 deletions
197
superset/migrations/versions/2024-05-24_11-31_02f4f7811799_remove_sl__tables.py
This file was deleted.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
...rset/migrations/versions/2024-05-24_11-31_02f4f7811799_remove_sl_dataset_columns_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# 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_dataset_columns tables | ||
Revision ID: 02f4f7811799 | ||
Revises: f7b6750b67e8 | ||
Create Date: 2024-05-24 11:31:57.115586 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
from superset.migrations.shared.constraints import drop_fks_for_table | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "02f4f7811799" | ||
down_revision = "f7b6750b67e8" | ||
|
||
|
||
def upgrade(): | ||
connection = op.get_bind() | ||
if connection.dialect.name != "sqlite": | ||
drop_fks_for_table("sl_dataset_columns") | ||
op.drop_table("sl_dataset_columns") | ||
|
||
|
||
def downgrade(): | ||
op.create_table( | ||
"sl_dataset_columns", | ||
sa.Column("dataset_id", sa.Integer(), nullable=False), | ||
sa.Column("column_id", sa.Integer(), nullable=False), | ||
sa.ForeignKeyConstraint( | ||
["column_id"], | ||
["sl_columns.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["dataset_id"], | ||
["sl_datasets.id"], | ||
), | ||
sa.PrimaryKeyConstraint("dataset_id", "column_id"), | ||
) |
56 changes: 56 additions & 0 deletions
56
superset/migrations/versions/2024-08-13_15-17_39549add7bfc_remove_sl_table_columns_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# 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_table_columns_table | ||
Revision ID: 39549add7bfc | ||
Revises: 02f4f7811799 | ||
Create Date: 2024-08-13 15:17:23.273168 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
from superset.migrations.shared.constraints import drop_fks_for_table | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "39549add7bfc" | ||
down_revision = "02f4f7811799" | ||
|
||
|
||
def upgrade(): | ||
connection = op.get_bind() | ||
if connection.dialect.name != "sqlite": | ||
drop_fks_for_table("sl_table_columns") | ||
op.drop_table("sl_table_columns") | ||
|
||
|
||
def downgrade(): | ||
op.create_table( | ||
"sl_table_columns", | ||
sa.Column("table_id", sa.Integer(), nullable=False), | ||
sa.Column("column_id", sa.Integer(), nullable=False), | ||
sa.ForeignKeyConstraint( | ||
["column_id"], | ||
["sl_columns.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["table_id"], | ||
["sl_tables.id"], | ||
), | ||
sa.PrimaryKeyConstraint("table_id", "column_id"), | ||
) |
56 changes: 56 additions & 0 deletions
56
superset/migrations/versions/2024-08-13_15-23_38f4144e8558_remove_sl_dataset_tables.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# 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_dataset_tables | ||
Revision ID: 38f4144e8558 | ||
Revises: 39549add7bfc | ||
Create Date: 2024-08-13 15:23:28.768963 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
from superset.migrations.shared.constraints import drop_fks_for_table | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "38f4144e8558" | ||
down_revision = "39549add7bfc" | ||
|
||
|
||
def upgrade(): | ||
connection = op.get_bind() | ||
if connection.dialect.name != "sqlite": | ||
drop_fks_for_table("sl_dataset_tables") | ||
op.drop_table("sl_dataset_tables") | ||
|
||
|
||
def downgrade(): | ||
op.create_table( | ||
"sl_dataset_tables", | ||
sa.Column("dataset_id", sa.Integer(), nullable=False), | ||
sa.Column("table_id", sa.Integer(), nullable=False), | ||
sa.ForeignKeyConstraint( | ||
["dataset_id"], | ||
["sl_datasets.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["table_id"], | ||
["sl_tables.id"], | ||
), | ||
sa.PrimaryKeyConstraint("dataset_id", "table_id"), | ||
) |
Oops, something went wrong.