@fuzionx/framework 0.1.63 → 0.1.65
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/cli/index.js
CHANGED
|
@@ -57,6 +57,9 @@ function _knexColumnBuilder(t, col, def) {
|
|
|
57
57
|
case 'increments':
|
|
58
58
|
c = t.increments(col);
|
|
59
59
|
return; // increments는 자동으로 PK + NOT NULL
|
|
60
|
+
case 'bigIncrements':
|
|
61
|
+
c = t.bigIncrements(col);
|
|
62
|
+
return; // bigIncrements는 BIGSERIAL PK + NOT NULL
|
|
60
63
|
case 'integer':
|
|
61
64
|
c = t.integer(col);
|
|
62
65
|
break;
|
|
@@ -545,9 +548,9 @@ export async function run(args) {
|
|
|
545
548
|
for (const { name, table, cols } of models) {
|
|
546
549
|
const colDefs = [];
|
|
547
550
|
for (const [col, def] of Object.entries(cols)) {
|
|
548
|
-
if (def.type === 'increments') {
|
|
551
|
+
if (def.type === 'increments' || def.type === 'bigIncrements') {
|
|
549
552
|
colDefs.push(`\`${col}\` INTEGER PRIMARY KEY AUTOINCREMENT`);
|
|
550
|
-
} else if (def.type === 'integer') {
|
|
553
|
+
} else if (def.type === 'integer' || def.type === 'bigInteger') {
|
|
551
554
|
const dflt = def.default != null ? def.default : 0;
|
|
552
555
|
colDefs.push(`\`${col}\` INTEGER${def.nullable ? '' : ' NOT NULL'} DEFAULT ${dflt}`);
|
|
553
556
|
} else if (def.type === 'text') {
|
|
@@ -735,7 +738,7 @@ export async function run(args) {
|
|
|
735
738
|
if (!targetInfo) continue; // 대상 모델을 찾을 수 없으면 스킵
|
|
736
739
|
|
|
737
740
|
const targetTable = targetInfo.table;
|
|
738
|
-
const targetKey = rel.ownerKey || '
|
|
741
|
+
const targetKey = rel.ownerKey || targetInfo.Model?.primaryKey || '_id'; // 대상 테이블의 참조 키 (Model.primaryKey 참조)
|
|
739
742
|
|
|
740
743
|
// FK 제약명: fk_{테이블}_{FK컬럼}
|
|
741
744
|
const fkName = `fk_${table}_${foreignKey}`;
|
package/lib/database/Model.js
CHANGED
|
@@ -10,7 +10,7 @@ import { ServiceError } from '../core/AppError.js';
|
|
|
10
10
|
export default class Model {
|
|
11
11
|
// ── Static 멤버 (서브클래스에서 오버라이드) ──
|
|
12
12
|
static table = ''; // 테이블명 / 컬렉션명
|
|
13
|
-
static primaryKey = '
|
|
13
|
+
static primaryKey = '_id'; // 기본키 (MongoDB 통일)
|
|
14
14
|
static connection = 'main'; // DB 연결명
|
|
15
15
|
static timestamps = true; // created_at, updated_at 자동
|
|
16
16
|
static softDelete = false; // deleted_at 소프트 삭제
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* static table = 'analytics';
|
|
15
15
|
* static connection = 'analytics_db';
|
|
16
16
|
* static columns = {
|
|
17
|
-
*
|
|
17
|
+
* _id: { type: 'bigIncrements' },
|
|
18
18
|
* event: { type: 'string', length: 100 },
|
|
19
19
|
* meta: { type: 'json' },
|
|
20
20
|
* created: { type: 'timestamp' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuzionx/framework",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Full-stack MVC framework built on @fuzionx/core — Controller, Service, Model, Middleware, DI, EventBus",
|
|
6
6
|
"main": "index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"url": "https://github.com/saytohenry/fuzionx"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@fuzionx/core": "^0.1.
|
|
37
|
+
"@fuzionx/core": "^0.1.65",
|
|
38
38
|
"better-sqlite3": "^12.8.0",
|
|
39
39
|
"knex": "^3.2.5",
|
|
40
40
|
"mongoose": "^9.3.2",
|