Skip to content

Make schema.sql self-migrating for forwarded_for column#6

Open
yellowman wants to merge 1 commit into
mainfrom
claude/gracious-johnson-tqp6s7
Open

Make schema.sql self-migrating for forwarded_for column#6
yellowman wants to merge 1 commit into
mainfrom
claude/gracious-johnson-tqp6s7

Conversation

@yellowman

@yellowman yellowman commented Jul 5, 2026

Copy link
Copy Markdown
Owner

CREATE TABLE IF NOT EXISTS is a no-op on databases that already have a submissions table, so the forwarded_for column would never appear on an existing install. Add an idempotent ALTER TABLE ... ADD COLUMN IF NOT EXISTS so re-running schema.sql migrates older databases; it is a no-op on fresh installs.

Claude-Session: https://claude.ai/code/session_01EtMfJEmMXbwnUJ9p3uFXXN


Note

Low Risk
Single additive, idempotent DDL line with no application logic changes.

Overview
schema.sql can now upgrade older databases that already had a submissions table but were created before forwarded_for existed.

Because CREATE TABLE IF NOT EXISTS does nothing on existing tables, those installs would never pick up the column from the table definition alone. This change adds an idempotent ALTER TABLE submissions ADD COLUMN IF NOT EXISTS forwarded_for TEXT plus a short comment that re-running the script is the intended migration path. Fresh installs are unchanged (the column is already in CREATE TABLE; the ALTER is a no-op).

Reviewed by Cursor Bugbot for commit 37acf7a. Bugbot is set up for automated code reviews on this repo. Configure here.

CREATE TABLE IF NOT EXISTS is a no-op on databases that already have a
submissions table, so the forwarded_for column would never appear on an
existing install. Add an idempotent ALTER TABLE ... ADD COLUMN IF NOT
EXISTS so re-running schema.sql migrates older databases; it is a no-op on
fresh installs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EtMfJEmMXbwnUJ9p3uFXXN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants