Skip to content
Back to skills

Backward Compatible Schema Changes

ASecurity

Backward-Compatible Schema Changes

  • 17 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 2, 2026
ai-agentsgosqldatabase

Works with

  • cli

Security analysis

A100/100

Scanned September 2, 2026

npx -y skills add CarlosCaPe/octorato --skill backward-compatible-schema-changes --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Backward Compatible Schema Changes?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Backward Compatible Schema Changes
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/carloscape-backward-compatible-schema-changes/badge)](https://www.skillsdirectory.com/skills/carloscape-backward-compatible-schema-changes)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: backward-compatible-schema-changes
description: "Backward-Compatible Schema Changes"
metadata:
  short-description: "Backward-Compatible Schema Changes"
  original-index: 07
---

# Backward-Compatible Schema Changes

## What

Making database schema changes that don't break existing application code.
The application continues working without any code changes, even though the
database structure has been modified.

## Why

In production systems, you can't deploy database changes and application
changes at the exact same millisecond. There's always a window where the
old app code runs against the new schema (or vice versa). Backward-compatible
changes eliminate this risk.

## How

### Column renames with preserved parameter names

```sql
-- The procedure parameter keeps the OLD name
CREATE OR REPLACE PROCEDURE public."AddApplicant"(
    ...
    "p_vertirnarytechorassistant" boolean,  -- old spelling preserved
    ...
)
AS $$
BEGIN
    INSERT INTO public."Applicant" (
        ...
        "the clientTechOrAssistant",  -- new spelling in column ref
        ...
    ) VALUES (
        ...
        p_vertirnarytechorassistant,  -- old spelling in param ref (no quotes)
        ...
    );
END;
$$ LANGUAGE plpgsql;
```

The application calls:
```sql
CALL public."AddApplicant"(
    p_vertirnarytechorassistant => true  -- still works!
);
```

### The principle

| Layer | What Changed | What Stayed |
|-------|-------------|-------------|
| Table column name | `"VertirnaryTechOrAssistant"` -> `"the clientTechOrAssistant"` | Data, type, constraints |
| Procedure body | Quoted column refs updated | Everything else |
| Procedure signature | Nothing | Parameter names, types, order |
| Application code | Nothing | Call syntax, parameter binding |

## When to Use

- Any schema change on a system with active callers
- When you can't coordinate simultaneous DB + app deployments
- As a two-phase approach: rename columns now, rename parameters later

## Where We Used It

- ****: Renamed 4 columns and updated procedure bodies while preserving
  all `p_` parameter names. Application code continues working unchanged.
  Parameter name cleanup deferred to a future ticket after app coordination.

## Gotchas

- Document the "debt" -- old parameter names should eventually be cleaned up
- Test with the actual application, not just SQL queries
- Named parameter binding (`p_name => value`) is sensitive to parameter names;
  positional binding is not

---

*Category: Strategy | Origin: *

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…