Skip to content

Commit eae24a1

Browse files
committed
update to v6.3
1 parent db54e91 commit eae24a1

8 files changed

Lines changed: 1346 additions & 1061 deletions

File tree

package-lock.json

Lines changed: 1278 additions & 1032 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,29 @@
88
"license": "MIT",
99
"homepage": "https://mikro-orm.io/docs/guide",
1010
"dependencies": {
11-
"@fastify/jwt": "^7.2.4",
12-
"@mikro-orm/core": "^6.0.0",
13-
"@mikro-orm/migrations": "^6.0.0",
11+
"@fastify/jwt": "^8.0.1",
12+
"@mikro-orm/core": "^6.3.13",
13+
"@mikro-orm/migrations": "^6.3.13",
1414
"@mikro-orm/sql-highlighter": "^1.0.1",
15-
"@mikro-orm/sqlite": "^6.0.0",
16-
"argon2": "^0.31.2",
17-
"fastify": "^4.25.2",
18-
"zod": "^3.22.4"
15+
"@mikro-orm/sqlite": "^6.3.13",
16+
"argon2": "^0.40.3",
17+
"fastify": "^4.28.1",
18+
"zod": "^3.23.8"
1919
},
2020
"devDependencies": {
21-
"@mikro-orm/cli": "^6.0.0",
22-
"@mikro-orm/reflection": "^6.0.0",
23-
"@mikro-orm/seeder": "^6.0.0",
24-
"@types/node": "^20.10.7",
25-
"@types/slug": "^5.0.7",
21+
"@mikro-orm/cli": "^6.3.13",
22+
"@mikro-orm/reflection": "^6.3.13",
23+
"@mikro-orm/seeder": "^6.3.13",
24+
"@types/node": "^20.14.11",
25+
"@types/slug": "^5.0.8",
2626
"ts-node": "^10.9.2",
27-
"typescript": "^5.3.3",
28-
"vitest": "^1.1.3"
27+
"typescript": "5.5.3",
28+
"vitest": "^2.0.3"
2929
},
3030
"scripts": {
3131
"build": "tsc && npx mikro-orm-esm cache:generate --combined",
3232
"start": "node --no-warnings=ExperimentalWarning --loader ts-node/esm src/server.ts",
3333
"start:prod": "NODE_ENV=production node dist/server.js",
3434
"test": "vitest run"
35-
},
36-
"mikro-orm": {
37-
"useTsNode": true
3835
}
3936
}

src/migrations/.snapshot-sqlite.db.json

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@
5151
"id"
5252
],
5353
"composite": false,
54+
"constraint": true,
5455
"primary": true,
5556
"unique": true
5657
}
5758
],
5859
"checks": [],
59-
"foreignKeys": {}
60+
"foreignKeys": {},
61+
"nativeEnums": {}
6062
},
6163
{
6264
"columns": {
@@ -123,7 +125,17 @@
123125
"autoincrement": false,
124126
"primary": false,
125127
"nullable": false,
128+
"default": "''",
126129
"mappedType": "text"
130+
},
131+
"social": {
132+
"name": "social",
133+
"type": "json",
134+
"unsigned": false,
135+
"autoincrement": false,
136+
"primary": false,
137+
"nullable": true,
138+
"mappedType": "json"
127139
}
128140
},
129141
"name": "user",
@@ -134,12 +146,14 @@
134146
"id"
135147
],
136148
"composite": false,
149+
"constraint": true,
137150
"primary": true,
138151
"unique": true
139152
}
140153
],
141154
"checks": [],
142-
"foreignKeys": {}
155+
"foreignKeys": {},
156+
"nativeEnums": {}
143157
},
144158
{
145159
"columns": {
@@ -227,6 +241,7 @@
227241
],
228242
"composite": false,
229243
"keyName": "article_slug_unique",
244+
"constraint": true,
230245
"primary": false,
231246
"unique": true
232247
},
@@ -236,6 +251,7 @@
236251
],
237252
"composite": false,
238253
"keyName": "article_title_index",
254+
"constraint": false,
239255
"primary": false,
240256
"unique": false
241257
},
@@ -245,6 +261,7 @@
245261
],
246262
"composite": false,
247263
"keyName": "article_author_id_index",
264+
"constraint": false,
248265
"primary": false,
249266
"unique": false
250267
},
@@ -254,6 +271,7 @@
254271
"id"
255272
],
256273
"composite": false,
274+
"constraint": true,
257275
"primary": true,
258276
"unique": true
259277
}
@@ -272,7 +290,8 @@
272290
"referencedTableName": "user",
273291
"updateRule": "cascade"
274292
}
275-
}
293+
},
294+
"nativeEnums": {}
276295
},
277296
{
278297
"columns": {
@@ -342,6 +361,7 @@
342361
],
343362
"composite": false,
344363
"keyName": "comment_article_id_index",
364+
"constraint": false,
345365
"primary": false,
346366
"unique": false
347367
},
@@ -351,6 +371,7 @@
351371
],
352372
"composite": false,
353373
"keyName": "comment_author_id_index",
374+
"constraint": false,
354375
"primary": false,
355376
"unique": false
356377
},
@@ -360,6 +381,7 @@
360381
"id"
361382
],
362383
"composite": false,
384+
"constraint": true,
363385
"primary": true,
364386
"unique": true
365387
}
@@ -390,7 +412,8 @@
390412
"referencedTableName": "user",
391413
"updateRule": "cascade"
392414
}
393-
}
415+
},
416+
"nativeEnums": {}
394417
},
395418
{
396419
"columns": {
@@ -421,6 +444,7 @@
421444
],
422445
"composite": false,
423446
"keyName": "article_tags_article_id_index",
447+
"constraint": false,
424448
"primary": false,
425449
"unique": false
426450
},
@@ -430,6 +454,7 @@
430454
],
431455
"composite": false,
432456
"keyName": "article_tags_tag_id_index",
457+
"constraint": false,
433458
"primary": false,
434459
"unique": false
435460
},
@@ -440,6 +465,7 @@
440465
"tag_id"
441466
],
442467
"composite": true,
468+
"constraint": true,
443469
"primary": true,
444470
"unique": true
445471
}
@@ -472,7 +498,9 @@
472498
"deleteRule": "cascade",
473499
"updateRule": "cascade"
474500
}
475-
}
501+
},
502+
"nativeEnums": {}
476503
}
477-
]
504+
],
505+
"nativeEnums": {}
478506
}

src/migrations/Migration20220913205718.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ export class Migration20220913205718 extends Migration {
88
this.addSql('create index `comment_author_id_index` on `comment` (`author_id`);');
99
}
1010

11+
down(): Promise<void> | void {
12+
this.addSql('drop table `comment`;');
13+
}
14+
1115
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Migration } from '@mikro-orm/migrations';
2+
3+
export class Migration20240601145446 extends Migration {
4+
5+
async up(): Promise<void> {
6+
this.addSql('alter table `user` add column `social` json null;');
7+
}
8+
9+
async down(): Promise<void> {
10+
this.addSql('alter table `user` drop column `social`;');
11+
}
12+
13+
}

src/mikro-orm.config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { defineConfig, GeneratedCacheAdapter, Options } from '@mikro-orm/sqlite';
22
import { SqlHighlighter } from '@mikro-orm/sql-highlighter';
3-
import { SeedManager } from '@mikro-orm/seeder';
4-
import { Migrator } from '@mikro-orm/migrations';
53
import { existsSync, readFileSync } from 'node:fs';
64

75
const options = {} as Options;
@@ -31,6 +29,5 @@ export default defineConfig({
3129
dynamicImportProvider: id => import(id),
3230
// for highlighting the SQL queries
3331
highlighter: new SqlHighlighter(),
34-
extensions: [SeedManager, Migrator],
3532
...options,
3633
});

src/modules/user/routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function registerUserRoutes(app: FastifyInstance) {
3232

3333
// thanks to zod, our `dto` is fully typed and passes the `em.create()` checks
3434
const user = db.user.create(dto);
35-
await db.em.flush(); // no need for explcit `em.persist()` when we use `em.create()`
35+
await db.em.flush(); // no need for explicit `em.persist()` when we use `em.create()`
3636

3737
// after flush, we have the `user.id` set
3838
user.token = app.jwt.sign({ id: user.id });

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"compilerOptions": {
3-
"module": "Node16",
3+
"module": "NodeNext",
4+
"moduleResolution": "NodeNext",
45
"target": "ES2022",
5-
"moduleResolution": "Node16",
66
"strict": true,
77
"outDir": "dist",
88
"declaration": true,

0 commit comments

Comments
 (0)