-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The default was wrong, the `"now()"` was executed when building the database, resulting in a default of a constant value instead of the function `now()`
- Loading branch information
Showing
2 changed files
with
44 additions
and
11 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
backend/alembic/versions/1961954c0320_fix_created_columns.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,33 @@ | ||
"""fix created columns | ||
Revision ID: 1961954c0320 | ||
Revises: 19ddf67a4eeb | ||
Create Date: 2024-05-14 18:52:54.234776 | ||
""" | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str | None = "1961954c0320" | ||
down_revision: str | None = "19ddf67a4eeb" | ||
branch_labels: str | None = None | ||
depends_on: str | None = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.execute("ALTER TABLE clubs ALTER COLUMN created SET DEFAULT NOW();") | ||
op.execute("ALTER TABLE tournaments ALTER COLUMN created SET DEFAULT NOW();") | ||
op.execute("ALTER TABLE stages ALTER COLUMN created SET DEFAULT NOW();") | ||
op.execute("ALTER TABLE stage_items ALTER COLUMN created SET DEFAULT NOW();") | ||
op.execute("ALTER TABLE rounds ALTER COLUMN created SET DEFAULT NOW();") | ||
op.execute("ALTER TABLE matches ALTER COLUMN created SET DEFAULT NOW();") | ||
op.execute("ALTER TABLE teams ALTER COLUMN created SET DEFAULT NOW();") | ||
op.execute("ALTER TABLE players ALTER COLUMN created SET DEFAULT NOW();") | ||
op.execute("ALTER TABLE users ALTER COLUMN created SET DEFAULT NOW();") | ||
op.execute("ALTER TABLE courts ALTER COLUMN created SET DEFAULT NOW();") | ||
|
||
|
||
def downgrade() -> None: | ||
# No rollback because it will introduce bugs. | ||
pass |
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