Skip to content

feat: add firebird#242

Merged
RambokDev merged 1 commit intomainfrom
feat/add-firebird
Mar 31, 2026
Merged

feat: add firebird#242
RambokDev merged 1 commit intomainfrom
feat/add-firebird

Conversation

@RambokDev
Copy link
Copy Markdown
Collaborator

@RambokDev RambokDev commented Mar 30, 2026

Summary by CodeRabbit

  • New Features
    • Added support for Firebird as a database management system option.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

📝 Walkthrough

Walkthrough

This pull request adds Firebird database support to the system by introducing a new 'firebird' enum value to the dbms_status PostgreSQL type. Changes include a SQL migration, database schema snapshot, TypeScript type definitions, and migration journal entries.

Changes

Cohort / File(s) Summary
Database Migration
src/db/migrations/0048_yellow_eddie_brock.sql, src/db/migrations/meta/0048_snapshot.json, src/db/migrations/meta/_journal.json
Adds 'firebird' value to the dbms_status enum type, records full PostgreSQL schema snapshot at migration version 7, and appends migration journal entry.
Type Schema
src/db/schema/types.ts
Updates dbmsEnum constant to include "firebird" as a new allowed value, implicitly updating the derived EDbmsSchema type.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

  • Add FireBird #235 — This PR directly implements the request to add Firebird support by extending the dbms_status enum and corresponding type definitions.

Possibly related PRs

Poem

🔥 A firebird takes flight through our schema so bright,
With enum values gleaming in PostgreSQL's light,
From SQL migrations to TypeScript's embrace,
New database support finds its rightful place! 🐰✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add firebird' is directly related to the main change—adding support for the Firebird database management system by introducing it as a new enum value across the schema and migrations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-firebird

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/db/migrations/0048_yellow_eddie_brock.sql`:
- Line 1: The migration currently does ALTER TYPE "public"."dbms_status" ADD
VALUE 'firebird' which will fail if the value already exists; update the
statement to use the idempotent form by adding IF NOT EXISTS so the migration
becomes ALTER TYPE "public"."dbms_status" ADD VALUE IF NOT EXISTS 'firebird'
(target the migration file that contains the ALTER TYPE on dbms_status and
ensure only that line is changed).

In `@src/db/schema/types.ts`:
- Line 5: The dbmsEnum now includes "firebird" but the backup/restore extension
mapper in src/utils/common.ts (the switch/case that maps DBMS names to file
extensions) lacks a case for "firebird" and thus falls back to the default; add
a specific case "firebird" in that switch (or the function responsible for
mapping, e.g., the backup extension mapper) to return the correct Firebird
backup file extension (match the project's convention for other DBMS entries) so
Firebird backups/restores use the proper extension instead of the default.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5193edff-04bc-4381-b6e4-3a08a73e0279

📥 Commits

Reviewing files that changed from the base of the PR and between 83ddc93 and 70d4c76.

⛔ Files ignored due to path filters (1)
  • public/images/firebird.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • src/db/migrations/0048_yellow_eddie_brock.sql
  • src/db/migrations/meta/0048_snapshot.json
  • src/db/migrations/meta/_journal.json
  • src/db/schema/types.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-and-test
🔇 Additional comments (3)
src/db/migrations/meta/_journal.json (1)

340-346: Journal entry is correctly appended and sequenced.

idx, tag, and version are consistent with the new migration registration flow.

src/db/migrations/meta/0048_snapshot.json (1)

2505-2517: Snapshot enum sync looks correct.

public.dbms_status includes "firebird" and aligns with the migration and schema type update.

src/db/schema/types.ts (1)

5-5: No action needed. Firebird is correctly excluded from the backupOnly allowlist.

The backupOnly array restricts databases without restore capability (["redis", "valkey"]). According to README.md, Firebird supports restore operations, so it should not be in the allowlist. The current implementation is consistent and working as intended.

@@ -0,0 +1 @@
ALTER TYPE "public"."dbms_status" ADD VALUE 'firebird'; No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify pinned/documented PostgreSQL versions and migration execution context.
rg -n --iglob '*Dockerfile*' --iglob '*docker-compose*.yml' --iglob '*docker-compose*.yaml' --iglob '*.md' --iglob '*.env*' '\bpostgres(?:ql)?([:= ]+[0-9]+)?'
rg -n -C2 --iglob '*drizzle*' --iglob '*migrat*' 'drizzle|migration|breakpoints'

Repository: Portabase/portabase

Length of output: 1673


🌐 Web query:

PostgreSQL ALTER TYPE ADD VALUE IF NOT EXISTS version support when added

💡 Result:

ALTER TYPE ... ADD VALUE IF NOT EXISTS (for enum types) is supported starting in PostgreSQL 9.3 (released 2013-09-09). This is documented in the 9.3 release notes (“Support IF NOT EXISTS option in ALTER TYPE ...”) and reflected in the 9.3 ALTER TYPE syntax. [1] [2]

So: PostgreSQL 9.2 and older do not support IF NOT EXISTS on ALTER TYPE ... ADD VALUE; 9.3+ do. [1] [2]

Sources:
[1] PostgreSQL 9.3 release notes (9.3.0) https://www.postgresql.org/docs/release/9.3.0/
[2] PostgreSQL 9.3 ALTER TYPE docs https://www.postgresql.org/docs/9.3/sql-altertype.html


🏁 Script executed:

cat -n src/db/migrations/0048_yellow_eddie_brock.sql

Repository: Portabase/portabase

Length of output: 125


🏁 Script executed:

# Check if there are other similar ALTER TYPE ... ADD VALUE statements without IF NOT EXISTS
rg 'ALTER TYPE.*ADD VALUE' src/db/migrations/ --no-heading

Repository: Portabase/portabase

Length of output: 1546


Make this enum migration idempotent.

This statement fails on reruns if 'firebird' already exists (common in drifted/manual environments). PostgreSQL 9.3+ supports the idempotent form:

-ALTER TYPE "public"."dbms_status" ADD VALUE 'firebird';
+ALTER TYPE "public"."dbms_status" ADD VALUE IF NOT EXISTS 'firebird';

All active PostgreSQL versions (16, 17, 18) support this syntax.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ALTER TYPE "public"."dbms_status" ADD VALUE 'firebird';
ALTER TYPE "public"."dbms_status" ADD VALUE IF NOT EXISTS 'firebird';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/db/migrations/0048_yellow_eddie_brock.sql` at line 1, The migration
currently does ALTER TYPE "public"."dbms_status" ADD VALUE 'firebird' which will
fail if the value already exists; update the statement to use the idempotent
form by adding IF NOT EXISTS so the migration becomes ALTER TYPE
"public"."dbms_status" ADD VALUE IF NOT EXISTS 'firebird' (target the migration
file that contains the ALTER TYPE on dbms_status and ensure only that line is
changed).

import {z} from "zod";

export const dbmsEnum = pgEnum("dbms_status", ["postgresql", "mysql", "mariadb", "mongodb", "sqlite", "redis", "valkey"]);
export const dbmsEnum = pgEnum("dbms_status", ["postgresql", "mysql", "mariadb", "mongodb", "sqlite", "redis", "valkey", "firebird"]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Firebird is added here, but backup extension mapping is not explicitly updated.

src/utils/common.ts:43-50 still has no case "firebird" and falls back to default. That can produce incorrect file-extension handling for Firebird backup/restore workflows.

Suggested follow-up patch (outside this file)
--- a/src/utils/common.ts
+++ b/src/utils/common.ts
@@
 switch (dbType) {
     case "postgresql":
         return ".dump";
     case "mysql":
         return ".sql";
+    case "firebird":
+        return ".fbk"; // or the team-approved Firebird backup extension
     default:
         return ".dump";
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/db/schema/types.ts` at line 5, The dbmsEnum now includes "firebird" but
the backup/restore extension mapper in src/utils/common.ts (the switch/case that
maps DBMS names to file extensions) lacks a case for "firebird" and thus falls
back to the default; add a specific case "firebird" in that switch (or the
function responsible for mapping, e.g., the backup extension mapper) to return
the correct Firebird backup file extension (match the project's convention for
other DBMS entries) so Firebird backups/restores use the proper extension
instead of the default.

@RambokDev RambokDev linked an issue Mar 31, 2026 that may be closed by this pull request
@RambokDev
Copy link
Copy Markdown
Collaborator Author

Portabase/agent#51

@RambokDev RambokDev merged commit 8ffb672 into main Mar 31, 2026
5 checks passed
@RambokDev RambokDev deleted the feat/add-firebird branch March 31, 2026 13:09
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.

Add FireBird

1 participant