Skip to content

Commit

Permalink
🗃️(api) squash experience index migrations
Browse files Browse the repository at this point in the history
- Renamed protected keyword 'format' in the initial migration
- Added the missing check constraint on 'created_at' and 'updated_at'
- Updated CheckConstraint on Experience table to be strictly positive
  • Loading branch information
wilbrdt committed Nov 19, 2024
1 parent 379275d commit 839fcbb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 103 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""introduce experience index
Revision ID: a113f2ab4dc9
Revision ID: 77a0f0fbb8ab
Revises: 05e3da68582b
Create Date: 2023-11-09 10:33:53.610165
Expand All @@ -14,7 +14,7 @@


# revision identifiers, used by Alembic.
revision: str = "a113f2ab4dc9"
revision: str = "77a0f0fbb8ab"
down_revision: Union[str, None] = "05e3da68582b"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
Expand Down Expand Up @@ -45,14 +45,15 @@ def upgrade() -> None:
sa.Enum("ONE", "TWO", "THREE", "FOUR", name="aggregationlevel"),
nullable=True,
),
sa.Column("format", sa.JSON(), nullable=True),
sa.Column("technical_datatypes", sa.JSON(), nullable=True),
sa.Column("id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
sa.Column("iri", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column(
"language", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=False
),
sa.Column("duration", sa.Integer(), nullable=True),
sa.CheckConstraint("duration >= 0", name="positive-duration"),
sa.CheckConstraint("created_at <= updated_at", name="pre-creation-update"),
sa.CheckConstraint("duration > 0", name="positive-duration"),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("iri"),
)
Expand Down Expand Up @@ -82,6 +83,7 @@ def upgrade() -> None:
sa.Column("id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
sa.Column("source_id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
sa.Column("target_id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
sa.CheckConstraint("created_at <= updated_at", name="pre-creation-update"),
sa.CheckConstraint("source_id != target_id", name="no-self-referential"),
sa.ForeignKeyConstraint(
["source_id"],
Expand Down

0 comments on commit 839fcbb

Please sign in to comment.