-
Notifications
You must be signed in to change notification settings - Fork 963
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
warehouse/migrations/versions/7ca0f1f5e7b3_rollback_attestation_migration.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,32 @@ | ||
# 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. | ||
""" | ||
Rollback attestation migration | ||
Revision ID: 7ca0f1f5e7b3 | ||
Revises: 7f0c9f105f44 | ||
Create Date: 2024-08-21 19:52:40.084048 | ||
""" | ||
|
||
|
||
from alembic import op | ||
|
||
revision = "7ca0f1f5e7b3" | ||
down_revision = "7f0c9f105f44" | ||
|
||
|
||
def upgrade(): | ||
op.drop_table("attestation") | ||
|
||
|
||
def downgrade(): | ||
pass |
46 changes: 46 additions & 0 deletions
46
warehouse/migrations/versions/7f0c9f105f44_create_attestations_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,46 @@ | ||
# 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. | ||
""" | ||
create Attestations table | ||
Revision ID: 7f0c9f105f44 | ||
Revises: 26455e3712a2 | ||
Create Date: 2024-07-25 15:49:01.993869 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
|
||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
|
||
revision = "7f0c9f105f44" | ||
down_revision = "26455e3712a2" | ||
|
||
|
||
def upgrade(): | ||
op.create_table( | ||
"attestation", | ||
sa.Column("file_id", sa.UUID(), nullable=False), | ||
sa.Column( | ||
"attestation_file_blake2_digest", postgresql.CITEXT(), nullable=False | ||
), | ||
sa.Column( | ||
"id", sa.UUID(), server_default=sa.text("gen_random_uuid()"), nullable=False | ||
), | ||
sa.ForeignKeyConstraint( | ||
["file_id"], ["release_files.id"], onupdate="CASCADE", ondelete="CASCADE" | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.drop_table("attestation") |