Skip to content

Commit e34909d

Browse files
Macro Execution Summary Logs (#238)
* macro logs * model * alembic * model * model * alembic merge * alembic merge * model
1 parent 7413437 commit e34909d

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
"""add macro execution summary
2+
3+
Revision ID: b7b9f7de1013
4+
Revises: 881102ae15f8
5+
Create Date: 2024-07-29 16:27:34.759906
6+
7+
"""
8+
9+
from alembic import op
10+
import sqlalchemy as sa
11+
from sqlalchemy.dialects import postgresql
12+
13+
# revision identifiers, used by Alembic.
14+
revision = "b7b9f7de1013"
15+
down_revision = "881102ae15f8"
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.create_table(
23+
"macro_execution_summary",
24+
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
25+
sa.Column("organization_id", postgresql.UUID(as_uuid=True), nullable=True),
26+
sa.Column("creation_month", sa.Date(), nullable=True),
27+
sa.Column("macro_type", sa.String(), nullable=True),
28+
sa.Column("execution_count", sa.Integer(), nullable=True),
29+
sa.Column("processed_files_count", sa.Integer(), nullable=True),
30+
sa.ForeignKeyConstraint(
31+
["organization_id"], ["organization.id"], ondelete="CASCADE"
32+
),
33+
sa.PrimaryKeyConstraint("id"),
34+
sa.UniqueConstraint(
35+
"organization_id",
36+
"creation_month",
37+
"macro_type",
38+
name="unique_macro_summary",
39+
),
40+
schema="cognition",
41+
)
42+
op.create_index(
43+
op.f("ix_cognition_macro_execution_summary_creation_month"),
44+
"macro_execution_summary",
45+
["creation_month"],
46+
unique=False,
47+
schema="cognition",
48+
)
49+
op.create_index(
50+
op.f("ix_cognition_macro_execution_summary_organization_id"),
51+
"macro_execution_summary",
52+
["organization_id"],
53+
unique=False,
54+
schema="cognition",
55+
)
56+
# ### end Alembic commands ###
57+
58+
59+
def downgrade():
60+
# ### commands auto generated by Alembic - please adjust! ###
61+
op.drop_index(
62+
op.f("ix_cognition_macro_execution_summary_organization_id"),
63+
table_name="macro_execution_summary",
64+
schema="cognition",
65+
)
66+
op.drop_index(
67+
op.f("ix_cognition_macro_execution_summary_creation_month"),
68+
table_name="macro_execution_summary",
69+
schema="cognition",
70+
)
71+
op.drop_table("macro_execution_summary", schema="cognition")
72+
# ### end Alembic commands ###

0 commit comments

Comments
 (0)