From a33ed0774621713d973be05b01d842854909d4e7 Mon Sep 17 00:00:00 2001 From: Tecquo Date: Thu, 9 Oct 2025 13:16:44 +0300 Subject: [PATCH 1/4] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=B1=D0=B0=D0=B7=D0=BE=D0=B2=D1=83=D1=8E=20=D0=BC=D0=B8?= =?UTF-8?q?=D0=B3=D1=80=D0=B0=D1=86=D0=B8=D1=8E=20=D0=B8=20=D0=BE=D0=B1?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=B8=D0=BB=20=D1=81=D1=82=D0=B0=D0=B1=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Пока что при накатывании/откатывании мы делаем миграции, только если есть/нет table + проверка на дубликат создания mod_status --- .../20251009093017_new_mods_table.sql | 25 +++++++++++++++++++ src/modservice/grpc/mod_pb2_grpc.py | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/migrations/20251009093017_new_mods_table.sql diff --git a/src/migrations/20251009093017_new_mods_table.sql b/src/migrations/20251009093017_new_mods_table.sql new file mode 100644 index 0000000..14ff839 --- /dev/null +++ b/src/migrations/20251009093017_new_mods_table.sql @@ -0,0 +1,25 @@ +-- +goose Up +-- +goose StatementBegin +DO $$ BEGIN + CREATE TYPE mod_status AS ENUM ('UPLOADING', 'UPLOADED', 'FAILED', 'HIDDEN', 'BANNED'); +EXCEPTION + WHEN duplicate_object THEN null; +END $$; + +CREATE TABLE IF NOT EXISTS mods ( + id SERIAL PRIMARY KEY, + author_id INT NOT NULL, + title VARCHAR(255) NOT NULL, + description TEXT, + version INT NOT NULL DEFAULT 1, + s3_key VARCHAR(255), + status mod_status NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +DROP TABLE IF EXISTS mods; +DROP TYPE IF EXISTS mod_status; +-- +goose StatementEnd diff --git a/src/modservice/grpc/mod_pb2_grpc.py b/src/modservice/grpc/mod_pb2_grpc.py index 008688a..131fd6f 100644 --- a/src/modservice/grpc/mod_pb2_grpc.py +++ b/src/modservice/grpc/mod_pb2_grpc.py @@ -5,7 +5,7 @@ from . import mod_pb2 as mod__pb2 -GRPC_GENERATED_VERSION = '1.74.0' +GRPC_GENERATED_VERSION = '1.75.1' GRPC_VERSION = grpc.__version__ _version_not_supported = False From 728d8cd6ad30c76100671422bcea17ed495ddc41 Mon Sep 17 00:00:00 2001 From: Tecquo Date: Thu, 9 Oct 2025 13:29:54 +0300 Subject: [PATCH 2/4] =?UTF-8?q?SonarCube=20=D0=B5=D0=B1=D0=B0=D0=BD=D1=8B?= =?UTF-8?q?=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавил конфиг SonarCube, в котором исключил папку grpc на проверку QualityGate --- sonar-project.properties | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..522c474 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,10 @@ +# SonarQube Configuration + +# Exclude auto-generated gRPC files from analysis +sonar.exclusions=**/grpc/**/*_pb2.py,**/grpc/**/*_pb2.pyi,**/grpc/**/*_pb2_grpc.py + +# Exclude common directories +sonar.coverage.exclusions=**/grpc/**,**/tests/**,**/__pycache__/** + +# Python specific settings +sonar.python.version=3.13 From a8251c3f06fd38b4c72759407c252322272ca896 Mon Sep 17 00:00:00 2001 From: Tecquo Date: Thu, 9 Oct 2025 13:47:53 +0300 Subject: [PATCH 3/4] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BC=D0=B8=D0=B3=D1=80=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/migrations/20251009093017_new_mods_table.sql | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/migrations/20251009093017_new_mods_table.sql b/src/migrations/20251009093017_new_mods_table.sql index 14ff839..23c7481 100644 --- a/src/migrations/20251009093017_new_mods_table.sql +++ b/src/migrations/20251009093017_new_mods_table.sql @@ -1,10 +1,6 @@ -- +goose Up -- +goose StatementBegin -DO $$ BEGIN - CREATE TYPE mod_status AS ENUM ('UPLOADING', 'UPLOADED', 'FAILED', 'HIDDEN', 'BANNED'); -EXCEPTION - WHEN duplicate_object THEN null; -END $$; +CREATE TYPE mod_status AS ENUM ('UPLOADING', 'UPLOADED', 'FAILED', 'HIDDEN', 'BANNED'); CREATE TABLE IF NOT EXISTS mods ( id SERIAL PRIMARY KEY, From 0666a1c363e6b0f9085b2525a6f13e4fce6c469c Mon Sep 17 00:00:00 2001 From: Andrey Kataev Date: Thu, 9 Oct 2025 14:16:38 +0300 Subject: [PATCH 4/4] Update 20251009093017_new_mods_table.sql --- src/migrations/20251009093017_new_mods_table.sql | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/migrations/20251009093017_new_mods_table.sql b/src/migrations/20251009093017_new_mods_table.sql index 23c7481..4a3772f 100644 --- a/src/migrations/20251009093017_new_mods_table.sql +++ b/src/migrations/20251009093017_new_mods_table.sql @@ -1,5 +1,4 @@ -- +goose Up --- +goose StatementBegin CREATE TYPE mod_status AS ENUM ('UPLOADING', 'UPLOADED', 'FAILED', 'HIDDEN', 'BANNED'); CREATE TABLE IF NOT EXISTS mods ( @@ -12,10 +11,7 @@ CREATE TABLE IF NOT EXISTS mods ( status mod_status NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); --- +goose StatementEnd -- +goose Down --- +goose StatementBegin DROP TABLE IF EXISTS mods; DROP TYPE IF EXISTS mod_status; --- +goose StatementEnd