-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add explicit ON DELETE CASCADE for embedded_dashboards
- Loading branch information
1 parent
f6c3f0c
commit cd27612
Showing
4 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
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
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
48 changes: 48 additions & 0 deletions
48
...ersions/2023-08-09_15-39_4448fa6deeb1__dd_on_delete_cascade_for_embedded_dashboards.py.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,48 @@ | ||
# 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. | ||
"""add on delete cascade for embedded dashboards | ||
Revision ID: 4448fa6deeb1 | ||
Revises: 2e826adca42c | ||
Create Date: 2023-08-09 15:39:58.130228 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "4448fa6deeb1" | ||
down_revision = "2e826adca42c" | ||
|
||
from superset.migrations.shared.constraints import ForeignKey, redefine | ||
|
||
foreign_keys = [ | ||
ForeignKey( | ||
table="embedded_dashboards", | ||
referent_table="dashboards", | ||
local_cols=["dashboard_id"], | ||
remote_cols=["id"], | ||
), | ||
] | ||
|
||
|
||
def upgrade(): | ||
for foreign_key in foreign_keys: | ||
redefine(foreign_key, on_delete="CASCADE") | ||
|
||
|
||
def downgrade(): | ||
for foreign_key in foreign_keys: | ||
redefine(foreign_key) |
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