Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rewrite Data Types #14505

Merged
merged 159 commits into from Nov 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
210279c
refactor(data-types): convert data-types to TS
wbourne0 Mar 12, 2022
bf78103
Merge branch 'main' into typeify-data-types
fzn0x Mar 23, 2022
9909763
refactor: simplify data types
ephys Apr 28, 2022
b4d8dc1
Merge branch 'main' into ephys/ts-data-types
ephys May 1, 2022
7161290
refactor: update postgres datatypes
ephys May 1, 2022
e42607a
refactor: continue refactor
ephys May 2, 2022
2d43568
Merge branch 'main' into ephys/ts-data-types
ephys May 13, 2022
cb808ae
refactor: continue migration
ephys May 13, 2022
45c6e4d
test: fix typing tests
ephys May 13, 2022
ccea307
refactor: continue refactor
ephys May 14, 2022
896936b
Merge branch 'main' into ephys/ts-data-types
ephys May 14, 2022
315bccb
refactor: finish postgres refactor
ephys May 14, 2022
a2f4e35
refactor: fix broken import in tests
ephys May 14, 2022
0c0434e
test: test DataType input/output values
ephys May 15, 2022
808fdf4
refactor: continue work
ephys May 15, 2022
a8e1e87
Merge branch 'main' into ephys/ts-data-types
ephys May 20, 2022
aaff10d
test: update tests
ephys May 20, 2022
dc98104
fix: fix postgres unit tests
ephys May 20, 2022
c279c86
Merge branch 'main' into ephys/ts-data-types
ephys Jun 19, 2022
875829c
fix: throw if CHAR.BINARY is not supported
ephys Jun 19, 2022
18e9ffb
feat: make `typeValidation` -> `noTypeValidation`
ephys Jun 19, 2022
f221224
refactor: isolate utils that import many files
ephys Jun 19, 2022
b57bc27
fix: align with tests
ephys Jun 19, 2022
e752ac5
test: fix tests
ephys Jun 19, 2022
51f3f49
build: disable decorators
ephys Jun 19, 2022
39ab280
test: update tests
ephys Jun 21, 2022
56828b2
fix: fix multiple bugs (see details)
ephys Jun 21, 2022
85ff06c
Merge branch 'main' into ephys/ts-data-types
ephys Sep 18, 2022
2d11388
fix: update types
ephys Sep 18, 2022
cc27be5
fix: fix imports
ephys Sep 18, 2022
75276e8
test: fix tests
ephys Sep 18, 2022
b421885
test: fix typings
ephys Sep 18, 2022
6a0e4f2
feat: migrate mysql datatypes
ephys Sep 18, 2022
904fa40
fix: restore datatype tostring
ephys Sep 18, 2022
aa893e7
fix: update virtual datatype
ephys Sep 18, 2022
dad2e02
test: update test
ephys Sep 18, 2022
5fe1f3e
feat: type mysql & postgres
ephys Sep 18, 2022
4552fc5
test: fix tests
ephys Sep 18, 2022
f2ca3d0
fix: update default GEOGRAPHY toSql
ephys Sep 18, 2022
81fef02
fix: fix virtual datatype, update QueryGenerator constructors
ephys Sep 18, 2022
9f65be0
feat: continue mysql implem
ephys Sep 18, 2022
2b1ccb5
continue implementation
ephys Sep 19, 2022
cd82be8
fix failing tests
ephys Sep 19, 2022
8121669
continue implem
ephys Sep 19, 2022
ee8d05d
fix: support range array, string datatypes
ephys Sep 20, 2022
9f465d4
Make Model.validate() run validate on all datatypes
ephys Sep 20, 2022
55afbf1
fix: fix failing tests
ephys Sep 20, 2022
a394e88
throw when int type is used in unsupported dialect
ephys Sep 20, 2022
92a90ea
Merge branch 'main' into ephys/ts-data-types
ephys Sep 20, 2022
ef71cab
test: add raw query tests
ephys Sep 20, 2022
8371702
feat: implement mysql datatypes
ephys Sep 21, 2022
94e64eb
test: update failing test
ephys Sep 21, 2022
5a9f25c
feat: mysql implem & pg tweaks
ephys Sep 22, 2022
dd9729b
accept buffers in boolean datatype for now
ephys Sep 22, 2022
c12fc29
feat: sanitise geometry types
ephys Sep 23, 2022
452e412
feat: normalize float, double, deprecate real
ephys Sep 23, 2022
885aea5
fix: fix numeric type validation
ephys Sep 23, 2022
7dfcaeb
fix: re-add support for length in int datatypes
ephys Sep 23, 2022
656ead5
fix: make dialect available earlier, support length in int
ephys Sep 23, 2022
9aaa94d
fix: remove unsupported length option in pg
ephys Sep 23, 2022
7605305
test: add unsigned tests
ephys Sep 24, 2022
f5c80af
feat: migrate mssql
ephys Sep 24, 2022
f059d82
Merge branch 'main' into ephys/ts-data-types
ephys Sep 24, 2022
26b1563
Merge branch 'main' into ephys/ts-data-types
ephys Sep 24, 2022
0dd59db
fix: move I?REGEXP out of dataTypes support table
ephys Sep 24, 2022
a309751
feat: update mssql types
ephys Sep 24, 2022
f973903
test: update mssql tests
ephys Sep 24, 2022
5042d4c
test: update logQuery test
ephys Sep 24, 2022
c5f1cfa
fix: fix failing mssql tests
ephys Sep 24, 2022
7f04e40
test: update tests
ephys Sep 24, 2022
857b2ee
fix: properly escape json
ephys Sep 24, 2022
251e4bb
refactor: remove debug
ephys Sep 25, 2022
f694fb7
feat: add support for datatype#parseDatabaseValue, move type based pa…
ephys Sep 25, 2022
6f5a9f2
feat: add support for JSON in mssql
ephys Sep 25, 2022
3cbd8a7
test: fix tests
ephys Sep 25, 2022
60d608f
fix: allow creating an index on mssql enum type
ephys Sep 25, 2022
4f4f232
fix: run _parseDataArrayByType on insert query
ephys Sep 25, 2022
094d2f8
test: fix tests
ephys Sep 25, 2022
48863c8
fix: properly parse inserted columns\
ephys Sep 25, 2022
50a2c75
fix: make default updatedAt/createdAt attr use millisecond precision
ephys Sep 25, 2022
05ffdd6
test: fix tests
ephys Sep 25, 2022
d64d1b9
feat: move datatype warn logic inside of dialect
ephys Sep 25, 2022
e9d0804
feat: initial sqlite migration
ephys Sep 25, 2022
2366429
fix: fix sqlite tests
ephys Sep 26, 2022
ab43d43
test: fix last sqlite int test
ephys Sep 26, 2022
ab5c77b
Merge branch 'main' into ephys/ts-data-types
ephys Sep 27, 2022
3114af3
docs: document fallback policy
ephys Sep 27, 2022
c3c3fc7
feat: implement datatype fallbacks
ephys Sep 27, 2022
7764afd
feat: update support tables
ephys Sep 27, 2022
35c8b59
fix: fix tests
ephys Sep 28, 2022
47a50aa
test: update test suites
ephys Sep 29, 2022
f08a579
feat: make sqlite use stricter types
ephys Sep 29, 2022
e7af7fb
feat: migrate mariadb
ephys Sep 29, 2022
56036ab
refactor: apply review changes
ephys Sep 29, 2022
5ca404b
refactor: move GeoJson export
ephys Sep 29, 2022
9d2a73a
feat: implement review changes
ephys Sep 29, 2022
a86d0c7
feat: make STRING.BINARY a collation modifier
ephys Sep 30, 2022
f87ed27
fix: fix mariadb issues
ephys Sep 30, 2022
a771bdb
fix: remove default value from TIME & DATE
ephys Sep 30, 2022
f842829
Merge branch 'main' into ephys/ts-data-types
ephys Sep 30, 2022
70431dd
test: fix pg tests
ephys Sep 30, 2022
12426a0
test: add datatype method tests
ephys Sep 30, 2022
c086783
feat: reduce cloning of dialect data types
ephys Sep 30, 2022
75bbade
refactor: rename DataTypes#bindParam -> DataTypes#getBindParamSql
ephys Sep 30, 2022
ef34dc7
refactor: remove unused import
ephys Sep 30, 2022
76af397
Merge branch 'main' into ephys/ts-data-types
ephys Oct 1, 2022
aa85447
Merge branch 'main' into ephys/ts-data-types
ephys Oct 1, 2022
54ed15e
fix: update _dialect name -> dialect
ephys Oct 1, 2022
25c824c
feat: migrate db2
ephys Oct 1, 2022
dc0ab2b
feat: migrate db2 connection manager
ephys Oct 1, 2022
a3e3bd5
feat: migrate db2 query
ephys Oct 1, 2022
81639e8
fix: fix DB2 SQL injection
ephys Oct 1, 2022
a7cebdf
refactor: remove escape option from StringifyOptions
ephys Oct 1, 2022
a10356f
test: fix db2 tests
ephys Oct 1, 2022
3cf173d
refactor: centralize datatypes unit tests
ephys Oct 1, 2022
f1110c6
fix: fix postgres bugs
ephys Oct 1, 2022
2270615
Merge branch 'main' into ephys/ts-data-types
ephys Oct 1, 2022
e3177fa
fix: fix ibmi failed tests
ephys Oct 1, 2022
6f85497
feat: migrate snowflake
ephys Oct 1, 2022
3c3369a
fix: use BaseError to polyfill error cause
ephys Oct 1, 2022
3ce94f9
fix: finish snowflake
ephys Oct 1, 2022
2ce8bcb
fix: fix typings
ephys Oct 1, 2022
425c7a8
fix: dumb down cause error param
ephys Oct 1, 2022
85cce13
Merge branch 'main' into ephys/ts-data-types
ephys Oct 1, 2022
8d81403
fix: use 6 decimals of precision on timestamp attrs
ephys Oct 1, 2022
8a6c404
test: fix mysql tests
ephys Oct 1, 2022
50816cd
feat(pg): parse RETURNING values
ephys Oct 1, 2022
8d2498f
test: fix mysql tests
ephys Oct 1, 2022
960656f
fix: return MariaDB DECIMAL as strings
ephys Oct 1, 2022
67ad146
test: fix mariadb tests
ephys Oct 1, 2022
21704b7
fix: fix crash when association name collides with built-in names
ephys Oct 1, 2022
fb8b85c
fix: fix postgres query crash
ephys Oct 1, 2022
1064035
fix: fix mysql/mariadb SHOW INDEX
ephys Oct 1, 2022
f4fe5ce
fix: workaround pg bug with findOrCreate
ephys Oct 1, 2022
de6bcbf
fix: support SHOW INDEX in mysql 5
ephys Oct 2, 2022
4643657
meta: use mysql 5.7.4 in local docker
ephys Oct 2, 2022
ccee024
test: fix mssql tests
ephys Oct 2, 2022
633b4c5
test: fix mariadb JSON test
ephys Oct 2, 2022
00aa4d9
meta: use mariadb 10.3.34 in dev to align with CI
ephys Oct 2, 2022
9580cc4
test(db2): add missing SYSTOOLSPACE schema
ephys Oct 2, 2022
216ec19
Merge branch 'main' into ephys/ts-data-types
ephys Oct 2, 2022
f597d0d
test: update db2 tests
ephys Oct 2, 2022
391b8fd
refactor: deduplicate db2 query logging
ephys Oct 2, 2022
0b3d891
fix: fix db2 data types
ephys Oct 2, 2022
3e2f638
test: add integration test for scientific notation float strings
ephys Oct 2, 2022
cc2755c
feat: tweak enum error messages
ephys Oct 2, 2022
70ba58d
test: fix db2 tests
ephys Oct 2, 2022
ffbd7d6
test: fix scientific notation test
ephys Oct 2, 2022
123fcad
Merge branch 'main' into ephys/ts-data-types
ephys Oct 15, 2022
ed5ef48
Merge branch 'main' into ephys/ts-data-types
ephys Oct 15, 2022
4395bed
Merge branch 'main' into ephys/ts-data-types
ephys Nov 6, 2022
51f8b38
fix: apply review comments
ephys Nov 6, 2022
72a7375
build: update yarn.lock
ephys Nov 6, 2022
a71035e
feat: forbid setting the timezone option on unsupported dialects
ephys Nov 6, 2022
19b7b78
Merge branch 'main' into ephys/ts-data-types
ephys Nov 6, 2022
77e70f1
fix: parse DateOnly input as UTC
ephys Nov 6, 2022
2a9efd2
docs: improve range comment
ephys Nov 6, 2022
0f62d00
refactor: dedupe float option logic
ephys Nov 6, 2022
5c388f2
test: disable timezone test on unsupported dialects
ephys Nov 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev/mariadb/oldest/docker-compose.yml
@@ -1,7 +1,7 @@
services:
mariadb-oldest:
container_name: sequelize-mariadb-oldest
image: mariadb:10.3.0
image: mariadb:10.3.34
environment:
MYSQL_DATABASE: sequelize_test
MYSQL_USER: sequelize_test
Expand Down
2 changes: 1 addition & 1 deletion dev/mysql/oldest/docker-compose.yml
@@ -1,7 +1,7 @@
services:
mysql-oldest:
container_name: sequelize-mysql-oldest
image: mysql:5.7.0
image: mysql:5.7.4
environment:
MYSQL_DATABASE: sequelize_test
MYSQL_USER: sequelize_test
Expand Down
5 changes: 5 additions & 0 deletions package.json
Expand Up @@ -65,12 +65,16 @@
"@types/chai": "4.3.3",
"@types/chai-as-promised": "7.1.5",
"@types/chai-datetime": "0.0.37",
"@types/ibm_db": "2.0.11",
"@types/lodash": "4.14.188",
"@types/mocha": "10.0.0",
"@types/node": "18.11.9",
"@types/pg": "8.6.5",
"@types/semver": "7.3.13",
"@types/sinon": "10.0.13",
"@types/sinon-chai": "3.2.8",
"@types/snowflake-sdk": "1.6.8",
"@types/tedious": "4.0.9",
"@types/uuid": "8.3.4",
"chai": "4.3.6",
"chai-as-promised": "7.1.1",
Expand All @@ -94,6 +98,7 @@
"mariadb": "2.5.6",
"markdownlint-cli": "0.32.2",
"mocha": "10.1.0",
"moment": "2.29.4",
"mysql2": "2.3.3",
"node-hook": "1.0.0",
"nyc": "15.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/associations/belongs-to-many.ts
Expand Up @@ -262,7 +262,7 @@ export class BelongsToMany<

Do this:
A.belongsToMany(B, { as: 'b', through: 'AB', inverse: { as: 'a' } });
`, { cause: error as Error });
`, { cause: error });
}

// we'll need to access their foreign key (through .otherKey) in this constructor.
Expand Down
3 changes: 2 additions & 1 deletion src/associations/belongs-to.ts
@@ -1,6 +1,7 @@
import assert from 'assert';
import isObject from 'lodash/isObject.js';
import upperFirst from 'lodash/upperFirst';
import { cloneDataType } from '../dialects/abstract/data-types-utils.js';
import { AssociationError } from '../errors/index.js';
import type {
ModelStatic,
Expand Down Expand Up @@ -137,7 +138,7 @@ export class BelongsTo<
this.foreignKey = foreignKey as SourceKey;

const newForeignKeyAttribute = removeUndefined({
type: this.target.rawAttributes[this.targetKey].type,
type: cloneDataType(this.target.rawAttributes[this.targetKey].type),
...foreignKeyAttributeOptions,
allowNull: this.source.rawAttributes[this.foreignKey]?.allowNull ?? foreignKeyAttributeOptions?.allowNull,
});
Expand Down