Skip to content

Commit

Permalink
Fixup migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
di committed Aug 21, 2024
1 parent 2622813 commit 98206c5
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
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
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")

0 comments on commit 98206c5

Please sign in to comment.