From 172b2c4c1498cb457cf536011c01bc27ded82878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Sat, 23 Dec 2023 18:17:39 +0100 Subject: [PATCH 01/17] submodule --- submodules/model | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/model b/submodules/model index 0d18f4d1..74dac66c 160000 --- a/submodules/model +++ b/submodules/model @@ -1 +1 @@ -Subproject commit 0d18f4d1d8c952ce572998f360ce509f2ec3494a +Subproject commit 74dac66ce9538e05f6aab9fe8ec77bb4337efbf5 From 4c4bb65c448401ec5d8afbd9b1df047e9d32bf08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Sun, 24 Dec 2023 11:55:58 +0100 Subject: [PATCH 02/17] init commit rework --- ..._update_cognition_tables_for_cognition_.py | 57 +++++++++++++++++++ submodules/model | 2 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py diff --git a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py new file mode 100644 index 00000000..07d3ea0a --- /dev/null +++ b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py @@ -0,0 +1,57 @@ +"""update cognition tables for cognition-apps + +Revision ID: 8a340c2ee913 +Revises: f6bca8990840 +Create Date: 2023-12-24 01:16:44.644352 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '8a340c2ee913' +down_revision = 'f6bca8990840' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + + op.add_column('message', sa.Column('feedback_value', sa.String(), nullable=True), schema='cognition') + op.add_column('message', sa.Column('feedback_category', sa.String(), nullable=True), schema='cognition') + op.add_column('message', sa.Column('selection_widget', sa.ARRAY(sa.JSON()), nullable=True), schema='cognition') + + op.add_column('strategy_step', sa.Column('progress_text', sa.String(), nullable=True), schema='cognition') + op.add_column('strategy_step', sa.Column('enable_emissions', sa.Boolean(), nullable=True), schema='cognition') + op.add_column('strategy_step', sa.Column('execute_if_source_code', sa.String(), nullable=True), schema='cognition') + + op.add_column('pipeline_logs', sa.Column('skipped_step', sa.Boolean(), nullable=True), schema='cognition') + + op.add_column('project', sa.Column('interface_type', sa.String(), nullable=True), schema='cognition') + op.add_column('project', sa.Column('execute_query_enrichment_if_source_code', sa.String(), nullable=True), schema='cognition') + + op.drop_column('message', 'positive_feedback', schema='cognition') + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + + op.add_column('message', sa.Column('positive_feedback', sa.Boolean(), nullable=True), schema='cognition') + + op.drop_column('project', 'execute_query_enrichment_if_source_code', schema='cognition') + op.drop_column('project', 'interface_type', schema='cognition') + + op.drop_column('pipeline_logs', 'skipped_step', schema='cognition') + + op.drop_column('strategy_step', 'execute_if_source_code', schema='cognition') + op.drop_column('strategy_step', 'enable_emissions', schema='cognition') + op.drop_column('strategy_step', 'progress_text', schema='cognition') + + op.drop_column('message', 'feedback_category', schema='cognition') + op.drop_column('message', 'feedback_value', schema='cognition') + + # ### end Alembic commands ### diff --git a/submodules/model b/submodules/model index 19f5598f..fe98fc4e 160000 --- a/submodules/model +++ b/submodules/model @@ -1 +1 @@ -Subproject commit 19f5598f7f748c161e650c05f786f8f32faeb1bd +Subproject commit fe98fc4e68b5f191df69e0170154585712063ba4 From a1bb2194a8135ff1df6cd2c38ca41a4388376a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Mon, 25 Dec 2023 01:45:43 +0100 Subject: [PATCH 03/17] custom colors --- .../8a340c2ee913_update_cognition_tables_for_cognition_.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py index 07d3ea0a..385a0dbb 100644 --- a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py +++ b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py @@ -31,6 +31,10 @@ def upgrade(): op.add_column('project', sa.Column('interface_type', sa.String(), nullable=True), schema='cognition') op.add_column('project', sa.Column('execute_query_enrichment_if_source_code', sa.String(), nullable=True), schema='cognition') + op.add_column('project', sa.Column('interface_type', sa.String(), nullable=True), schema='cognition') + op.add_column('project', sa.Column('customer_logo_uri', sa.String(), nullable=True), schema='cognition') + op.add_column('project', sa.Column('customer_color_primary', sa.String(), nullable=True), schema='cognition') + op.add_column('project', sa.Column('customer_color_secondary', sa.String(), nullable=True), schema='cognition') op.drop_column('message', 'positive_feedback', schema='cognition') @@ -44,6 +48,9 @@ def downgrade(): op.drop_column('project', 'execute_query_enrichment_if_source_code', schema='cognition') op.drop_column('project', 'interface_type', schema='cognition') + op.drop_column('project', 'customer_logo_uri', schema='cognition') + op.drop_column('project', 'customer_color_primary', schema='cognition') + op.drop_column('project', 'customer_color_secondary', schema='cognition') op.drop_column('pipeline_logs', 'skipped_step', schema='cognition') From e5a6490b0b89f75f8e22a5f0be568eb7be15ff95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Mon, 25 Dec 2023 11:55:01 +0100 Subject: [PATCH 04/17] remove column for uri --- .../8a340c2ee913_update_cognition_tables_for_cognition_.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py index 385a0dbb..dd253371 100644 --- a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py +++ b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py @@ -31,8 +31,6 @@ def upgrade(): op.add_column('project', sa.Column('interface_type', sa.String(), nullable=True), schema='cognition') op.add_column('project', sa.Column('execute_query_enrichment_if_source_code', sa.String(), nullable=True), schema='cognition') - op.add_column('project', sa.Column('interface_type', sa.String(), nullable=True), schema='cognition') - op.add_column('project', sa.Column('customer_logo_uri', sa.String(), nullable=True), schema='cognition') op.add_column('project', sa.Column('customer_color_primary', sa.String(), nullable=True), schema='cognition') op.add_column('project', sa.Column('customer_color_secondary', sa.String(), nullable=True), schema='cognition') @@ -48,7 +46,6 @@ def downgrade(): op.drop_column('project', 'execute_query_enrichment_if_source_code', schema='cognition') op.drop_column('project', 'interface_type', schema='cognition') - op.drop_column('project', 'customer_logo_uri', schema='cognition') op.drop_column('project', 'customer_color_primary', schema='cognition') op.drop_column('project', 'customer_color_secondary', schema='cognition') From f1d819aabd6dcadf59581147518a78e3256ef698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Mon, 25 Dec 2023 23:55:39 +0100 Subject: [PATCH 05/17] custom colors --- .../8a340c2ee913_update_cognition_tables_for_cognition_.py | 1 + 1 file changed, 1 insertion(+) diff --git a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py index dd253371..d18c5ba7 100644 --- a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py +++ b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py @@ -32,6 +32,7 @@ def upgrade(): op.add_column('project', sa.Column('interface_type', sa.String(), nullable=True), schema='cognition') op.add_column('project', sa.Column('execute_query_enrichment_if_source_code', sa.String(), nullable=True), schema='cognition') op.add_column('project', sa.Column('customer_color_primary', sa.String(), nullable=True), schema='cognition') + op.add_column('project', sa.Column('customer_color_primary_only_accent', sa.Boolean(), nullable=True), schema='cognition') op.add_column('project', sa.Column('customer_color_secondary', sa.String(), nullable=True), schema='cognition') op.drop_column('message', 'positive_feedback', schema='cognition') From bd447a853787847c8f8449cd6d30c8d38ce2dfe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Tue, 26 Dec 2023 16:32:30 +0100 Subject: [PATCH 06/17] i18n --- .../8a340c2ee913_update_cognition_tables_for_cognition_.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py index d18c5ba7..d8b225be 100644 --- a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py +++ b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py @@ -35,6 +35,8 @@ def upgrade(): op.add_column('project', sa.Column('customer_color_primary_only_accent', sa.Boolean(), nullable=True), schema='cognition') op.add_column('project', sa.Column('customer_color_secondary', sa.String(), nullable=True), schema='cognition') + op.add_column('user', sa.Column('language_display', sa.String(), nullable=True)) + op.drop_column('message', 'positive_feedback', schema='cognition') # ### end Alembic commands ### @@ -45,6 +47,8 @@ def downgrade(): op.add_column('message', sa.Column('positive_feedback', sa.Boolean(), nullable=True), schema='cognition') + op.drop_column('user', 'language_display') + op.drop_column('project', 'execute_query_enrichment_if_source_code', schema='cognition') op.drop_column('project', 'interface_type', schema='cognition') op.drop_column('project', 'customer_color_primary', schema='cognition') From 37c97f17a132e6245c91d3109636f4d8867389c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Wed, 27 Dec 2023 17:04:14 +0100 Subject: [PATCH 07/17] consumption statistics --- ..._update_cognition_tables_for_cognition_.py | 1 + .../ff7dfeda5c2b_adds_consumption_logs.py | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 alembic/versions/ff7dfeda5c2b_adds_consumption_logs.py diff --git a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py index d8b225be..018f83c8 100644 --- a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py +++ b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py @@ -62,5 +62,6 @@ def downgrade(): op.drop_column('message', 'feedback_category', schema='cognition') op.drop_column('message', 'feedback_value', schema='cognition') + op.drop_column('message', 'selection_widget', schema='cognition') # ### end Alembic commands ### diff --git a/alembic/versions/ff7dfeda5c2b_adds_consumption_logs.py b/alembic/versions/ff7dfeda5c2b_adds_consumption_logs.py new file mode 100644 index 00000000..5e7b1045 --- /dev/null +++ b/alembic/versions/ff7dfeda5c2b_adds_consumption_logs.py @@ -0,0 +1,48 @@ +"""adds consumption logs + +Revision ID: ff7dfeda5c2b +Revises: 8a340c2ee913 +Create Date: 2023-12-27 12:46:15.429502 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = 'ff7dfeda5c2b' +down_revision = '8a340c2ee913' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table( + "consumption_log", + sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), + sa.Column("project_id", postgresql.UUID(as_uuid=True), nullable=True), + sa.Column("strategy_id", postgresql.UUID(as_uuid=True), nullable=True), + sa.Column("conversation_id", postgresql.UUID(as_uuid=True), nullable=True), + sa.Column("message_id", postgresql.UUID(as_uuid=True), nullable=True), + sa.Column("created_by", postgresql.UUID(as_uuid=True), nullable=True), + sa.Column("created_at", sa.DateTime(), nullable=True), + sa.Column("complexity", sa.String(), nullable=True), + sa.Column("state", sa.String(), nullable=True), + sa.ForeignKeyConstraint(["created_by"], ["user.id"], ondelete="SET NULL"), + sa.ForeignKeyConstraint( + ["project_id"], ["cognition.project.id"], ondelete="SET NULL" + ), + sa.ForeignKeyConstraint( + ["strategy_id"], ["cognition.strategy.id"], ondelete="SET NULL" + ), + sa.PrimaryKeyConstraint("id"), + schema="cognition", + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_table("consumption_log", schema="cognition") + # ### end Alembic commands ### From 2c8dd58f8a578973b49a77dd1d113abaf72438b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Thu, 28 Dec 2023 18:07:25 +0100 Subject: [PATCH 08/17] adds header --- .../8a340c2ee913_update_cognition_tables_for_cognition_.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py index 018f83c8..4b3425bd 100644 --- a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py +++ b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py @@ -22,6 +22,8 @@ def upgrade(): op.add_column('message', sa.Column('feedback_value', sa.String(), nullable=True), schema='cognition') op.add_column('message', sa.Column('feedback_category', sa.String(), nullable=True), schema='cognition') op.add_column('message', sa.Column('selection_widget', sa.ARRAY(sa.JSON()), nullable=True), schema='cognition') + op.add_column('message', sa.Column('header', sa.String(), nullable=True), schema='cognition') + op.add_column('strategy_step', sa.Column('progress_text', sa.String(), nullable=True), schema='cognition') op.add_column('strategy_step', sa.Column('enable_emissions', sa.Boolean(), nullable=True), schema='cognition') @@ -60,6 +62,7 @@ def downgrade(): op.drop_column('strategy_step', 'enable_emissions', schema='cognition') op.drop_column('strategy_step', 'progress_text', schema='cognition') + op.drop_column('message', 'header', schema='cognition') op.drop_column('message', 'feedback_category', schema='cognition') op.drop_column('message', 'feedback_value', schema='cognition') op.drop_column('message', 'selection_widget', schema='cognition') From ab962b3190b904d55c803da83b2d4ddeb72b3e00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Thu, 28 Dec 2023 18:45:33 +0100 Subject: [PATCH 09/17] header in conversation, not message --- .../8a340c2ee913_update_cognition_tables_for_cognition_.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py index 4b3425bd..13c3f033 100644 --- a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py +++ b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py @@ -22,8 +22,8 @@ def upgrade(): op.add_column('message', sa.Column('feedback_value', sa.String(), nullable=True), schema='cognition') op.add_column('message', sa.Column('feedback_category', sa.String(), nullable=True), schema='cognition') op.add_column('message', sa.Column('selection_widget', sa.ARRAY(sa.JSON()), nullable=True), schema='cognition') - op.add_column('message', sa.Column('header', sa.String(), nullable=True), schema='cognition') - + + op.add_column('conversation', sa.Column('header', sa.String(), nullable=True), schema='cognition') op.add_column('strategy_step', sa.Column('progress_text', sa.String(), nullable=True), schema='cognition') op.add_column('strategy_step', sa.Column('enable_emissions', sa.Boolean(), nullable=True), schema='cognition') @@ -62,7 +62,8 @@ def downgrade(): op.drop_column('strategy_step', 'enable_emissions', schema='cognition') op.drop_column('strategy_step', 'progress_text', schema='cognition') - op.drop_column('message', 'header', schema='cognition') + op.drop_column('conversation', 'header', schema='cognition') + op.drop_column('message', 'feedback_category', schema='cognition') op.drop_column('message', 'feedback_value', schema='cognition') op.drop_column('message', 'selection_widget', schema='cognition') From 6ed86ab531936e98c085b94540ea324c71b66b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Thu, 28 Dec 2023 20:04:41 +0100 Subject: [PATCH 10/17] error handling --- .../8a340c2ee913_update_cognition_tables_for_cognition_.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py index 13c3f033..dfab16e3 100644 --- a/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py +++ b/alembic/versions/8a340c2ee913_update_cognition_tables_for_cognition_.py @@ -24,6 +24,8 @@ def upgrade(): op.add_column('message', sa.Column('selection_widget', sa.ARRAY(sa.JSON()), nullable=True), schema='cognition') op.add_column('conversation', sa.Column('header', sa.String(), nullable=True), schema='cognition') + op.add_column('conversation', sa.Column('error', sa.String(), nullable=True), schema='cognition') + op.add_column('strategy_step', sa.Column('progress_text', sa.String(), nullable=True), schema='cognition') op.add_column('strategy_step', sa.Column('enable_emissions', sa.Boolean(), nullable=True), schema='cognition') @@ -63,7 +65,8 @@ def downgrade(): op.drop_column('strategy_step', 'progress_text', schema='cognition') op.drop_column('conversation', 'header', schema='cognition') - + op.drop_column('conversation', 'error', schema='cognition') + op.drop_column('message', 'feedback_category', schema='cognition') op.drop_column('message', 'feedback_value', schema='cognition') op.drop_column('message', 'selection_widget', schema='cognition') From 2eabb280776b73a88b55a75febee72aa5368b3a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Fri, 29 Dec 2023 01:27:15 +0100 Subject: [PATCH 11/17] adds team --- .../daf80476b9cc_adds_cognition_teams.py | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 alembic/versions/daf80476b9cc_adds_cognition_teams.py diff --git a/alembic/versions/daf80476b9cc_adds_cognition_teams.py b/alembic/versions/daf80476b9cc_adds_cognition_teams.py new file mode 100644 index 00000000..51015071 --- /dev/null +++ b/alembic/versions/daf80476b9cc_adds_cognition_teams.py @@ -0,0 +1,67 @@ +"""adds cognition teams + +Revision ID: daf80476b9cc +Revises: ff7dfeda5c2b +Create Date: 2023-12-28 22:31:25.742383 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = 'daf80476b9cc' +down_revision = 'ff7dfeda5c2b' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table( + "team", + sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), + sa.Column("organization_id", postgresql.UUID(as_uuid=True), nullable=True), + sa.Column("created_by", postgresql.UUID(as_uuid=True), nullable=True), + sa.Column("created_at", sa.DateTime(), nullable=True), + sa.Column("name", sa.String(), nullable=True), + sa.Column("description", sa.String(), nullable=True), + sa.ForeignKeyConstraint(["created_by"], ["user.id"], ondelete="SET NULL"), + sa.ForeignKeyConstraint( + ["organization_id"], ["organization.id"], ondelete="SET NULL" + ), + sa.PrimaryKeyConstraint("id"), + schema="cognition", + ) + + op.create_table( + "team_member", + sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), + sa.Column("team_id", postgresql.UUID(as_uuid=True), nullable=True), + sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=True), + sa.Column("created_at", sa.DateTime(), nullable=True), + sa.Column("created_by", postgresql.UUID(as_uuid=True), nullable=True), + sa.ForeignKeyConstraint(["created_by"], ["user.id"], ondelete="SET NULL"), + sa.ForeignKeyConstraint(["team_id"], ["cognition.team.id"], ondelete="CASCADE"), + sa.ForeignKeyConstraint(["user_id"], ["user.id"], ondelete="CASCADE"), + sa.PrimaryKeyConstraint("id"), + schema="cognition", + ) + + op.add_column( + "project", + sa.Column("team_id", postgresql.UUID(as_uuid=True), nullable=True), + schema="cognition", + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + + op.drop_column("project", "team_id", schema="cognition") + + op.drop_table("team_member", schema="cognition") + + op.drop_table("team", schema="cognition") + # ### end Alembic commands ### From 46b179afc2a73cd93305f02a31b1441e9e86c0e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Fri, 29 Dec 2023 01:28:24 +0100 Subject: [PATCH 12/17] adds team --- submodules/model | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/model b/submodules/model index fe98fc4e..c529398e 160000 --- a/submodules/model +++ b/submodules/model @@ -1 +1 @@ -Subproject commit fe98fc4e68b5f191df69e0170154585712063ba4 +Subproject commit c529398ebad6d9d43670ef1c82337c9df5128052 From 0316f287b842ec047c871ff6b04a64ef3e2166c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Fri, 29 Dec 2023 12:20:01 +0100 Subject: [PATCH 13/17] adds team --- .../versions/daf80476b9cc_adds_cognition_teams.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/alembic/versions/daf80476b9cc_adds_cognition_teams.py b/alembic/versions/daf80476b9cc_adds_cognition_teams.py index 51015071..0f1c9e07 100644 --- a/alembic/versions/daf80476b9cc_adds_cognition_teams.py +++ b/alembic/versions/daf80476b9cc_adds_cognition_teams.py @@ -48,9 +48,17 @@ def upgrade(): schema="cognition", ) - op.add_column( - "project", + op.create_table( + "team_project_access", + sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False), sa.Column("team_id", postgresql.UUID(as_uuid=True), nullable=True), + sa.Column("project_id", postgresql.UUID(as_uuid=True), nullable=True), + sa.Column("created_at", sa.DateTime(), nullable=True), + sa.Column("created_by", postgresql.UUID(as_uuid=True), nullable=True), + sa.ForeignKeyConstraint(["created_by"], ["user.id"], ondelete="SET NULL"), + sa.ForeignKeyConstraint(["project_id"], ["cognition.project.id"], ondelete="CASCADE"), + sa.ForeignKeyConstraint(["team_id"], ["cognition.team.id"], ondelete="CASCADE"), + sa.PrimaryKeyConstraint("id"), schema="cognition", ) # ### end Alembic commands ### @@ -59,7 +67,7 @@ def upgrade(): def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("project", "team_id", schema="cognition") + op.drop_table("team_project_access", schema="cognition") op.drop_table("team_member", schema="cognition") From 85a875bb4459cf409273450f2893fcb729d70f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Fri, 29 Dec 2023 15:09:24 +0100 Subject: [PATCH 14/17] small bugfix --- submodules/model | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/model b/submodules/model index c529398e..07591d45 160000 --- a/submodules/model +++ b/submodules/model @@ -1 +1 @@ -Subproject commit c529398ebad6d9d43670ef1c82337c9df5128052 +Subproject commit 07591d45e7690834219b51d77ed0ae438463575d From ae9bd5c86c26748b41cb118e49a768a9e6d6c5cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Sun, 31 Dec 2023 00:12:48 +0100 Subject: [PATCH 15/17] early prototype synopsis --- .../7daca1f5efc7_adds_synopsis_table.py | 75 +++++++++++++++++++ submodules/model | 2 +- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 alembic/versions/7daca1f5efc7_adds_synopsis_table.py diff --git a/alembic/versions/7daca1f5efc7_adds_synopsis_table.py b/alembic/versions/7daca1f5efc7_adds_synopsis_table.py new file mode 100644 index 00000000..47527af2 --- /dev/null +++ b/alembic/versions/7daca1f5efc7_adds_synopsis_table.py @@ -0,0 +1,75 @@ +"""adds synopsis table + +Revision ID: 7daca1f5efc7 +Revises: daf80476b9cc +Create Date: 2023-12-30 17:41:33.516169 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = '7daca1f5efc7' +down_revision = 'daf80476b9cc' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + + op.create_table('synopsis_spreadsheet', + sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), + sa.Column('dataset_id', postgresql.UUID(as_uuid=True), nullable=True), + sa.Column('filter_attribute_name', sa.String(), nullable=True), + sa.Column('project_id', postgresql.UUID(as_uuid=True), nullable=True), + sa.Column('name', sa.String(), nullable=True), + sa.Column('created_at', sa.DateTime(), nullable=True), + sa.Column('created_by', postgresql.UUID(as_uuid=True), nullable=True), + sa.ForeignKeyConstraint(['created_by'], ['user.id'], ondelete='SET NULL'), + sa.ForeignKeyConstraint(['dataset_id'], ['cognition.markdown_dataset.id'], ondelete='CASCADE'), + sa.ForeignKeyConstraint(['project_id'], ['cognition.project.id'], ondelete='CASCADE'), + sa.PrimaryKeyConstraint('id'), + schema='cognition' + ) + + op.create_index(op.f('ix_cognition_synopsis_spreadsheet_created_by'), 'synopsis_spreadsheet', ['created_by'], unique=False, schema='cognition') + op.create_index(op.f('ix_cognition_synopsis_spreadsheet_dataset_id'), 'synopsis_spreadsheet', ['dataset_id'], unique=False, schema='cognition') + op.create_index(op.f('ix_cognition_synopsis_spreadsheet_project_id'), 'synopsis_spreadsheet', ['project_id'], unique=False, schema='cognition') + + op.create_table('synopsis_spreadsheet_row', + sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), + sa.Column('project_id', postgresql.UUID(as_uuid=True), nullable=True), + sa.Column('spreadsheet_id', postgresql.UUID(as_uuid=True), nullable=True), + sa.Column('name', sa.String(), nullable=True), + sa.Column('created_at', sa.DateTime(), nullable=True), + sa.Column('created_by', postgresql.UUID(as_uuid=True), nullable=True), + sa.ForeignKeyConstraint(['created_by'], ['user.id'], ondelete='SET NULL'), + sa.ForeignKeyConstraint(['spreadsheet_id'], ['cognition.synopsis_spreadsheet.id'], ondelete='CASCADE'), + sa.PrimaryKeyConstraint('id'), + schema='cognition' + ) + + op.create_index(op.f('ix_cognition_synopsis_spreadsheet_row_created_by'), 'synopsis_spreadsheet_row', ['created_by'], unique=False, schema='cognition') + op.create_index(op.f('ix_cognition_synopsis_spreadsheet_row_spreadsheet_id'), 'synopsis_spreadsheet_row', ['spreadsheet_id'], unique=False, schema='cognition') + + op.add_column('conversation', sa.Column('synopsis_spreadsheet_row_id', sa.String(), nullable=True), schema='cognition') + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('conversation', 'synopsis_spreadsheet_row_id', schema='cognition') + + op.drop_index(op.f('ix_cognition_synopsis_spreadsheet_row_spreadsheet_id'), table_name='synopsis_spreadsheet_row', schema='cognition') + op.drop_index(op.f('ix_cognition_synopsis_spreadsheet_row_created_by'), table_name='synopsis_spreadsheet_row', schema='cognition') + + op.drop_table('synopsis_spreadsheet_row', schema='cognition') + + op.drop_index(op.f('ix_cognition_synopsis_spreadsheet_project_id'), table_name='synopsis_spreadsheet', schema='cognition') + op.drop_index(op.f('ix_cognition_synopsis_spreadsheet_dataset_id'), table_name='synopsis_spreadsheet', schema='cognition') + op.drop_index(op.f('ix_cognition_synopsis_spreadsheet_created_by'), table_name='synopsis_spreadsheet', schema='cognition') + + op.drop_table('synopsis_spreadsheet', schema='cognition') + # ### end Alembic commands ### diff --git a/submodules/model b/submodules/model index 07591d45..414a9ded 160000 --- a/submodules/model +++ b/submodules/model @@ -1 +1 @@ -Subproject commit 07591d45e7690834219b51d77ed0ae438463575d +Subproject commit 414a9ded6daf2799340d357bd1f760325e2e2695 From 748849c44c0675e322fd6dfaaf2931aaa772ef7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Sun, 31 Dec 2023 11:13:14 +0100 Subject: [PATCH 16/17] early prototype synopsis --- alembic/versions/7daca1f5efc7_adds_synopsis_table.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/alembic/versions/7daca1f5efc7_adds_synopsis_table.py b/alembic/versions/7daca1f5efc7_adds_synopsis_table.py index 47527af2..a5c1192e 100644 --- a/alembic/versions/7daca1f5efc7_adds_synopsis_table.py +++ b/alembic/versions/7daca1f5efc7_adds_synopsis_table.py @@ -54,12 +54,14 @@ def upgrade(): op.create_index(op.f('ix_cognition_synopsis_spreadsheet_row_created_by'), 'synopsis_spreadsheet_row', ['created_by'], unique=False, schema='cognition') op.create_index(op.f('ix_cognition_synopsis_spreadsheet_row_spreadsheet_id'), 'synopsis_spreadsheet_row', ['spreadsheet_id'], unique=False, schema='cognition') + op.add_column('conversation', sa.Column('synopsis_column', sa.String(), nullable=True), schema='cognition') op.add_column('conversation', sa.Column('synopsis_spreadsheet_row_id', sa.String(), nullable=True), schema='cognition') # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('conversation', 'synopsis_column', schema='cognition') op.drop_column('conversation', 'synopsis_spreadsheet_row_id', schema='cognition') op.drop_index(op.f('ix_cognition_synopsis_spreadsheet_row_spreadsheet_id'), table_name='synopsis_spreadsheet_row', schema='cognition') From c658108cdee4132c19c665cceabf58f7b6fdc0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20H=C3=B6tter?= Date: Sun, 31 Dec 2023 17:20:49 +0100 Subject: [PATCH 17/17] adds synopsis type and task scope dicg --- alembic/versions/7daca1f5efc7_adds_synopsis_table.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/alembic/versions/7daca1f5efc7_adds_synopsis_table.py b/alembic/versions/7daca1f5efc7_adds_synopsis_table.py index a5c1192e..5c41bc20 100644 --- a/alembic/versions/7daca1f5efc7_adds_synopsis_table.py +++ b/alembic/versions/7daca1f5efc7_adds_synopsis_table.py @@ -22,7 +22,9 @@ def upgrade(): op.create_table('synopsis_spreadsheet', sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('dataset_id', postgresql.UUID(as_uuid=True), nullable=True), + sa.Column('synopsis_type', sa.String(), nullable=True), sa.Column('filter_attribute_name', sa.String(), nullable=True), + sa.Column('task_scope_dict', postgresql.JSON(), nullable=True), sa.Column('project_id', postgresql.UUID(as_uuid=True), nullable=True), sa.Column('name', sa.String(), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=True),