From 18962749fbe98832f82c853bde13cf8995aedb1c Mon Sep 17 00:00:00 2001 From: Herman Snevajs Date: Wed, 19 Feb 2025 14:13:53 +0100 Subject: [PATCH 1/4] TODO: Revisit schemas --- development.md | 2 +- server/mergin/auth/api.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/development.md b/development.md index 9e92f0d0..d1731221 100644 --- a/development.md +++ b/development.md @@ -60,7 +60,7 @@ Watching the type definitions is also useful to pick up any changes to imports o ## Running locally in a docker composition -If you want to run the whole stack locally, you can use the docker. Docker will build the images from yout local files and run the services. +If you want to run the whole stack locally, you can use the docker. Docker will build the images from your local files and run the services. ```shell # Run the docker composition with the current Dockerfiles diff --git a/server/mergin/auth/api.yaml b/server/mergin/auth/api.yaml index 07831e36..095b0d26 100644 --- a/server/mergin/auth/api.yaml +++ b/server/mergin/auth/api.yaml @@ -682,6 +682,7 @@ paths: description: User info content: application/json: + # TODO: fix this to match the ma.SQLAlchemy schema or use UserDetail schema schema: $ref: "#/components/schemas/UserInfo" "401": From b7018f4cd0c315676dd9e1d8630c541408d4c30e Mon Sep 17 00:00:00 2001 From: Herman Snevajs Date: Thu, 20 Feb 2025 09:39:14 +0100 Subject: [PATCH 2/4] Drop error details index in sync failures table --- .../5ad13be6f7ef_drop_error_details_index.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 server/migrations/community/5ad13be6f7ef_drop_error_details_index.py diff --git a/server/migrations/community/5ad13be6f7ef_drop_error_details_index.py b/server/migrations/community/5ad13be6f7ef_drop_error_details_index.py new file mode 100644 index 00000000..4498ba51 --- /dev/null +++ b/server/migrations/community/5ad13be6f7ef_drop_error_details_index.py @@ -0,0 +1,33 @@ +"""Drop error details index + +Revision ID: 5ad13be6f7ef +Revises: ba5051218de4 +Create Date: 2025-02-20 07:52:36.670158 + +""" +from alembic import op +import sqlalchemy as sa +from alembic import context + + +# revision identifiers, used by Alembic. +revision = '5ad13be6f7ef' +down_revision = 'ba5051218de4' +branch_labels = None +depends_on = None + + +def upgrade(): + conn = op.get_bind() + conn.execute( + sa.text( + """ + DROP INDEX IF EXISTS ix_sync_failures_history_error_details; + """ + ) + ) + + +def downgrade(): + op.create_index(op.f('ix_sync_failures_history_error_details'), 'sync_failures_history', ['error_details'], + unique=False) From a09da72f1a38baebf815fd2e8b8721e5c74ce5b8 Mon Sep 17 00:00:00 2001 From: Herman Snevajs Date: Thu, 20 Feb 2025 09:39:46 +0100 Subject: [PATCH 3/4] black --- server/migrations/community/2686074eff45_ce_base.py | 4 ++-- .../5ad13be6f7ef_drop_error_details_index.py | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/server/migrations/community/2686074eff45_ce_base.py b/server/migrations/community/2686074eff45_ce_base.py index 35803ba7..91d269e0 100644 --- a/server/migrations/community/2686074eff45_ce_base.py +++ b/server/migrations/community/2686074eff45_ce_base.py @@ -2,10 +2,10 @@ # # SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial -""" Base migration for CE, reflects the state of release 2021.6.1 +"""Base migration for CE, reflects the state of release 2021.6.1 Revision ID: 2686074eff45 -Revises: +Revises: Create Date: 2022-12-15 10:40:42.234210 """ diff --git a/server/migrations/community/5ad13be6f7ef_drop_error_details_index.py b/server/migrations/community/5ad13be6f7ef_drop_error_details_index.py index 4498ba51..ceb1d225 100644 --- a/server/migrations/community/5ad13be6f7ef_drop_error_details_index.py +++ b/server/migrations/community/5ad13be6f7ef_drop_error_details_index.py @@ -5,14 +5,15 @@ Create Date: 2025-02-20 07:52:36.670158 """ + from alembic import op import sqlalchemy as sa from alembic import context # revision identifiers, used by Alembic. -revision = '5ad13be6f7ef' -down_revision = 'ba5051218de4' +revision = "5ad13be6f7ef" +down_revision = "ba5051218de4" branch_labels = None depends_on = None @@ -29,5 +30,9 @@ def upgrade(): def downgrade(): - op.create_index(op.f('ix_sync_failures_history_error_details'), 'sync_failures_history', ['error_details'], - unique=False) + op.create_index( + op.f("ix_sync_failures_history_error_details"), + "sync_failures_history", + ["error_details"], + unique=False, + ) From 848e597ccb87627ce41fe6f66c7e3319b530c438 Mon Sep 17 00:00:00 2001 From: Herman Snevajs Date: Thu, 20 Feb 2025 10:19:43 +0100 Subject: [PATCH 4/4] Drop index for the model --- server/mergin/sync/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/mergin/sync/models.py b/server/mergin/sync/models.py index e353f68a..06a2d1e4 100644 --- a/server/mergin/sync/models.py +++ b/server/mergin/sync/models.py @@ -1121,7 +1121,7 @@ class SyncFailuresHistory(db.Model): error_type = db.Column( db.String, index=True ) # e.g. push_start, push_finish, push_lost - error_details = db.Column(db.String, index=True) + error_details = db.Column(db.String) timestamp = db.Column(db.DateTime(), default=datetime.utcnow, index=True) user_id = db.Column( db.Integer, db.ForeignKey("user.id", ondelete="SET NULL"), nullable=True