uql-orm 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +25 -12
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,9 +1,33 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [0.2.6](https://github.com/rogerpadilla/uql/compare/uql-orm@0.2.5...uql-orm@0.2.6) (2026-03-11)
7
+
8
+
9
+ ### Features
10
+
11
+ * Introduce a new cursive "U" logo in SVG, PNG, and JPG formats, and update package dependencies. ([073239b](https://github.com/rogerpadilla/uql/commit/073239b2342eecc96b15f5099d0f9b18a7a4cf23))
12
+
13
+
14
+
15
+
16
+
1
17
  # Changelog
2
18
 
3
19
  All notable changes to this project will be documented in this file. Please add new changes to the top.
4
20
 
5
21
  date format is [yyyy-mm-dd]
6
22
 
23
+ ## [0.2.6] - 2026-03-11
24
+ ### Documentation
25
+ - **README – Migrations & Synchronization**: Rewrote the section with an entity-first intro explaining that UQL auto-generates migrations from entities. Reordered CLI commands to lead with `generate:entities`, renumbered usage examples, and added a concrete quick-start snippet.
26
+
27
+ ## [0.2.5] - 2026-03-11
28
+ ### Branding
29
+ - **New Logo**: Introduced a new cursive "U" logo in indigo (`#4F46E5`). Available in SVG, PNG, and JPG formats under `assets/`.
30
+
7
31
  ## [0.2.4] - 2026-03-10
8
32
  ### Bug Fixes
9
33
  - **ManyToOne / OneToOne relation filtering**: `$where` clauses referencing `m1` or `11` relations (e.g., `{ item: { name: 'Widget' } }`) now correctly generate `EXISTS` subqueries. Previously, these cardinalities were unhandled and fell through to `compareFieldOperator`, throwing an "unknown operator" error. The `compareRelation` method now supports all four cardinalities (`mm`, `1m`, `m1`, `11`) with direction-aware join resolution.
package/README.md CHANGED
@@ -446,13 +446,28 @@ try {
446
446
 
447
447
  ## 5. Migrations & Synchronization
448
448
 
449
+ UQL takes an **Entity-First** approach: you modify your TypeScript entity classes, and UQL auto-generates the migration files for you. No need to write DDL manually — UQL diffs your entities against the live database and generates the exact SQL needed.
450
+
451
+ ```bash
452
+ # 1. Update your entity (add a field, change a type, add a relation...)
453
+ # 2. Auto-generate the migration
454
+ npx uql-migrate generate:entities add_user_nickname
455
+
456
+ # 3. Review and apply
457
+ npx uql-migrate up
458
+ ```
459
+
460
+ > **Your entities are the single source of truth.** Want manual migrations for data backfills or custom SQL? You can do that too — full automation + full control when you need it.
461
+
449
462
  ### 1. Unified Configuration
450
463
 
451
- Ideally, use the same `uql.config.ts` for your application bootstrap and the CLI:
464
+ Reuse the same `uql.config.ts` for your app and the CLI to ensure consistent settings (naming strategies, entities, pool):
452
465
 
453
466
  ```ts
454
467
  // uql.config.ts
455
468
  import type { Config } from 'uql-orm';
469
+ import { PgQuerierPool } from 'uql-orm/postgres';
470
+ import { User, Profile, Post } from './entities';
456
471
 
457
472
  export default {
458
473
  pool: new PgQuerierPool({ /* ... */ }),
@@ -461,17 +476,15 @@ export default {
461
476
  } satisfies Config;
462
477
  ```
463
478
 
464
- **Why?** Using a single config for both your app and the CLI is recommended for consistency. It prevents bugs where your runtime uses one naming strategy (e.g. `camelCase`) but your migrations use another (e.g. `snake_case`), or where the CLI isn't aware of all your entities. It enforces a Single Source of Truth for your database connection and schema.
465
-
466
479
  ### 2. Manage via CLI
467
480
 
468
481
  Use the CLI to manage your database schema evolution.
469
482
 
470
483
  | Command | Description |
471
484
  | :--- | :--- |
472
- | `generate:from-db` | **Scaffolds Entities** from an existing database. Includes **Smart Relation Detection**. |
473
- | `generate <name>` | Creates an empty timestamped file for **manual** SQL migrations (e.g., data backfills). |
474
485
  | `generate:entities <name>` | **Auto-generates** a migration by diffing your entities against the current DB schema. |
486
+ | `generate <name>` | Creates an empty timestamped file for **manual** SQL migrations (e.g., data backfills). |
487
+ | `generate:from-db` | **Scaffolds Entities** from an existing database. Includes **Smart Relation Detection**. |
475
488
  | `drift:check` | **Drift Detection**: Compares your defined entities against the actual database schema and reports discrepancies. |
476
489
  | `up` | Applies all pending migrations. |
477
490
  | `down` | Rolls back the last applied migration batch. |
@@ -480,20 +493,20 @@ Use the CLI to manage your database schema evolution.
480
493
  #### Usage Examples
481
494
 
482
495
  ```bash
483
- # 1. Create a manual migration
484
- npx uql-migrate generate seed_default_roles
485
-
486
- # 2. Auto-generate schema changes from your code
496
+ # 1. Auto-generate schema changes from your entities
487
497
  npx uql-migrate generate:entities add_profile_table
488
498
 
489
- # 3. Apply changes
499
+ # 2. Apply changes
490
500
  npx uql-migrate up
491
501
 
492
- # 4. Check for schema drift (Production Safety)
502
+ # 3. Check for schema drift (Production Safety)
493
503
  npx uql-migrate drift:check
494
504
 
495
- # 5. Scaffold entities from an existing DB (Legacy Adoption)
505
+ # 4. Scaffold entities from an existing DB (Legacy Adoption)
496
506
  npx uql-migrate generate:from-db --output ./src/entities
507
+
508
+ # 5. Create a manual migration (for data backfills or custom SQL)
509
+ npx uql-migrate generate seed_default_roles
497
510
  ```
498
511
 
499
512
  > **Bun Users**: If your `uql.config.ts` uses TypeScript path aliases (e.g., `~app/...`), run migrations with the `--bun` flag to ensure proper resolution:
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "homepage": "https://uql-orm.dev",
4
4
  "description": "One Language. Frontend to Backend.",
5
5
  "license": "MIT",
6
- "version": "0.2.4",
6
+ "version": "0.2.6",
7
7
  "type": "module",
8
8
  "sideEffects": false,
9
9
  "main": "./dist/index.js",
@@ -142,5 +142,5 @@
142
142
  "publishConfig": {
143
143
  "access": "public"
144
144
  },
145
- "gitHead": "72dc289935a239ac31ab3e0fd79dfd693da9d8a7"
145
+ "gitHead": "944abbbccc7bc03b863a979c08e67c7d37fd506b"
146
146
  }