uql-orm 0.34.0 → 0.35.0

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 (32) hide show
  1. package/README.md +1 -1
  2. package/dist/dialect/abstractDialect.js +2 -3
  3. package/dist/dialect/abstractSqlDialect.d.ts +6 -0
  4. package/dist/dialect/abstractSqlDialect.js +10 -3
  5. package/dist/migrate/builder/expressions.d.ts +8 -28
  6. package/dist/migrate/builder/expressions.js +8 -40
  7. package/dist/migrate/builder/migrationBuilder.js +3 -1
  8. package/dist/migrate/builder/tableBuilder.js +5 -4
  9. package/dist/migrate/generator/definitionToNode.js +3 -3
  10. package/dist/migrate/generator/mongoSchemaGenerator.js +3 -2
  11. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts +12 -1
  12. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.js +16 -2
  13. package/dist/migrate/introspection/baseSqlIntrospector.d.ts +7 -1
  14. package/dist/migrate/introspection/baseSqlIntrospector.js +11 -12
  15. package/dist/migrate/introspection/mongoIntrospector.js +0 -1
  16. package/dist/migrate/introspection/mysqlIntrospector.d.ts +1 -0
  17. package/dist/migrate/introspection/mysqlIntrospector.js +8 -6
  18. package/dist/migrate/introspection/postgresIntrospector.d.ts +1 -0
  19. package/dist/migrate/introspection/postgresIntrospector.js +6 -5
  20. package/dist/migrate/migrator.d.ts +14 -5
  21. package/dist/migrate/migrator.js +32 -10
  22. package/dist/migrate/schemaGenerator.d.ts +12 -8
  23. package/dist/migrate/schemaGenerator.js +44 -29
  24. package/dist/schema/schemaAST.d.ts +8 -1
  25. package/dist/schema/schemaAST.js +22 -13
  26. package/dist/schema/schemaASTBuilder.d.ts +4 -2
  27. package/dist/schema/schemaASTBuilder.js +17 -25
  28. package/dist/schema/types.d.ts +10 -3
  29. package/dist/type/migration.d.ts +15 -1
  30. package/dist/util/sql.util.d.ts +17 -0
  31. package/dist/util/sql.util.js +23 -0
  32. package/package.json +2 -2
@@ -48,6 +48,29 @@ export function obtainAttrsPaths(row) {
48
48
  }
49
49
  return paths;
50
50
  }
51
+ /**
52
+ * A name behind its namespace, or bare where there is none: the one place the two are joined, so a
53
+ * table's key, its statement operand and its escaped form cannot spell it differently. Never the
54
+ * seed for a derived identifier - an index or constraint name is a single identifier, and
55
+ * `idx_sales.Order_total` is a syntax error.
56
+ */
57
+ export function qualifyName(name, schema) {
58
+ return schema ? `${schema}.${name}` : name;
59
+ }
60
+ /**
61
+ * The name a derived index or constraint gets when nothing named it: `idx_Order_total`.
62
+ *
63
+ * One owner, because it is a rule two layers apply and a third has to match: the entity AST derives
64
+ * it, the DDL generator falls back to it, and a diff compares what the database reports against it.
65
+ * `table` is the table's own name, never qualified - the result is a single identifier.
66
+ */
67
+ export function derivedIndexName(table, columns) {
68
+ return `idx_${table}_${columns.join('_')}`;
69
+ }
70
+ /** The constraint name a foreign key gets when nothing named it: `fk_Order_customerId`. */
71
+ export function derivedForeignKeyName(table, columns) {
72
+ return `fk_${table}_${columns.join('_')}`;
73
+ }
51
74
  /**
52
75
  * Escape a SQL identifier (table name, column name, etc.)
53
76
  * @param val the identifier to escape
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "uql-orm",
3
3
  "homepage": "https://uql-orm.dev",
4
- "description": "JSON-native TypeScript ORM for Node.js, Bun and Deno. Supports PostgreSQL, PGlite, MySQL, MariaDB, SQLite, CockroachDB, Turso, Neon, Cloudflare D1 and MongoDB. Queries are plain JSON, typed to the leaf.",
4
+ "description": "JSON-native ORM for Node.js, Bun and Deno. Supports PostgreSQL, PGlite, MySQL, MariaDB, SQLite, CockroachDB, Turso, Neon, Cloudflare D1 and MongoDB. Queries are plain JSON, typed to the leaf.",
5
5
  "license": "MIT",
6
- "version": "0.34.0",
6
+ "version": "0.35.0",
7
7
  "type": "module",
8
8
  "engines": {
9
9
  "node": ">=24"