-
Notifications
You must be signed in to change notification settings - Fork 965
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…15832) * Add ondelete and onupdate attributes to macaroon warning table * Add test for ondelete behavior for macaroon warning table
- Loading branch information
1 parent
1e35a5d
commit c2b207d
Showing
3 changed files
with
147 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
52 changes: 52 additions & 0 deletions
52
warehouse/migrations/versions/78ecf599841c_change_ondelete_macaroon_warning_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,52 @@ | ||
# Licensed 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. | ||
""" | ||
change_ondelete_macaroon_warning_table | ||
Revision ID: 78ecf599841c | ||
Revises: 444353e3eca2 | ||
Create Date: 2024-04-22 15:50:58.878673 | ||
""" | ||
|
||
from alembic import op | ||
|
||
revision = "78ecf599841c" | ||
down_revision = "444353e3eca2" | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint( | ||
"project_macaroon_warning_association_project_id_fkey", | ||
"project_macaroon_warning_association", | ||
type_="foreignkey", | ||
) | ||
op.create_foreign_key( | ||
None, | ||
"project_macaroon_warning_association", | ||
"projects", | ||
["project_id"], | ||
["id"], | ||
onupdate="CASCADE", | ||
ondelete="CASCADE", | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.drop_constraint(None, "project_macaroon_warning_association", type_="foreignkey") | ||
op.create_foreign_key( | ||
"project_macaroon_warning_association_project_id_fkey", | ||
"project_macaroon_warning_association", | ||
"projects", | ||
["project_id"], | ||
["id"], | ||
) |
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