Skip to content

Releases: forge-sql-orm/forge-sql-orm

2.0.25

26 Jun 12:17

Choose a tag to compare

Changes

  • Updated dependency versions to improve compatibility and security.
  • Minor internal stability improvements.

Notes

  • No functional changes.
  • Recommended for all users to stay up-to-date with the latest fixes from external libraries.

2.0.23

16 Jun 08:36

Choose a tag to compare

Changes

  • Updated dependency versions to improve compatibility and security.
  • Minor internal stability improvements.

Notes

  • No functional changes.
  • Recommended for all users to stay up-to-date with the latest fixes from external libraries.

forge-sql-orm v2.0.22

30 May 07:20

Choose a tag to compare

forge-sql-orm v2.0.22

Changes

  • Updated dependency versions to improve compatibility and security.
  • Minor internal stability improvements.

Notes

  • No functional changes.
  • Recommended for all users to stay up-to-date with the latest fixes from external libraries.

2.0.21

17 May 05:31

Choose a tag to compare

forge-sql-orm v2.0.21

🚀 What's New

✨ Features

  • nextVal helper for SEQUENCE-based inserts
    Enables safe and convenient use of SQL SEQUENCE values when inserting rows.

    import { nextVal } from "forge-sql-orm";
    
    const user = {
      id: nextVal('user_id_seq'),
      name: "user test",
      organization_id: 1
    };
    
    const id = await forgeSQL.modify().insert(appUser, [user]);
  • formatLimitOffset utility
    Helps safely format numeric LIMIT and OFFSET values in raw SQL queries.

    import { formatLimitOffset } from "forge-sql-orm";
    
    const result = await forgeSQL
      .select()
      .from(orderItem)
      .orderBy(asc(orderItem.createdAt))
      .limit(formatLimitOffset(10))
      .offset(formatLimitOffset(350000));
    
    // Generates:
    // SELECT * FROM order_item
    // ORDER BY created_at ASC
    // LIMIT 10
    // OFFSET 350000

🧪 Examples

  • forge-sql-orm-example-checklist
    Demonstrates the use of optimistic locking in Forge SQL ORM. This example implements a checklist feature that prevents data loss during concurrent updates in Jira issues.

  • forge-sql-orm-example-org-tracker
    A practical organization tracking system built with Forge SQL ORM. It showcases search, filtering, and real-time user-organization mapping.

📦 Dependency Updates

  • Updated internal dependencies to improve compatibility and security.

2.0.20

29 Apr 16:28

Choose a tag to compare

forge-sql-orm v2.0.20

Changes

  • Updated dependency versions to improve compatibility and security.
  • Minor internal stability improvements.

Notes

  • No functional changes.
  • Recommended for all users to stay up-to-date with the latest fixes from external libraries.

2.0.19

11 Apr 08:55

Choose a tag to compare

✨ New: Query Analysis API

A powerful new API is now available under forgeSqlOrm.analyze() — enabling in-depth query diagnostics and performance insights directly from your Forge app.

Highlights:

  • explain() / explainAnalyze() — for Drizzle queries
  • explainRaw() / explainAnalyzeRaw() — for raw SQL queries
  • analyzeSlowQueries() — access to slow query logs with query plans
  • analyzeQueriesHistory() — query history per table (Drizzle objects) with query plans
  • analyzeQueriesHistoryRaw() — query history per table (string names) with query plans

Useful for performance tuning in TiDB, MySQL, and other compatible systems.


🛠 Deprecations

  • forgeSqlOrm.crud() has been deprecated and will be removed in a future release.
    Please migrate to forgeSqlOrm.modify() — the API remains the same, just with an updated name that better reflects its intent.

Migration Example:

// Before:
const query = forgeSqlOrm.crud().select().from(...)

// After:
const query = forgeSqlOrm.modify().select().from(...)

🧪 Code Quality & Fixes

  • Integrated static code analyzers for improved consistency and safety
  • Expanded test coverage across core components
  • Minor bug fixes and internal stability improvements

2.0.18

08 Apr 18:02
ec983b2

Choose a tag to compare

✨ New Features
SQL Hints Support: You can now add SQL hints to SELECT, INSERT, UPDATE, and DELETE queries for fine-tuned query optimization and execution behavior.

🐞 Bug Fixes
Fixed issues related to selectAlias and selectAliasDistinct that could cause incorrect alias resolution or unexpected results in some edge cases.

2.0.16

06 Apr 11:47

Choose a tag to compare

✨ What's New

1. Improved Unique Aliases in select

Enhanced how column aliases are generated in select when duplicate field names appear across different groups. Now, each field receives a unique alias to avoid collisions in the final query result.

Example:

forgeSqlOrm.select({
  group1: { name: user.name },
  group2: { name: user.name }
}).from(users)

Previously, this could result in naming conflicts. With this update, each name field is uniquely aliased under the hood.

2. Smarter Group Null Handling in Response

A new post-processing step ensures that when all values in a selected group are null (e.g., due to a leftJoin with no match), the entire group is returned as null instead of a group of null values.

Example:

forgeSqlOrm
  .select({
    group1: { name: user.name },
    group2: { name: userStatus.name }
  })
  .from(users)
  .leftJoin(userStatus, eq(userStatus.id, user.id))

Before (undesired):

{
  group2: { name: null }
}

Now (correct):

{
  group2: null
}

This leads to cleaner and more intuitive data structures when dealing with optional or missing related records.

2.0.13

05 Apr 07:57
51ae1b9

Choose a tag to compare

📦 CLI moved to a separate package

The CLI has been extracted from the main forge-sql-orm package into its own dedicated package: [forge-sql-orm-cli](https://www.npmjs.com/package/forge-sql-orm-cli).

❗ What’s changed?

Previously, you could run the CLI directly via:

npx forge-sql-orm --help

Now, you need to install and use the new CLI package:

npm install forge-sql-orm-cli --save-dev
npx forge-sql-orm-cli --help

💡 Why this change?

In the previous setup, the CLI was bundled with the main package, meaning all CLI-related dependencies were included — even if you were only using the core library. Since devDependencies are not available during CLI execution, many of them had to be listed under regular dependencies, increasing the size of the package unnecessarily.

By turning the CLI into a standalone app, all CLI-specific dependencies now live in forge-sql-orm-cli, keeping the main forge-sql-orm package lightweight and focused solely on the ORM functionality.

🔧 How to upgrade

If you're using the CLI, update your setup as follows:

  1. Install the new CLI package:

    npm install forge-sql-orm-cli --save-dev
  2. Update your package.json scripts to use the new CLI command:

    "scripts": {
      "models:create": "forge-sql-orm-cli generate:model --output src/entities",
      "migration:create": "forge-sql-orm-cli migrations:create",
      "migration:update": "forge-sql-orm-cli migrations:update",
      "migration:drop": "forge-sql-orm-cli migrations:drop"
    }
  3. Update any references in your documentation or tooling from:

    npx forge-sql-orm ...

    to:

    npx forge-sql-orm-cli ...

No other changes are needed — all CLI functionality remains the same, just now under a separate, focused package.

2.0.11

03 Apr 09:17

Choose a tag to compare

What's Changed

  • Bump the npm_and_yarn group across 4 directories with 2 updates by @dependabot in #13

Full Changelog: 2.0.10...2.0.11