mirror of https://gitlab.com/tildes/tildes.git
Deimos
6 years ago
8 changed files with 95 additions and 1 deletions
-
36tildes/alembic/versions/bcf1406bb6c5_add_admin_tool_for_removing_topics.py
-
2tildes/tildes/enums.py
-
5tildes/tildes/models/log/log.py
-
2tildes/tildes/models/topic/topic.py
-
1tildes/tildes/routes.py
-
26tildes/tildes/templates/topic.jinja2
-
22tildes/tildes/views/api/web/topic.py
-
2tildes/tildes/views/topic.py
@ -0,0 +1,36 @@ |
|||
"""Add admin tool for removing topics |
|||
|
|||
Revision ID: bcf1406bb6c5 |
|||
Revises: 50c251c4a19c |
|||
Create Date: 2018-08-22 23:56:41.733065 |
|||
|
|||
""" |
|||
from alembic import op |
|||
import sqlalchemy as sa |
|||
|
|||
|
|||
# revision identifiers, used by Alembic. |
|||
revision = "bcf1406bb6c5" |
|||
down_revision = "50c251c4a19c" |
|||
branch_labels = None |
|||
depends_on = None |
|||
|
|||
|
|||
def upgrade(): |
|||
# ALTER TYPE doesn't work from inside a transaction, disable it |
|||
connection = None |
|||
if not op.get_context().as_sql: |
|||
connection = op.get_bind() |
|||
connection.execution_options(isolation_level="AUTOCOMMIT") |
|||
|
|||
op.execute("ALTER TYPE logeventtype ADD VALUE IF NOT EXISTS 'TOPIC_REMOVE'") |
|||
op.execute("ALTER TYPE logeventtype ADD VALUE IF NOT EXISTS 'TOPIC_UNREMOVE'") |
|||
|
|||
# re-activate the transaction for any future migrations |
|||
if connection is not None: |
|||
connection.execution_options(isolation_level="READ_COMMITTED") |
|||
|
|||
|
|||
def downgrade(): |
|||
# no way to remove enum values, just do nothing |
|||
pass |
Write
Preview
Loading…
Cancel
Save
Reference in new issue