From 3ddcaaaf15e8d1f902cdafee13feb3d6946d1424 Mon Sep 17 00:00:00 2001 From: Nurfog Date: Sun, 11 Jan 2026 02:46:02 -0300 Subject: [PATCH] feat: fix migrations files --- .../migrations/20260111000000_gamification_users.sql | 4 ++-- services/cms-service/migrations/20260111000001_webhooks.sql | 4 ++-- .../lms-service/migrations/20260111000003_lms_webhooks.sql | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/services/cms-service/migrations/20260111000000_gamification_users.sql b/services/cms-service/migrations/20260111000000_gamification_users.sql index c11bc26..fd658f4 100644 --- a/services/cms-service/migrations/20260111000000_gamification_users.sql +++ b/services/cms-service/migrations/20260111000000_gamification_users.sql @@ -1,4 +1,4 @@ -- Add XP and Level to users for gamification ALTER TABLE users -ADD COLUMN xp INTEGER NOT NULL DEFAULT 0, -ADD COLUMN level INTEGER NOT NULL DEFAULT 1; +ADD COLUMN IF NOT EXISTS xp INTEGER NOT NULL DEFAULT 0, +ADD COLUMN IF NOT EXISTS level INTEGER NOT NULL DEFAULT 1; diff --git a/services/cms-service/migrations/20260111000001_webhooks.sql b/services/cms-service/migrations/20260111000001_webhooks.sql index 1f91f2f..2b613ee 100644 --- a/services/cms-service/migrations/20260111000001_webhooks.sql +++ b/services/cms-service/migrations/20260111000001_webhooks.sql @@ -1,5 +1,5 @@ -- Migration: Create Webhooks Table -CREATE TABLE webhooks ( +CREATE TABLE IF NOT EXISTS webhooks ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), organization_id UUID NOT NULL REFERENCES organizations(id) ON DELETE CASCADE, url VARCHAR(500) NOT NULL, @@ -11,4 +11,4 @@ CREATE TABLE webhooks ( ); -- Index for organization_id -CREATE INDEX idx_webhooks_organization_id ON webhooks(organization_id); +CREATE INDEX IF NOT EXISTS idx_webhooks_organization_id ON webhooks(organization_id); diff --git a/services/lms-service/migrations/20260111000003_lms_webhooks.sql b/services/lms-service/migrations/20260111000003_lms_webhooks.sql index 919d255..cfe35b5 100644 --- a/services/lms-service/migrations/20260111000003_lms_webhooks.sql +++ b/services/lms-service/migrations/20260111000003_lms_webhooks.sql @@ -1,5 +1,5 @@ -- Migration: Create Webhooks Table for LMS -CREATE TABLE webhooks ( +CREATE TABLE IF NOT EXISTS webhooks ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), organization_id UUID NOT NULL REFERENCES organizations(id) ON DELETE CASCADE, url VARCHAR(500) NOT NULL, @@ -11,4 +11,4 @@ CREATE TABLE webhooks ( ); -- Index for organization_id -CREATE INDEX idx_webhooks_organization_id ON webhooks(organization_id); +CREATE INDEX IF NOT EXISTS idx_webhooks_organization_id ON webhooks(organization_id);