mikro-orm-temporal 1.2.1 → 2.0.1
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.
- package/README.md +20 -8
- package/dist/instant-type.js +1 -1
- package/dist/offset-date-time-type.js +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -31,15 +31,27 @@ yarn add mikro-orm-temporal
|
|
|
31
31
|
|
|
32
32
|
## Usage
|
|
33
33
|
|
|
34
|
+
### With `defineEntity` (recommended)
|
|
35
|
+
|
|
36
|
+
Use `p.type()` from `@mikro-orm/core` to wire up any temporal type, then chain modifiers like
|
|
37
|
+
`.nullable()` as needed:
|
|
38
|
+
|
|
34
39
|
```ts
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
import { defineEntity, p } from '@mikro-orm/core';
|
|
41
|
+
import { OffsetDateTimeType, PlainDateType } from 'mikro-orm-temporal';
|
|
42
|
+
|
|
43
|
+
const EventSchema = defineEntity({
|
|
44
|
+
name: 'Event',
|
|
45
|
+
properties: {
|
|
46
|
+
id: p.integer().primary(),
|
|
47
|
+
startsAt: p.type(OffsetDateTimeType),
|
|
48
|
+
endsAt: () => p.type(OffsetDateTimeType).nullable(),
|
|
49
|
+
date: p.type(PlainDateType),
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export class Event extends EventSchema.class {}
|
|
54
|
+
EventSchema.setClass(Event);
|
|
43
55
|
```
|
|
44
56
|
|
|
45
57
|
## Caveats
|
package/dist/instant-type.js
CHANGED
|
@@ -37,7 +37,7 @@ export class InstantType extends Type {
|
|
|
37
37
|
getColumnType(prop, platform) {
|
|
38
38
|
if (isMsSql(platform)) {
|
|
39
39
|
// MSSQL has a true single-purpose column type for timestamps with offset.
|
|
40
|
-
return "
|
|
40
|
+
return "datetimeoffset(7)";
|
|
41
41
|
}
|
|
42
42
|
return platform.getDateTimeTypeDeclarationSQL({ length: prop.length });
|
|
43
43
|
}
|
|
@@ -37,7 +37,7 @@ export class OffsetDateTimeType extends Type {
|
|
|
37
37
|
getColumnType(prop, platform) {
|
|
38
38
|
if (isMsSql(platform)) {
|
|
39
39
|
// MSSQL has a true single-purpose column type for timestamps with offset.
|
|
40
|
-
return "
|
|
40
|
+
return "datetimeoffset(7)";
|
|
41
41
|
}
|
|
42
42
|
return platform.getDateTimeTypeDeclarationSQL({ length: prop.length });
|
|
43
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mikro-orm-temporal",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Temporal types for Mikro ORM",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ben Scholzen 'DASPRiD'",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"@biomejs/biome": "2.2.7",
|
|
48
48
|
"@commitlint/cli": "^20.1.0",
|
|
49
49
|
"@commitlint/config-conventional": "^20.0.0",
|
|
50
|
-
"@mikro-orm/
|
|
51
|
-
"@mikro-orm/
|
|
52
|
-
"@mikro-orm/
|
|
53
|
-
"@mikro-orm/
|
|
54
|
-
"@mikro-orm/
|
|
55
|
-
"@mikro-orm/
|
|
50
|
+
"@mikro-orm/core": "^7.0.1",
|
|
51
|
+
"@mikro-orm/mariadb": "^7.0.1",
|
|
52
|
+
"@mikro-orm/mssql": "^7.0.1",
|
|
53
|
+
"@mikro-orm/mysql": "^7.0.1",
|
|
54
|
+
"@mikro-orm/postgresql": "^7.0.1",
|
|
55
|
+
"@mikro-orm/sqlite": "^7.0.1",
|
|
56
56
|
"@tsconfig/node22": "^22.0.2",
|
|
57
57
|
"@types/node": "^24.9.1",
|
|
58
58
|
"c8": "^10.1.3",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"typescript": "^5.9.3"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@mikro-orm/core": "^
|
|
66
|
+
"@mikro-orm/core": "^7.0.1"
|
|
67
67
|
},
|
|
68
68
|
"packageManager": "pnpm@10.19.0+sha512.c9fc7236e92adf5c8af42fd5bf1612df99c2ceb62f27047032f4720b33f8eacdde311865e91c411f2774f618d82f320808ecb51718bfa82c060c4ba7c76a32b8",
|
|
69
69
|
"pnpm": {
|