-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path04407ca2b4ef_add_activity_time_columns.py
More file actions
49 lines (42 loc) · 1.36 KB
/
04407ca2b4ef_add_activity_time_columns.py
File metadata and controls
49 lines (42 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""Add activity time columns
Revision ID: 04407ca2b4ef
Revises: 04653332ed3a
Create Date: 2021-12-20 00:13:17.086241
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "04407ca2b4ef"
down_revision = "04653332ed3a"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"story_translations_all",
sa.Column("reviewer_last_activity", sa.DateTime(), nullable=True),
)
op.add_column(
"story_translations_all",
sa.Column("translator_last_activity", sa.DateTime(), nullable=True),
)
active_translations_view = """
CREATE OR REPLACE VIEW story_translations
AS
SELECT * from story_translations_all
WHERE is_deleted=0;
"""
op.execute(active_translations_view)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("story_translations_all", "translator_last_activity")
op.drop_column("story_translations_all", "reviewer_last_activity")
active_translations_view = """
CREATE OR REPLACE VIEW story_translations
AS
SELECT * from story_translations_all
WHERE is_deleted=0;
"""
op.execute(active_translations_view)
# ### end Alembic commands ###