-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: updated tests and added alembic recipe
- Loading branch information
Fatimah
committed
Feb 19, 2024
1 parent
67f69a8
commit eb08bd2
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
invenio_pages/alembic/b0f93ca4a147_add_has_custom_view_to_pages.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,54 @@ | ||
# | ||
# This file is part of Invenio. | ||
# Copyright (C) 2016-2018 CERN. | ||
# | ||
# Invenio is free software; you can redistribute it and/or modify it | ||
# under the terms of the MIT License; see LICENSE file for more details. | ||
|
||
"""Add has_custom_view to pages.""" | ||
|
||
import sqlalchemy as sa | ||
import sqlalchemy_utils | ||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "b0f93ca4a147" | ||
down_revision = "145402e8523a" | ||
branch_labels = () | ||
depends_on = "98e0a418340d" | ||
|
||
|
||
def upgrade(): | ||
"""Upgrade database.""" | ||
# Add the new column | ||
op.add_column( | ||
"pages_page", | ||
sa.Column( | ||
"has_custom_view", | ||
sa.Boolean(), | ||
nullable=True, | ||
server_default=sa.sql.expression.literal(False), | ||
default=False, | ||
), | ||
) | ||
op.add_column( | ||
"pages_page_version", | ||
sa.Column( | ||
"has_custom_view", | ||
sa.Boolean(), | ||
nullable=True, | ||
server_default=sa.sql.expression.literal(False), | ||
default=False, | ||
), | ||
) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
"""Downgrade database.""" | ||
# Drop the column | ||
op.drop_column("pages_page", "has_custom_view") | ||
op.drop_column("pages_page_version", "has_custom_view") | ||
# ### end Alembic commands ### |
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
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
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