imodel 0.3.1 → 0.4.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/index.d.mts +122 -107
- package/index.mjs +622 -480
- package/migrate.d.mts +7 -7
- package/migrate.mjs +25 -22
- package/package.json +1 -1
package/migrate.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* imodel v0.
|
|
2
|
+
* imodel v0.4.1
|
|
3
3
|
* (c) 2019-2025 undefined
|
|
4
4
|
* @license undefined
|
|
5
5
|
*/
|
|
@@ -425,12 +425,12 @@ declare class TableModifier extends TableAdder implements Migrator$2 {
|
|
|
425
425
|
index(fields: string[], { name, unique }?: IndexOptions): this;
|
|
426
426
|
/**
|
|
427
427
|
*
|
|
428
|
-
* @param {string}
|
|
428
|
+
* @param {string} column
|
|
429
429
|
* @param {string} type
|
|
430
430
|
* @param {ColumnOptions<any>} [options]
|
|
431
431
|
* @returns {this}
|
|
432
432
|
*/
|
|
433
|
-
field(
|
|
433
|
+
field(column: string, type: string, { unique, nullable, default: defaultValue, index, ...p }?: ColumnOptions<any>): this;
|
|
434
434
|
/** @readonly @type {TableModifier | TableCreator} */
|
|
435
435
|
readonly last: TableModifier | TableCreator;
|
|
436
436
|
/** @readonly @type {string} */
|
|
@@ -448,12 +448,12 @@ declare class TableModifier extends TableAdder implements Migrator$2 {
|
|
|
448
448
|
renameColumn(field: string, newName: string): this;
|
|
449
449
|
/**
|
|
450
450
|
*
|
|
451
|
-
* @param {string}
|
|
451
|
+
* @param {string} column
|
|
452
452
|
* @param {string} type
|
|
453
453
|
* @param {ColumnOptions<any>} [options]
|
|
454
454
|
* @returns {this}
|
|
455
455
|
*/
|
|
456
|
-
changeColumn(
|
|
456
|
+
changeColumn(column: string, type: string, { unique, nullable, default: defaultValue, index, ...p }?: ColumnOptions<any>): this;
|
|
457
457
|
/**
|
|
458
458
|
* @param {string} field
|
|
459
459
|
* @returns {this}
|
|
@@ -512,12 +512,12 @@ declare class TableCreator extends TableAdder implements Migrator$1 {
|
|
|
512
512
|
index(fields: string[], { name, unique }?: IndexOptions): this;
|
|
513
513
|
/**
|
|
514
514
|
*
|
|
515
|
-
* @param {string}
|
|
515
|
+
* @param {string} column
|
|
516
516
|
* @param {string} type
|
|
517
517
|
* @param {ColumnOptions<any>} [options]
|
|
518
518
|
* @returns {this}
|
|
519
519
|
*/
|
|
520
|
-
field(
|
|
520
|
+
field(column: string, type: string, { unique, nullable, default: defaultValue, index, ...p }?: ColumnOptions<any>): this;
|
|
521
521
|
/**
|
|
522
522
|
* @param {Connection} connection
|
|
523
523
|
* @param {Echo} echoDescription
|
package/migrate.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* imodel v0.
|
|
2
|
+
* imodel v0.4.1
|
|
3
3
|
* (c) 2019-2025 undefined
|
|
4
4
|
* @license undefined
|
|
5
5
|
*/
|
|
@@ -555,32 +555,32 @@ class TableModifier extends TableAdder {
|
|
|
555
555
|
}
|
|
556
556
|
/**
|
|
557
557
|
*
|
|
558
|
-
* @param {string}
|
|
558
|
+
* @param {string} column
|
|
559
559
|
* @param {string} type
|
|
560
560
|
* @param {ColumnOptions<any>} [options]
|
|
561
561
|
* @returns {this}
|
|
562
562
|
*/
|
|
563
|
-
field(
|
|
563
|
+
field(column, type, {
|
|
564
564
|
unique,
|
|
565
565
|
nullable = true,
|
|
566
566
|
default: defaultValue,
|
|
567
567
|
index,
|
|
568
568
|
...p
|
|
569
569
|
} = {}) {
|
|
570
|
-
this.list.push(['field',
|
|
570
|
+
this.list.push(['field', column, {
|
|
571
571
|
...p,
|
|
572
572
|
unique,
|
|
573
573
|
nullable,
|
|
574
574
|
default: defaultValue,
|
|
575
575
|
type,
|
|
576
|
-
|
|
576
|
+
column
|
|
577
577
|
}]);
|
|
578
578
|
if (index) {
|
|
579
|
-
const indexName = index === true ?
|
|
579
|
+
const indexName = index === true ? column : index;
|
|
580
580
|
this.list.push(['index', indexName, {
|
|
581
581
|
name: indexName,
|
|
582
582
|
unique,
|
|
583
|
-
fields: [
|
|
583
|
+
fields: [column]
|
|
584
584
|
}]);
|
|
585
585
|
}
|
|
586
586
|
return this;
|
|
@@ -634,37 +634,37 @@ class TableModifier extends TableAdder {
|
|
|
634
634
|
}
|
|
635
635
|
/**
|
|
636
636
|
*
|
|
637
|
-
* @param {string}
|
|
637
|
+
* @param {string} column
|
|
638
638
|
* @param {string} type
|
|
639
639
|
* @param {ColumnOptions<any>} [options]
|
|
640
640
|
* @returns {this}
|
|
641
641
|
*/
|
|
642
|
-
changeColumn(
|
|
642
|
+
changeColumn(column, type, {
|
|
643
643
|
unique,
|
|
644
644
|
nullable = true,
|
|
645
645
|
default: defaultValue,
|
|
646
646
|
index,
|
|
647
647
|
...p
|
|
648
648
|
} = {}) {
|
|
649
|
-
const col = findColumn(
|
|
649
|
+
const col = findColumn(column, this);
|
|
650
650
|
const oldIndex = col?.index;
|
|
651
651
|
if (oldIndex) {
|
|
652
|
-
this.list.push(['removeIndex', oldIndex === true ?
|
|
652
|
+
this.list.push(['removeIndex', oldIndex === true ? column : oldIndex]);
|
|
653
653
|
}
|
|
654
|
-
this.list.push(['field',
|
|
654
|
+
this.list.push(['field', column, {
|
|
655
655
|
...p,
|
|
656
656
|
unique,
|
|
657
657
|
nullable,
|
|
658
658
|
default: defaultValue,
|
|
659
|
-
|
|
659
|
+
column,
|
|
660
660
|
type
|
|
661
661
|
}]);
|
|
662
662
|
if (index) {
|
|
663
|
-
const indexName = index === true ?
|
|
663
|
+
const indexName = index === true ? column : index;
|
|
664
664
|
this.list.push(['index', indexName, {
|
|
665
665
|
name: indexName,
|
|
666
666
|
unique,
|
|
667
|
-
fields: [
|
|
667
|
+
fields: [column]
|
|
668
668
|
}]);
|
|
669
669
|
}
|
|
670
670
|
return this;
|
|
@@ -849,6 +849,9 @@ class TableCreator extends TableAdder {
|
|
|
849
849
|
const {
|
|
850
850
|
type
|
|
851
851
|
} = field;
|
|
852
|
+
if (!type) {
|
|
853
|
+
continue;
|
|
854
|
+
}
|
|
852
855
|
if (typeof type === 'string') {
|
|
853
856
|
this.field(name, type, field);
|
|
854
857
|
continue;
|
|
@@ -895,33 +898,33 @@ class TableCreator extends TableAdder {
|
|
|
895
898
|
}
|
|
896
899
|
/**
|
|
897
900
|
*
|
|
898
|
-
* @param {string}
|
|
901
|
+
* @param {string} column
|
|
899
902
|
* @param {string} type
|
|
900
903
|
* @param {ColumnOptions<any>} [options]
|
|
901
904
|
* @returns {this}
|
|
902
905
|
*/
|
|
903
|
-
field(
|
|
906
|
+
field(column, type, {
|
|
904
907
|
unique,
|
|
905
908
|
nullable = true,
|
|
906
909
|
default: defaultValue,
|
|
907
910
|
index,
|
|
908
911
|
...p
|
|
909
912
|
} = {}) {
|
|
910
|
-
this.fields[
|
|
913
|
+
this.fields[column] = {
|
|
911
914
|
...p,
|
|
912
915
|
unique,
|
|
913
916
|
nullable,
|
|
914
917
|
default: defaultValue,
|
|
915
|
-
|
|
918
|
+
column,
|
|
916
919
|
type
|
|
917
920
|
};
|
|
918
|
-
this.#fields.push(
|
|
921
|
+
this.#fields.push(column);
|
|
919
922
|
if (index) {
|
|
920
|
-
const indexName = index === true ?
|
|
923
|
+
const indexName = index === true ? column : index;
|
|
921
924
|
this.indexes[indexName] = {
|
|
922
925
|
unique,
|
|
923
926
|
name: indexName,
|
|
924
|
-
fields: [
|
|
927
|
+
fields: [column]
|
|
925
928
|
};
|
|
926
929
|
this.#indexes.push(indexName);
|
|
927
930
|
}
|