Adrien de Peretti
79ec2bcfe2
fix: Migration generator and generated migrations ( #8090 )
2024-07-11 18:21:09 +02:00
Adrien de Peretti
41c4307fc7
feat: define link util ( #7931 )
...
* feat: define link util
* handle pluralized fieldAlias for isList
* serviceName ar reference
* finalize
* todo
* WIP
* finalize
* fix tests
* update typings
* fix Module
* linkable
* update errors
2024-07-04 10:37:30 +02:00
Adrien de Peretti
617a5972bf
feat: refactor module joiner config and links generation ( #7859 )
...
* feat: refactor module joiner config and links generation
* improve typings
* WIP
* WIP
* WIP
* rename type file
* create link config
* finish typings and add utils
* improve links
* WIP typings
* finalize ExportModule utils
* finalize ExportModule utils
* fix: dml tests
* improve and fixes
* simplify typings with id changes
* add toJSON
* multiple fixes and entity builder fixes
* fix currency searchable
* fix tests
* medusa service refactoring
* cleanup
* cleanup and fixes
* make module name optional
* renaming
---------
Co-authored-by: Harminder Virk <virk.officials@gmail.com >
2024-07-03 13:12:49 +02:00
Harminder Virk
46f15b4909
fix: inferring of relationship types ( #7913 )
...
FIXES: CORE-2448
2024-07-03 13:29:27 +05:30
Harminder Virk
b3236ff31c
Add support for native enums ( #7903 )
2024-07-02 15:22:09 +05:30
Harminder Virk
074e4a888e
Mark keys as primary with explicit method call ( #7900 )
2024-07-02 13:27:21 +05:30
Shahed Nasser
72f7500c84
chore(docs): DML API Reference ( #7863 )
...
* added dml options
* added tsdocs + configurations
2024-07-01 10:21:56 +03:00
Oli Juhl
fa6cd84049
chore: Migrate region module to use DML ( #7837 )
2024-06-29 13:14:52 +00:00
Riqwan Thamir
789d545b9e
feat(utils,types): infer keys in query builder from schema ( #7861 )
2024-06-27 20:38:06 +02:00
Riqwan Thamir
91098877c2
fix(utils): always apply default indexes ( #7858 )
...
what:
- fixes default indexes not being applied always
2024-06-27 16:05:28 +00:00
Riqwan Thamir
91faa5ffdb
feat(utils): DML generates foreign key indexes by default ( #7855 )
...
**what:**
- adds default indexes on foreign keys when belongs to relationship is present
RESOLVES CORE-2404
2024-06-27 14:45:27 +00:00
Riqwan Thamir
3f16b011fa
feat(utils,types): DML Index can generate where SQL from a query builder ( #7849 )
...
what:
- introduces a simple query builder
- uses the query builder to tranform an object in where to SQL when applying indexes
```
Examples:
{ where: { column: null } } -> column IS NULL
{ where: { column: { $ne: null } } } -> column IS NOT NULL
{ where: { boolean_column: true } } -> boolean_column IS TRUE
{ where: { column: "value", another_column: { $ne: 30 } } } -> column = "value" AND another_column != 30
```
```
const user = model
.define("user", {
email: model.text(),
account: model.text(),
organization: model.text(),
})
.indexes([
{
on: ["organization", "account"],
where: { email: { $ne: null } },
},
{
name: "IDX-email-account-special",
on: ["organization", "account"],
where: {
email: { $ne: null },
account: null,
},
},
```
RESOLVES CORE-2392
2024-06-27 10:24:34 +00:00
Riqwan Thamir
5ee97d0e97
feat(utils,types): DML can apply composite indexes ( #7842 )
...
**what:**
- DML can apply composite indexes
- Where clause is currently a string, QB version will come as a follow up
```
model.define("user", {
email: model.text(),
account: model.text(),
}).indexes([
{
name: "IDX-unique-name",
unique: true,
on: ["email", "account"],
where: "email is NOT NULL",
},
])
```
RESOLVES CORE-2391
2024-06-26 15:39:04 +00:00
Adrien de Peretti
68dbcda84c
fix: DML Enum property ( #7846 )
...
* fix: DML Enum property
* add more tests
* fix unit tests
2024-06-26 17:01:57 +02:00
Riqwan Thamir
4945c79818
feat(utils): infer primaryKeys from a DML model ( #7839 )
...
what:
- depending on other properties in a DML model, we infer primaryKeys between id properties and primaryKey-able properties.
```
Example:
Model 1:
id: model.id() -> primary key
code: model.text()
Model 2:
id: model.id()
code: model.text().primaryKey() -> primary key
Model 3:
id: model.id()
code: model.text().primaryKey() -> composite primary key
name: model.text().primaryKey() -> composite primary key
```
2024-06-26 09:26:09 +00:00
Adrien de Peretti
dc307c658d
feat: Add support for array properties DML ( #7836 )
2024-06-25 20:51:14 +02:00
Adrien de Peretti
39038ddb0a
chore: various DML improvements ( #7833 )
...
* chore: various DML improvements
* Check is something through static utils
* Check is something through static utils
* allow to define a schema with table name
* restrict searchable to text only
* rm searchable modifier
* extract constructor logic into separate function
2024-06-25 18:00:39 +02:00
Adrien de Peretti
34c44078e7
fix: DML relation management for many to one relation ship foreign keys ( #7790 )
...
FIXES CORE-2369
cc @thetutlage
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com >
2024-06-24 18:54:54 +00:00
Riqwan Thamir
96fb7a962e
feat(utils,currency): Migrate currency to use DML ( #7807 )
2024-06-24 19:07:26 +02:00
Riqwan Thamir
5c944ae5d0
feat(types,utils): DML can create a bigNumber property ( #7801 )
...
what:
- adds bigNumber as a property to DML
- creates a bigNumber options field (`raw_{{ field }}`) as a part of the schema
RESOLVES CORE-2375
2024-06-24 08:29:18 +00:00
Adrien de Peretti
ae6dbc06be
chore: Update module test runner to support DmlEntities when needed ( #7799 )
...
* chore: Update module test runner to support DmlEntities when needed
* update es version for core test utils
* fix test
* update swc config
2024-06-24 09:44:01 +02:00
Adrien de Peretti
8fa43a6db3
Feat/define mikro orm configuration dev ( #7798 )
...
* chore: define mikro orm config for CLI
* add tests
* fix types
* fix import
---------
Co-authored-by: Riqwan Thamir <rmthamir@gmail.com >
2024-06-24 09:10:54 +02:00
Harminder Virk
d122b678a8
feat: initialize nullable properties with null value ( #7795 )
2024-06-21 16:41:26 +05:30
Adrien de Peretti
90e6ca0e9e
chore: Internal medusa service proper typings with DML ( #7792 )
2024-06-21 12:36:54 +02:00
Adrien de Peretti
937a632eb6
chore: make module loaders DML aware and auto generate joiner config ( #7781 )
...
* chore: make module loaders DML aware and auto generate joiner config
* fixes and cleanup
* improve dml entity check
* add unit tests on load resources
* cleanup deps
* cleanup deps
* cleanup Modules
* finalise
* fix modules-sdk jest
* fix modules-sdk jest
* fix import
* fix import
2024-06-20 18:18:07 +02:00
Riqwan Thamir
33c4cd34cc
chore: export DML builders + fix default undefined values in SQL ( #7776 )
...
* chore: export dml builders through utils
* chore: fix undefined sql error
* chore: upgrade to ts 5
* chore: use isDefined
2024-06-20 10:45:49 +02:00
Harminder Virk
45ad70e96b
Add support for pivot table and entity in manyToMany relationships ( #7779 )
2024-06-20 14:13:31 +05:30
Harminder Virk
2895ccfba8
Add support for id property type ( #7775 )
2024-06-19 17:59:03 +05:30
Harminder Virk
fd87858bd9
Handle embedded pg schema name inside the table name when generating indexes ( #7774 )
2024-06-19 16:48:44 +05:30
Harminder Virk
0b623fa27a
Allow entities to contain pg schema name in their name ( #7773 )
2024-06-19 14:39:33 +05:30
Harminder Virk
1451112f08
Add support for created and updated at timestamps ( #7765 )
2024-06-18 21:22:31 +05:30
Harminder Virk
8410592239
Rename schema to property ( #7761 )
2024-06-18 16:14:09 +05:30
Harminder Virk
4f7bbf1f29
feat: add support for indexes ( #7756 )
2024-06-18 13:41:16 +05:30
Harminder Virk
0886869148
feat: mark all DML entities as soft delete-able by default ( #7744 )
2024-06-17 16:16:56 +05:30
Harminder Virk
0b9a6d5a52
Identify the owner when both sides defines a many to many relationship ( #7741 )
2024-06-17 14:47:14 +05:30
Harminder Virk
2af3f9e954
Add support for cascades to DML ( #7721 )
2024-06-14 13:45:11 +05:30
Harminder Virk
fbd8eef18b
Overall revamp of relationships ( #7690 )
2024-06-13 11:19:53 +05:30
Harminder Virk
6d43daa930
Code cleanup and add support for default values and nullable relationships ( #7687 )
2024-06-12 14:39:03 +05:30
Harminder Virk
5f348d88f4
Initial implementation of DML to Mikro ORM entity generation ( #7667 )
...
* feat: initial implementation of DML to Mikro ORM entity generation
CORE-2279
* test: fix breaking tests
* refactor: cleanup code for defining properties and relationships
* feat: finish initial implementation of relationships
2024-06-11 21:00:36 +05:30
Harminder Virk
7f53fe06b6
Initial implementation of data types and base schema ( #7644 )
2024-06-10 14:31:42 +05:30