Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions db/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ BEGIN
END;
/

PROMPT ==> [DB] 003_add_category
@@migrations/003_add_category.sql
BEGIN
MERGE INTO schema_migrations t
USING (SELECT '003_add_category' AS version FROM dual) s
ON (t.version = s.version)
WHEN NOT MATCHED THEN INSERT (version, notes) VALUES (s.version, 'category column on cf_feedback');
END;
/

COMMIT;

PROMPT ==> [DB] Applied migrations:
Expand Down
29 changes: 29 additions & 0 deletions db/migrations/003_add_category.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- 003_add_category.sql
-- THE DEMO MOMENT: adds a category column to cf_feedback.
-- Idempotent: catches ORA-01430 (column already exists).
--
-- This migration is the change demonstrated on stage:
-- 1. A stakeholder opens an issue requesting a "category" field.
-- 2. A developer adds this migration + the matching APEX page change.
-- 3. The PR triggers validation; merge deploys to DEV.
-- 4. Tagging a release deploys to PROD after manual approval.

BEGIN
EXECUTE IMMEDIATE q'[
ALTER TABLE cf_feedback
ADD category VARCHAR2(50) DEFAULT 'General'
CONSTRAINT cf_feedback_cat_chk
CHECK (category IN ('General','Product','Support','Billing','Other'))
]';
DBMS_OUTPUT.PUT_LINE('Added category column to cf_feedback.');
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE = -1430 THEN
DBMS_OUTPUT.PUT_LINE('cf_feedback.category already exists -- skipping.');
ELSE
RAISE;
END IF;
END;
/

COMMENT ON COLUMN cf_feedback.category IS 'Feedback category, added in v1.1';
Loading