sequelize-typescript-generator 10.1.2 → 11.0.2
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/.github/workflows/ci.yml +24 -19
- package/README.md +164 -200
- package/build/dialects/DialectMSSQL.js +2 -0
- package/build/dialects/DialectPostgres.js +2 -0
- package/package.json +19 -19
- package/tsconfig.json +12 -63
package/.github/workflows/ci.yml
CHANGED
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
- name: Setup node
|
|
12
12
|
uses: actions/setup-node@v2
|
|
13
13
|
with:
|
|
14
|
-
node-version: '
|
|
14
|
+
node-version: '16'
|
|
15
15
|
|
|
16
16
|
- name: Cache node_modules
|
|
17
17
|
id: cache-node-modules
|
|
@@ -36,7 +36,7 @@ jobs:
|
|
|
36
36
|
- name: Setup node
|
|
37
37
|
uses: actions/setup-node@v2
|
|
38
38
|
with:
|
|
39
|
-
node-version: '
|
|
39
|
+
node-version: '16'
|
|
40
40
|
|
|
41
41
|
- name: Restore node_modules
|
|
42
42
|
id: cache-node-modules
|
|
@@ -65,7 +65,7 @@ jobs:
|
|
|
65
65
|
- name: Setup node
|
|
66
66
|
uses: actions/setup-node@v2
|
|
67
67
|
with:
|
|
68
|
-
node-version: '
|
|
68
|
+
node-version: '16'
|
|
69
69
|
|
|
70
70
|
- name: Restore node_modules
|
|
71
71
|
id: cache-node-modules
|
|
@@ -74,20 +74,20 @@ jobs:
|
|
|
74
74
|
path: node_modules
|
|
75
75
|
key: node-modules-${{ hashFiles('package-lock.json') }}
|
|
76
76
|
|
|
77
|
-
- name: Test Postgres
|
|
77
|
+
- name: Test Postgres 11
|
|
78
78
|
run: npm run test-postgres
|
|
79
79
|
env:
|
|
80
|
-
DOCKER_POSTGRES_TAG:
|
|
80
|
+
DOCKER_POSTGRES_TAG: 11
|
|
81
81
|
|
|
82
|
-
- name: Test Postgres
|
|
82
|
+
- name: Test Postgres 14
|
|
83
83
|
run: npm run test-postgres
|
|
84
84
|
env:
|
|
85
|
-
DOCKER_POSTGRES_TAG:
|
|
85
|
+
DOCKER_POSTGRES_TAG: 14
|
|
86
86
|
|
|
87
|
-
- name: Test Postgres
|
|
87
|
+
- name: Test Postgres 16
|
|
88
88
|
run: npm run test-postgres
|
|
89
89
|
env:
|
|
90
|
-
DOCKER_POSTGRES_TAG:
|
|
90
|
+
DOCKER_POSTGRES_TAG: 16
|
|
91
91
|
|
|
92
92
|
test_mariadb:
|
|
93
93
|
runs-on: ubuntu-latest
|
|
@@ -99,7 +99,7 @@ jobs:
|
|
|
99
99
|
- name: Setup node
|
|
100
100
|
uses: actions/setup-node@v2
|
|
101
101
|
with:
|
|
102
|
-
node-version: '
|
|
102
|
+
node-version: '16'
|
|
103
103
|
|
|
104
104
|
- name: Restore node_modules
|
|
105
105
|
id: cache-node-modules
|
|
@@ -108,10 +108,15 @@ jobs:
|
|
|
108
108
|
path: node_modules
|
|
109
109
|
key: node-modules-${{ hashFiles('package-lock.json') }}
|
|
110
110
|
|
|
111
|
-
- name: Test MariaDB 10
|
|
111
|
+
- name: Test MariaDB 10
|
|
112
112
|
run: npm run test-mariadb
|
|
113
113
|
env:
|
|
114
|
-
DOCKER_MARIADB_TAG: 10
|
|
114
|
+
DOCKER_MARIADB_TAG: 10
|
|
115
|
+
|
|
116
|
+
- name: Test MariaDB 11
|
|
117
|
+
run: npm run test-mariadb
|
|
118
|
+
env:
|
|
119
|
+
DOCKER_MARIADB_TAG: 11
|
|
115
120
|
|
|
116
121
|
test_mssql:
|
|
117
122
|
runs-on: ubuntu-latest
|
|
@@ -123,7 +128,7 @@ jobs:
|
|
|
123
128
|
- name: Setup node
|
|
124
129
|
uses: actions/setup-node@v2
|
|
125
130
|
with:
|
|
126
|
-
node-version: '
|
|
131
|
+
node-version: '16'
|
|
127
132
|
|
|
128
133
|
- name: Restore node_modules
|
|
129
134
|
id: cache-node-modules
|
|
@@ -132,15 +137,15 @@ jobs:
|
|
|
132
137
|
path: node_modules
|
|
133
138
|
key: node-modules-${{ hashFiles('package-lock.json') }}
|
|
134
139
|
|
|
135
|
-
- name: Test MSSQL
|
|
140
|
+
- name: Test MSSQL 2019
|
|
136
141
|
run: npm run test-mssql
|
|
137
142
|
env:
|
|
138
|
-
DOCKER_MSSQL_TAG:
|
|
143
|
+
DOCKER_MSSQL_TAG: 2019-latest
|
|
139
144
|
|
|
140
|
-
- name: Test MSSQL
|
|
145
|
+
- name: Test MSSQL 2022
|
|
141
146
|
run: npm run test-mssql
|
|
142
147
|
env:
|
|
143
|
-
DOCKER_MSSQL_TAG:
|
|
148
|
+
DOCKER_MSSQL_TAG: 2022-latest
|
|
144
149
|
|
|
145
150
|
test_sqlite:
|
|
146
151
|
runs-on: ubuntu-latest
|
|
@@ -152,7 +157,7 @@ jobs:
|
|
|
152
157
|
- name: Setup node
|
|
153
158
|
uses: actions/setup-node@v2
|
|
154
159
|
with:
|
|
155
|
-
node-version: '
|
|
160
|
+
node-version: '16'
|
|
156
161
|
|
|
157
162
|
- name: Restore node_modules
|
|
158
163
|
id: cache-node-modules
|
|
@@ -174,7 +179,7 @@ jobs:
|
|
|
174
179
|
- name: Setup node
|
|
175
180
|
uses: actions/setup-node@v2
|
|
176
181
|
with:
|
|
177
|
-
node-version: '
|
|
182
|
+
node-version: '16'
|
|
178
183
|
|
|
179
184
|
- name: Restore node_modules
|
|
180
185
|
id: cache-node-modules
|
package/README.md
CHANGED
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
|
|
21
21
|
<!-- toc stop -->
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## Tested databases
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
This library is tested on the following databases:
|
|
26
26
|
|
|
27
|
-
- Postgres (
|
|
27
|
+
- Postgres (11, 14, 16)
|
|
28
28
|
- Mysql (5, 8)
|
|
29
|
-
- MariaDB (10)
|
|
30
|
-
- SQL Server (
|
|
29
|
+
- MariaDB (10, 11)
|
|
30
|
+
- SQL Server (2019, 2022)
|
|
31
31
|
- SQLite (3)
|
|
32
32
|
|
|
33
33
|
## Prerequisites
|
|
@@ -472,89 +472,77 @@ This will generate the following models:
|
|
|
472
472
|
|
|
473
473
|
```ts
|
|
474
474
|
import {
|
|
475
|
-
|
|
475
|
+
Model, Table, Column, DataType, Index, Sequelize, ForeignKey, HasOne
|
|
476
476
|
} from "sequelize-typescript";
|
|
477
477
|
import { passport } from "./passport";
|
|
478
478
|
|
|
479
|
+
export interface personAttributes {
|
|
480
|
+
person_id: number;
|
|
481
|
+
name: string;
|
|
482
|
+
passport_id: number;
|
|
483
|
+
}
|
|
484
|
+
|
|
479
485
|
@Table({
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
comment: ""
|
|
486
|
+
tableName: "person",
|
|
487
|
+
timestamps: false
|
|
483
488
|
})
|
|
484
|
-
export class person extends Model {
|
|
489
|
+
export class person extends Model<personAttributes, personAttributes> implements personAttributes {
|
|
485
490
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
@Index({
|
|
492
|
-
name: "PRIMARY",
|
|
493
|
-
using: "BTREE",
|
|
494
|
-
order: "ASC",
|
|
495
|
-
unique: true
|
|
496
|
-
})
|
|
497
|
-
person_id!: number;
|
|
491
|
+
@Column({
|
|
492
|
+
primaryKey: true,
|
|
493
|
+
type: DataType.INTEGER
|
|
494
|
+
})
|
|
495
|
+
person_id!: number;
|
|
498
496
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
name!: string;
|
|
497
|
+
@Column({
|
|
498
|
+
type: DataType.STRING(80)
|
|
499
|
+
})
|
|
500
|
+
name!: string;
|
|
504
501
|
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
@Index({
|
|
510
|
-
name: "person_passport_passport_id_fk",
|
|
511
|
-
using: "BTREE",
|
|
512
|
-
order: "ASC",
|
|
513
|
-
unique: false
|
|
514
|
-
})
|
|
515
|
-
passport_id!: number;
|
|
502
|
+
@Column({
|
|
503
|
+
type: DataType.INTEGER
|
|
504
|
+
})
|
|
505
|
+
passport_id!: number;
|
|
516
506
|
|
|
517
|
-
|
|
518
|
-
|
|
507
|
+
@HasOne(() => passport, {
|
|
508
|
+
sourceKey: "passport_id"
|
|
509
|
+
})
|
|
510
|
+
passport?: passport;
|
|
519
511
|
|
|
520
512
|
}
|
|
521
513
|
```
|
|
522
514
|
|
|
523
515
|
```ts
|
|
524
516
|
import {
|
|
525
|
-
|
|
517
|
+
Model, Table, Column, DataType, Index, Sequelize, ForeignKey, BelongsTo
|
|
526
518
|
} from "sequelize-typescript";
|
|
527
519
|
import { person } from "./person";
|
|
528
520
|
|
|
521
|
+
export interface passportAttributes {
|
|
522
|
+
passport_id: number;
|
|
523
|
+
code: string;
|
|
524
|
+
}
|
|
525
|
+
|
|
529
526
|
@Table({
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
comment: ""
|
|
527
|
+
tableName: "passport",
|
|
528
|
+
timestamps: false
|
|
533
529
|
})
|
|
534
|
-
export class passport extends Model {
|
|
530
|
+
export class passport extends Model<passportAttributes, passportAttributes> implements passportAttributes {
|
|
535
531
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
@Index({
|
|
543
|
-
name: "PRIMARY",
|
|
544
|
-
using: "BTREE",
|
|
545
|
-
order: "ASC",
|
|
546
|
-
unique: true
|
|
547
|
-
})
|
|
548
|
-
passport_id!: number;
|
|
532
|
+
@ForeignKey(() => person)
|
|
533
|
+
@Column({
|
|
534
|
+
primaryKey: true,
|
|
535
|
+
type: DataType.INTEGER
|
|
536
|
+
})
|
|
537
|
+
passport_id!: number;
|
|
549
538
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
code!: string;
|
|
539
|
+
@Column({
|
|
540
|
+
type: DataType.STRING(80)
|
|
541
|
+
})
|
|
542
|
+
code!: string;
|
|
555
543
|
|
|
556
|
-
|
|
557
|
-
|
|
544
|
+
@BelongsTo(() => person)
|
|
545
|
+
person?: person;
|
|
558
546
|
|
|
559
547
|
}
|
|
560
548
|
```
|
|
@@ -606,83 +594,77 @@ This will generate the following models:
|
|
|
606
594
|
|
|
607
595
|
```ts
|
|
608
596
|
import {
|
|
609
|
-
|
|
597
|
+
Model, Table, Column, DataType, Index, Sequelize, ForeignKey, HasMany
|
|
610
598
|
} from "sequelize-typescript";
|
|
611
599
|
import { units } from "./units";
|
|
612
600
|
|
|
601
|
+
export interface racesAttributes {
|
|
602
|
+
race_id: number;
|
|
603
|
+
race_name: string;
|
|
604
|
+
}
|
|
605
|
+
|
|
613
606
|
@Table({
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
comment: ""
|
|
607
|
+
tableName: "races",
|
|
608
|
+
timestamps: false
|
|
617
609
|
})
|
|
618
|
-
export class races extends Model {
|
|
610
|
+
export class races extends Model<racesAttributes, racesAttributes> implements racesAttributes {
|
|
619
611
|
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
@Index({
|
|
626
|
-
name: "PRIMARY",
|
|
627
|
-
using: "BTREE",
|
|
628
|
-
order: "ASC",
|
|
629
|
-
unique: true
|
|
630
|
-
})
|
|
631
|
-
race_id!: number;
|
|
612
|
+
@Column({
|
|
613
|
+
primaryKey: true,
|
|
614
|
+
type: DataType.INTEGER
|
|
615
|
+
})
|
|
616
|
+
race_id!: number;
|
|
632
617
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
race_name!: string;
|
|
618
|
+
@Column({
|
|
619
|
+
type: DataType.STRING(80)
|
|
620
|
+
})
|
|
621
|
+
race_name!: string;
|
|
638
622
|
|
|
639
|
-
|
|
640
|
-
|
|
623
|
+
@HasMany(() => units, {
|
|
624
|
+
sourceKey: "race_id"
|
|
625
|
+
})
|
|
626
|
+
units?: units[];
|
|
641
627
|
|
|
642
628
|
}
|
|
643
629
|
```
|
|
644
630
|
|
|
645
631
|
```ts
|
|
646
632
|
import {
|
|
647
|
-
|
|
633
|
+
Model, Table, Column, DataType, Index, Sequelize, ForeignKey, BelongsTo
|
|
648
634
|
} from "sequelize-typescript";
|
|
649
635
|
import { races } from "./races";
|
|
650
636
|
|
|
637
|
+
export interface unitsAttributes {
|
|
638
|
+
unit_id: number;
|
|
639
|
+
unit_name: string;
|
|
640
|
+
race_id: number;
|
|
641
|
+
}
|
|
642
|
+
|
|
651
643
|
@Table({
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
comment: ""
|
|
644
|
+
tableName: "units",
|
|
645
|
+
timestamps: false
|
|
655
646
|
})
|
|
656
|
-
export class units extends Model {
|
|
647
|
+
export class units extends Model<unitsAttributes, unitsAttributes> implements unitsAttributes {
|
|
657
648
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
@Index({
|
|
664
|
-
name: "PRIMARY",
|
|
665
|
-
using: "BTREE",
|
|
666
|
-
order: "ASC",
|
|
667
|
-
unique: true
|
|
668
|
-
})
|
|
669
|
-
unit_id!: number;
|
|
649
|
+
@Column({
|
|
650
|
+
primaryKey: true,
|
|
651
|
+
type: DataType.INTEGER
|
|
652
|
+
})
|
|
653
|
+
unit_id!: number;
|
|
670
654
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
unit_name!: string;
|
|
655
|
+
@Column({
|
|
656
|
+
type: DataType.STRING(80)
|
|
657
|
+
})
|
|
658
|
+
unit_name!: string;
|
|
676
659
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
race_id!: number;
|
|
660
|
+
@ForeignKey(() => races)
|
|
661
|
+
@Column({
|
|
662
|
+
type: DataType.INTEGER
|
|
663
|
+
})
|
|
664
|
+
race_id!: number;
|
|
683
665
|
|
|
684
|
-
|
|
685
|
-
|
|
666
|
+
@BelongsTo(() => races)
|
|
667
|
+
race?: races;
|
|
686
668
|
|
|
687
669
|
}
|
|
688
670
|
```
|
|
@@ -741,123 +723,105 @@ This will generate the following models:
|
|
|
741
723
|
|
|
742
724
|
```ts
|
|
743
725
|
import {
|
|
744
|
-
|
|
726
|
+
Model, Table, Column, DataType, Index, Sequelize, ForeignKey, BelongsToMany
|
|
745
727
|
} from "sequelize-typescript";
|
|
746
728
|
import { books } from "./books";
|
|
747
729
|
import { authors_books } from "./authors_books";
|
|
748
730
|
|
|
731
|
+
export interface authorsAttributes {
|
|
732
|
+
author_id: number;
|
|
733
|
+
full_name: string;
|
|
734
|
+
}
|
|
735
|
+
|
|
749
736
|
@Table({
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
comment: ""
|
|
737
|
+
tableName: "authors",
|
|
738
|
+
timestamps: false
|
|
753
739
|
})
|
|
754
|
-
export class authors extends Model {
|
|
740
|
+
export class authors extends Model<authorsAttributes, authorsAttributes> implements authorsAttributes {
|
|
755
741
|
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
@Index({
|
|
762
|
-
name: "PRIMARY",
|
|
763
|
-
using: "BTREE",
|
|
764
|
-
order: "ASC",
|
|
765
|
-
unique: true
|
|
766
|
-
})
|
|
767
|
-
author_id!: number;
|
|
742
|
+
@Column({
|
|
743
|
+
primaryKey: true,
|
|
744
|
+
type: DataType.INTEGER
|
|
745
|
+
})
|
|
746
|
+
author_id!: number;
|
|
768
747
|
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
full_name!: string;
|
|
748
|
+
@Column({
|
|
749
|
+
type: DataType.STRING(80)
|
|
750
|
+
})
|
|
751
|
+
full_name!: string;
|
|
774
752
|
|
|
775
|
-
|
|
776
|
-
|
|
753
|
+
@BelongsToMany(() => books, () => authors_books)
|
|
754
|
+
books?: books[];
|
|
777
755
|
|
|
778
756
|
}
|
|
779
757
|
```
|
|
780
758
|
|
|
781
759
|
```ts
|
|
782
760
|
import {
|
|
783
|
-
|
|
761
|
+
Model, Table, Column, DataType, Index, Sequelize, ForeignKey, BelongsToMany
|
|
784
762
|
} from "sequelize-typescript";
|
|
785
763
|
import { authors } from "./authors";
|
|
786
764
|
import { authors_books } from "./authors_books";
|
|
787
765
|
|
|
766
|
+
export interface booksAttributes {
|
|
767
|
+
book_id: number;
|
|
768
|
+
title: string;
|
|
769
|
+
}
|
|
770
|
+
|
|
788
771
|
@Table({
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
comment: ""
|
|
772
|
+
tableName: "books",
|
|
773
|
+
timestamps: false
|
|
792
774
|
})
|
|
793
|
-
export class books extends Model {
|
|
775
|
+
export class books extends Model<booksAttributes, booksAttributes> implements booksAttributes {
|
|
794
776
|
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
@Index({
|
|
801
|
-
name: "PRIMARY",
|
|
802
|
-
using: "BTREE",
|
|
803
|
-
order: "ASC",
|
|
804
|
-
unique: true
|
|
805
|
-
})
|
|
806
|
-
book_id!: number;
|
|
777
|
+
@Column({
|
|
778
|
+
primaryKey: true,
|
|
779
|
+
type: DataType.INTEGER
|
|
780
|
+
})
|
|
781
|
+
book_id!: number;
|
|
807
782
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
title!: string;
|
|
783
|
+
@Column({
|
|
784
|
+
type: DataType.STRING(80)
|
|
785
|
+
})
|
|
786
|
+
title!: string;
|
|
813
787
|
|
|
814
|
-
|
|
815
|
-
|
|
788
|
+
@BelongsToMany(() => authors, () => authors_books)
|
|
789
|
+
authors?: authors[];
|
|
816
790
|
|
|
817
791
|
}
|
|
818
792
|
```
|
|
819
793
|
|
|
820
794
|
```ts
|
|
821
795
|
import {
|
|
822
|
-
|
|
796
|
+
Model, Table, Column, DataType, Index, Sequelize, ForeignKey
|
|
823
797
|
} from "sequelize-typescript";
|
|
824
798
|
import { authors } from "./authors";
|
|
825
799
|
import { books } from "./books";
|
|
826
800
|
|
|
801
|
+
export interface authors_booksAttributes {
|
|
802
|
+
author_id: number;
|
|
803
|
+
book_id: number;
|
|
804
|
+
}
|
|
805
|
+
|
|
827
806
|
@Table({
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
comment: ""
|
|
807
|
+
tableName: "authors_books",
|
|
808
|
+
timestamps: false
|
|
831
809
|
})
|
|
832
|
-
export class authors_books extends Model {
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
@ForeignKey(() => books)
|
|
849
|
-
@Column({
|
|
850
|
-
field: "book_id",
|
|
851
|
-
primaryKey: true,
|
|
852
|
-
type: DataType.INTEGER
|
|
853
|
-
})
|
|
854
|
-
@Index({
|
|
855
|
-
name: "PRIMARY",
|
|
856
|
-
using: "BTREE",
|
|
857
|
-
order: "ASC",
|
|
858
|
-
unique: true
|
|
859
|
-
})
|
|
860
|
-
book_id!: number;
|
|
810
|
+
export class authors_books extends Model<authors_booksAttributes, authors_booksAttributes> implements authors_booksAttributes {
|
|
811
|
+
|
|
812
|
+
@ForeignKey(() => authors)
|
|
813
|
+
@Column({
|
|
814
|
+
primaryKey: true,
|
|
815
|
+
type: DataType.INTEGER
|
|
816
|
+
})
|
|
817
|
+
author_id!: number;
|
|
818
|
+
|
|
819
|
+
@ForeignKey(() => books)
|
|
820
|
+
@Column({
|
|
821
|
+
primaryKey: true,
|
|
822
|
+
type: DataType.INTEGER
|
|
823
|
+
})
|
|
824
|
+
book_id!: number;
|
|
861
825
|
|
|
862
826
|
}
|
|
863
827
|
```
|
|
@@ -34,6 +34,7 @@ const jsDataTypesMap = {
|
|
|
34
34
|
varbinary: 'Uint8Array',
|
|
35
35
|
uniqueidentifier: 'string',
|
|
36
36
|
xml: 'string',
|
|
37
|
+
geography: 'object',
|
|
37
38
|
};
|
|
38
39
|
const sequelizeDataTypesMap = {
|
|
39
40
|
int: sequelize_typescript_1.DataType.INTEGER,
|
|
@@ -64,6 +65,7 @@ const sequelizeDataTypesMap = {
|
|
|
64
65
|
varbinary: sequelize_typescript_1.DataType.STRING,
|
|
65
66
|
uniqueidentifier: sequelize_typescript_1.DataType.STRING,
|
|
66
67
|
xml: sequelize_typescript_1.DataType.STRING,
|
|
68
|
+
geography: sequelize_typescript_1.DataType.GEOGRAPHY,
|
|
67
69
|
};
|
|
68
70
|
/**
|
|
69
71
|
* Dialect for Postgres
|
|
@@ -31,6 +31,7 @@ const sequelizeDataTypesMap = {
|
|
|
31
31
|
path: sequelize_typescript_1.DataType.GEOMETRY,
|
|
32
32
|
polygon: sequelize_typescript_1.DataType.GEOMETRY,
|
|
33
33
|
circle: sequelize_typescript_1.DataType.GEOMETRY,
|
|
34
|
+
geometry: sequelize_typescript_1.DataType.GEOMETRY,
|
|
34
35
|
cidr: sequelize_typescript_1.DataType.STRING,
|
|
35
36
|
inet: sequelize_typescript_1.DataType.STRING,
|
|
36
37
|
macaddr: sequelize_typescript_1.DataType.STRING,
|
|
@@ -69,6 +70,7 @@ const jsDataTypesMap = {
|
|
|
69
70
|
path: 'object',
|
|
70
71
|
polygon: 'object',
|
|
71
72
|
circle: 'object',
|
|
73
|
+
geometry: 'object',
|
|
72
74
|
cidr: 'string',
|
|
73
75
|
inet: 'string',
|
|
74
76
|
macaddr: 'string',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sequelize-typescript-generator",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.2",
|
|
4
4
|
"description": "Automatically generates typescript models compatible with sequelize-typescript library (https://www.npmjs.com/package/sequelize-typescript) directly from your source database.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -34,34 +34,34 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/spinlud/sequelize-typescript-generator.git#readme",
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/bluebird": "^3.5.
|
|
38
|
-
"@types/estree": "^1.0.
|
|
39
|
-
"@types/jest": "^29.5.
|
|
40
|
-
"@types/node": "^
|
|
41
|
-
"@types/pluralize": "0.0.
|
|
42
|
-
"@types/validator": "^13.
|
|
43
|
-
"@types/yargs": "^17.0.
|
|
44
|
-
"jest": "^29.
|
|
45
|
-
"mariadb": "^3.2.
|
|
46
|
-
"mysql2": "^3.
|
|
47
|
-
"pg": "^8.11.
|
|
37
|
+
"@types/bluebird": "^3.5.40",
|
|
38
|
+
"@types/estree": "^1.0.2",
|
|
39
|
+
"@types/jest": "^29.5.5",
|
|
40
|
+
"@types/node": "^20.8.6",
|
|
41
|
+
"@types/pluralize": "0.0.31",
|
|
42
|
+
"@types/validator": "^13.11.3",
|
|
43
|
+
"@types/yargs": "^17.0.28",
|
|
44
|
+
"jest": "^29.7.0",
|
|
45
|
+
"mariadb": "^3.2.1",
|
|
46
|
+
"mysql2": "^3.6.2",
|
|
47
|
+
"pg": "^8.11.3",
|
|
48
48
|
"pg-hstore": "^2.3.4",
|
|
49
49
|
"reflect-metadata": "^0.1.13",
|
|
50
50
|
"sqlite3": "^5.1.6",
|
|
51
|
-
"tedious": "^
|
|
52
|
-
"ts-jest": "^29.1.
|
|
51
|
+
"tedious": "^16.4.1",
|
|
52
|
+
"ts-jest": "^29.1.1",
|
|
53
53
|
"ts-node-dev": "^2.0.0",
|
|
54
54
|
"wkx": "^0.5.0"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@types/eslint": "^8.
|
|
58
|
-
"@typescript-eslint/parser": "^
|
|
57
|
+
"@types/eslint": "^8.44.4",
|
|
58
|
+
"@typescript-eslint/parser": "^6.7.5",
|
|
59
59
|
"change-case": "^4.1.2",
|
|
60
|
-
"eslint": "^8.
|
|
60
|
+
"eslint": "^8.51.0",
|
|
61
61
|
"pluralize": "^8.0.0",
|
|
62
|
-
"sequelize": "^6.
|
|
62
|
+
"sequelize": "^6.33.0",
|
|
63
63
|
"sequelize-typescript": "^2.1.5",
|
|
64
|
-
"typescript": "^5.
|
|
64
|
+
"typescript": "^5.2.2",
|
|
65
65
|
"yargs": "^17.7.2"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
package/tsconfig.json
CHANGED
|
@@ -1,72 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
15
|
-
"outDir": "./build", /* Redirect output structure to the directory. */
|
|
16
|
-
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
17
|
-
// "composite": true, /* Enable project compilation */
|
|
18
|
-
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
19
|
-
// "removeComments": true, /* Do not emit comments to output. */
|
|
20
|
-
// "noEmit": true, /* Do not emit outputs. */
|
|
21
|
-
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
22
|
-
"downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
23
|
-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
24
|
-
|
|
25
|
-
/* Strict Type-Checking Options */
|
|
26
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
27
|
-
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
28
|
-
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
29
|
-
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
30
|
-
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
31
|
-
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
32
|
-
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
33
|
-
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
34
|
-
|
|
35
|
-
/* Additional Checks */
|
|
36
|
-
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
37
|
-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
38
|
-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
39
|
-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
40
|
-
|
|
41
|
-
/* Module Resolution Options */
|
|
42
|
-
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
43
|
-
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
44
|
-
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
45
|
-
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
46
|
-
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
47
|
-
// "types": [], /* Type declaration files to be included in compilation. */
|
|
48
|
-
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
49
|
-
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
50
|
-
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
51
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
52
|
-
|
|
53
|
-
/* Source Map Options */
|
|
54
|
-
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
55
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
56
|
-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
57
|
-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
58
|
-
|
|
59
|
-
/* Experimental Options */
|
|
60
|
-
"experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
61
|
-
"emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
62
|
-
|
|
63
|
-
/* Advanced Options */
|
|
64
|
-
"forceConsistentCasingInFileNames": false, /* Disallow inconsistently-cased references to the same file. */
|
|
3
|
+
"target": "ES2019",
|
|
4
|
+
"module": "CommonJS",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"outDir": "./build",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"downlevelIteration": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"emitDecoratorMetadata": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": false
|
|
65
14
|
},
|
|
66
15
|
"exclude": [
|
|
67
16
|
"src/tests",
|
|
68
17
|
"**/output-models",
|
|
69
18
|
"**/prova.ts",
|
|
70
|
-
"**/tmp"
|
|
19
|
+
"**/tmp"
|
|
71
20
|
]
|
|
72
21
|
}
|