From 4d4bc141f08704bebe48952c2b0d67f3a44b0966 Mon Sep 17 00:00:00 2001 From: kraysent Date: Wed, 12 Nov 2025 20:01:54 +0000 Subject: [PATCH 1/2] #329: add PGC table and andd it to objects table --- .github/workflows/regression-testing.yml | 1 + postgres/migrations/V013__pgc.sql | 33 ++++++++++++ postgres/migrations/V013_pgc.sql | 67 ------------------------ 3 files changed, 34 insertions(+), 67 deletions(-) create mode 100644 postgres/migrations/V013__pgc.sql delete mode 100644 postgres/migrations/V013_pgc.sql diff --git a/.github/workflows/regression-testing.yml b/.github/workflows/regression-testing.yml index 20fcb42f..49e97b07 100644 --- a/.github/workflows/regression-testing.yml +++ b/.github/workflows/regression-testing.yml @@ -5,6 +5,7 @@ on: jobs: test-ubuntu: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/postgres/migrations/V013__pgc.sql b/postgres/migrations/V013__pgc.sql new file mode 100644 index 00000000..4b1e2748 --- /dev/null +++ b/postgres/migrations/V013__pgc.sql @@ -0,0 +1,33 @@ +/* pgmigrate-encoding: utf-8 */ + +CREATE TABLE common.pgc ( + id serial PRIMARY KEY +); + +COMMENT ON TABLE common.pgc IS 'The list of existing PGC-numbers' ; +COMMENT ON COLUMN common.pgc.id IS 'Unique PGC-number' ; + +ALTER TABLE rawdata.objects +ADD COLUMN pgc integer REFERENCES common.pgc (id) ON DELETE restrict ON UPDATE cascade, +ADD COLUMN modification_time timestamp without time zone ; + +COMMENT ON TABLE rawdata.objects IS 'The registry of all objects in original data tables' ; +COMMENT ON COLUMN rawdata.objects.id IS 'The record id' ; +COMMENT ON COLUMN rawdata.objects.table_id IS 'The table in which the record is located' ; +COMMENT ON COLUMN rawdata.objects.pgc IS 'Crossidentification of the record with the PGC-number' ; +COMMENT ON COLUMN rawdata.objects.modification_time IS 'Time of PGC-number assignment to the record' ; + +INSERT INTO common.pgc (id) +SELECT id +FROM rawdata.pgc +ORDER BY rawdata.pgc.id; + +ALTER SEQUENCE common.pgc_id_seq RESTART WITH 6775395 ; + +UPDATE rawdata.objects +SET + pgc=rawdata.pgc.id +FROM rawdata.pgc +WHERE + rawdata.pgc.object_id=rawdata.objects.id +; diff --git a/postgres/migrations/V013_pgc.sql b/postgres/migrations/V013_pgc.sql deleted file mode 100644 index b51f8fcf..00000000 --- a/postgres/migrations/V013_pgc.sql +++ /dev/null @@ -1,67 +0,0 @@ -BEGIN; - --- ALTER ROLE dim WITH SUPERUSER ; - -------------------------------------------------------------- --- Сохранять время модификации PGC нет необходимости, --- т.к. есть время привязки объекта с записями и этого достаточно для отслеживания модификаций --- --- добавление нового PGC номера делается командой --- INSERT INTO common.pgc DEFAULT VALUES ; -------------------------------------------------------------- - -CREATE TABLE common.pgc ( - id Serial PRIMARY KEY -); - -COMMENT ON TABLE common.pgc IS 'The list of existing PGC-numbers' ; -COMMENT ON COLUMN common.pgc.id IS 'Unique PGC-number' ; - - --------------------------- --- Ассоциация записей с PGC номерами переносится в таблицу objects --------------------------- - -ALTER TABLE rawdata.objects -ADD COLUMN pgc Integer REFERENCES common.pgc (id) ON DELETE restrict ON UPDATE cascade, -ADD COLUMN modification_time Timestamp Without Time Zone ; - -COMMENT ON TABLE rawdata.objects IS 'The register of all objects in original data tables' ; -COMMENT ON COLUMN rawdata.objects.id IS 'The record id' ; -COMMENT ON COLUMN rawdata.objects.table_id IS 'The table in which the record is located' ; -COMMENT ON COLUMN rawdata.objects.pgc IS 'Corssidentification of the record with the PGC-number' ; -COMMENT ON COLUMN rawdata.objects.modification_time IS 'Time of PGC-number assignment to the record' ; - - ---------------------------- --- Перенос данных ---------------------------- - -INSERT INTO common.pgc (id) -SELECT id -FROM rawdata.pgc -ORDER BY rawdata.pgc.id -; - -ALTER SEQUENCE common.pgc_id_seq RESTART WITH 6775395 ; - -UPDATE rawdata.objects -SET - pgc=rawdata.pgc.id -FROM rawdata.pgc -WHERE - rawdata.pgc.object_id=rawdata.objects.id -; - - --------------------------------------- --- В дальнейшем нужно будет --- 1. Перенести связь между записями и PGC в таблицу objects --- 2. Удалить таблицу rawdata.pgc --- 3. Перименовать таблицу objects в records --- 4. Перенести таблицы records и tables в схему layer0 --------------------------------------- - --- ROLLBACK; -COMMIT; - From 9c1ceca97e09b7d16ec73f3dc74ed5580e2dc853 Mon Sep 17 00:00:00 2001 From: kraysent Date: Wed, 12 Nov 2025 20:03:12 +0000 Subject: [PATCH 2/2] add timeouts to all workflow jobs --- .github/workflows/app-deploy.yaml | 2 ++ .github/workflows/build-docker.yaml | 1 + .github/workflows/documentation-build.yml | 1 + .github/workflows/documentation-deploy.yml | 1 + .github/workflows/testing.yml | 1 + 5 files changed, 6 insertions(+) diff --git a/.github/workflows/app-deploy.yaml b/.github/workflows/app-deploy.yaml index 78d5ce1d..284b6ff5 100644 --- a/.github/workflows/app-deploy.yaml +++ b/.github/workflows/app-deploy.yaml @@ -7,6 +7,7 @@ jobs: build: name: Build Docker image runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Checkout code uses: actions/checkout@v4 @@ -32,6 +33,7 @@ jobs: name: Push Docker image to GitHub Packages needs: build runs-on: ubuntu-latest + timeout-minutes: 10 permissions: contents: read packages: write diff --git a/.github/workflows/build-docker.yaml b/.github/workflows/build-docker.yaml index a35b1dde..8a1b6810 100644 --- a/.github/workflows/build-docker.yaml +++ b/.github/workflows/build-docker.yaml @@ -7,6 +7,7 @@ jobs: build: name: Build Docker image runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/documentation-build.yml b/.github/workflows/documentation-build.yml index c53494fd..5e85aad0 100644 --- a/.github/workflows/documentation-build.yml +++ b/.github/workflows/documentation-build.yml @@ -5,6 +5,7 @@ on: jobs: build: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/documentation-deploy.yml b/.github/workflows/documentation-deploy.yml index f6f0d92a..9d7196b1 100644 --- a/.github/workflows/documentation-deploy.yml +++ b/.github/workflows/documentation-deploy.yml @@ -7,6 +7,7 @@ on: jobs: deploy: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 90bc4b00..99dcf485 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -5,6 +5,7 @@ on: jobs: test-ubuntu: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Checkout code uses: actions/checkout@v4