metal-orm 1.0.10 → 1.0.12

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 (40) hide show
  1. package/README.md +17 -15
  2. package/dist/decorators/index.cjs +15 -2
  3. package/dist/decorators/index.cjs.map +1 -1
  4. package/dist/decorators/index.d.cts +1 -1
  5. package/dist/decorators/index.d.ts +1 -1
  6. package/dist/decorators/index.js +15 -2
  7. package/dist/decorators/index.js.map +1 -1
  8. package/dist/index.cjs +1394 -149
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +257 -23
  11. package/dist/index.d.ts +257 -23
  12. package/dist/index.js +1376 -149
  13. package/dist/index.js.map +1 -1
  14. package/dist/{select-654m4qy8.d.cts → select-BKlr2ivY.d.cts} +141 -4
  15. package/dist/{select-654m4qy8.d.ts → select-BKlr2ivY.d.ts} +141 -4
  16. package/package.json +1 -1
  17. package/src/core/ddl/dialects/base-schema-dialect.ts +48 -0
  18. package/src/core/ddl/dialects/index.ts +5 -0
  19. package/src/core/ddl/dialects/mssql-schema-dialect.ts +97 -0
  20. package/src/core/ddl/dialects/mysql-schema-dialect.ts +109 -0
  21. package/src/core/ddl/dialects/postgres-schema-dialect.ts +99 -0
  22. package/src/core/ddl/dialects/sqlite-schema-dialect.ts +103 -0
  23. package/src/core/ddl/introspect/mssql.ts +149 -0
  24. package/src/core/ddl/introspect/mysql.ts +99 -0
  25. package/src/core/ddl/introspect/postgres.ts +154 -0
  26. package/src/core/ddl/introspect/sqlite.ts +66 -0
  27. package/src/core/ddl/introspect/types.ts +19 -0
  28. package/src/core/ddl/introspect/utils.ts +27 -0
  29. package/src/core/ddl/schema-diff.ts +179 -0
  30. package/src/core/ddl/schema-generator.ts +229 -0
  31. package/src/core/ddl/schema-introspect.ts +32 -0
  32. package/src/core/ddl/schema-types.ts +39 -0
  33. package/src/core/dialect/base/sql-dialect.ts +161 -0
  34. package/src/core/dialect/mysql/index.ts +18 -112
  35. package/src/core/dialect/postgres/index.ts +30 -126
  36. package/src/core/dialect/sqlite/index.ts +29 -129
  37. package/src/index.ts +15 -10
  38. package/src/schema/column.ts +206 -27
  39. package/src/schema/table.ts +89 -32
  40. package/src/schema/types.ts +8 -5
package/README.md CHANGED
@@ -22,10 +22,10 @@ Use only the layer you need in each part of your codebase.
22
22
  <a id="table-of-contents"></a>
23
23
  ## Table of Contents 🧭
24
24
 
25
- - [Documentation](#documentation)
26
- - [Features](#features)
27
- - [Installation](#installation)
28
- - [Quick start three levels](#quick-start)
25
+ - [Documentation](#documentation)
26
+ - [Features](#features)
27
+ - [Installation](#installation)
28
+ - [Quick start - three levels](#quick-start)
29
29
  - [Level 1 – Query builder & hydration](#level-1)
30
30
  - [Level 2 – Entities + Unit of Work](#level-2)
31
31
  - [Level 3 – Decorator entities](#level-3)
@@ -41,16 +41,18 @@ Use only the layer you need in each part of your codebase.
41
41
 
42
42
  Full docs live in the `docs/` folder:
43
43
 
44
- - [Introduction](https://github.com/celsowm/metal-orm/blob/main/docs/index.md)
45
- - [Getting Started](https://github.com/celsowm/metal-orm/blob/main/docs/getting-started.md)
46
- - [Schema Definition](https://github.com/celsowm/metal-orm/blob/main/docs/schema-definition.md)
47
- - [Query Builder](https://github.com/celsowm/metal-orm/blob/main/docs/query-builder.md)
48
- - [DML Operations](https://github.com/celsowm/metal-orm/blob/main/docs/dml-operations.md)
49
- - [Hydration & Entities](https://github.com/celsowm/metal-orm/blob/main/docs/hydration.md)
50
- - [Runtime & Unit of Work](https://github.com/celsowm/metal-orm/blob/main/docs/runtime.md)
51
- - [Advanced Features](https://github.com/celsowm/metal-orm/blob/main/docs/advanced-features.md)
52
- - [Multi-Dialect Support](https://github.com/celsowm/metal-orm/blob/main/docs/multi-dialect-support.md)
53
- - [API Reference](https://github.com/celsowm/metal-orm/blob/main/docs/api-reference.md)
44
+ - [Introduction](https://github.com/celsowm/metal-orm/blob/main/docs/index.md)
45
+ - [Getting Started](https://github.com/celsowm/metal-orm/blob/main/docs/getting-started.md)
46
+ - [Level 3 Backend Tutorial](https://github.com/celsowm/metal-orm/blob/main/docs/level-3-backend-tutorial.md)
47
+ - [Schema Definition](https://github.com/celsowm/metal-orm/blob/main/docs/schema-definition.md)
48
+ - [Query Builder](https://github.com/celsowm/metal-orm/blob/main/docs/query-builder.md)
49
+ - [DML Operations](https://github.com/celsowm/metal-orm/blob/main/docs/dml-operations.md)
50
+ - [Hydration & Entities](https://github.com/celsowm/metal-orm/blob/main/docs/hydration.md)
51
+ - [Runtime & Unit of Work](https://github.com/celsowm/metal-orm/blob/main/docs/runtime.md)
52
+ - [Advanced Features](https://github.com/celsowm/metal-orm/blob/main/docs/advanced-features.md)
53
+ - [Multi-Dialect Support](https://github.com/celsowm/metal-orm/blob/main/docs/multi-dialect-support.md)
54
+ - [Schema Generation (DDL)](https://github.com/celsowm/metal-orm/blob/main/docs/schema-generation.md)
55
+ - [API Reference](https://github.com/celsowm/metal-orm/blob/main/docs/api-reference.md)
54
56
 
55
57
  ---
56
58
 
@@ -492,4 +494,4 @@ See the contributing guide for details.
492
494
  <a id="license"></a>
493
495
  ## License 📄
494
496
 
495
- MetalORM is MIT licensed.
497
+ MetalORM is MIT licensed.
@@ -32,12 +32,25 @@ __export(decorators_exports, {
32
32
  module.exports = __toCommonJS(decorators_exports);
33
33
 
34
34
  // src/schema/table.ts
35
- var defineTable = (name, columns, relations = {}, hooks) => {
35
+ var defineTable = (name, columns, relations = {}, hooks, options = {}) => {
36
36
  const colsWithNames = Object.entries(columns).reduce((acc, [key, def]) => {
37
37
  acc[key] = { ...def, name: key, table: name };
38
38
  return acc;
39
39
  }, {});
40
- return { name, columns: colsWithNames, relations, hooks };
40
+ return {
41
+ name,
42
+ schema: options.schema,
43
+ columns: colsWithNames,
44
+ relations,
45
+ hooks,
46
+ primaryKey: options.primaryKey,
47
+ indexes: options.indexes,
48
+ checks: options.checks,
49
+ comment: options.comment,
50
+ engine: options.engine,
51
+ charset: options.charset,
52
+ collation: options.collation
53
+ };
41
54
  };
42
55
 
43
56
  // src/orm/entity-metadata.ts