From c05e4291e57d27d79bacb89a12f9fd779f1c181c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20C=2E=20Mart=C3=ADnez?= Date: Sat, 21 Dec 2024 13:04:10 +0100 Subject: [PATCH 1/2] fix: add nullable constraint for FK repos -> organization --- src/database/migrations/1733435340266_add_github_repos.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/database/migrations/1733435340266_add_github_repos.js b/src/database/migrations/1733435340266_add_github_repos.js index d42a10c..e492f0b 100644 --- a/src/database/migrations/1733435340266_add_github_repos.js +++ b/src/database/migrations/1733435340266_add_github_repos.js @@ -64,8 +64,8 @@ exports.up = async (knex) => { table.enu('secret_scanning_validity_checks_status', ['enabled', 'disabled']).defaultTo('disabled') // Foreign key to 'github_organizations' table - table - .integer('github_organization_id') + table.integer('github_organization_id') + .notNullable() .unsigned() .references('id') .inTable('github_organizations') From f9434d63242e6cfb176979f3da00a249d31a2531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20C=2E=20Mart=C3=ADnez?= Date: Mon, 23 Dec 2024 16:17:13 +0100 Subject: [PATCH 2/2] feat: added updated DDL schema --- src/database/schema/schema.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/database/schema/schema.sql b/src/database/schema/schema.sql index 2d8d141..e03a45d 100644 --- a/src/database/schema/schema.sql +++ b/src/database/schema/schema.sql @@ -349,7 +349,7 @@ CREATE TABLE public.github_repositories ( dependabot_security_updates_status text DEFAULT 'disabled'::text, secret_scanning_non_provider_patterns_status text DEFAULT 'disabled'::text, secret_scanning_validity_checks_status text DEFAULT 'disabled'::text, - github_organization_id integer, + github_organization_id integer NOT NULL, created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT github_repositories_dependabot_security_updates_status_check CHECK ((dependabot_security_updates_status = ANY (ARRAY['enabled'::text, 'disabled'::text]))),