mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
fixing falling tests;
This commit is contained in:
parent
d6edc142fd
commit
17f3224c58
@ -344,7 +344,7 @@ export class Gulpfile {
|
||||
.pipe(mocha({
|
||||
bail: true,
|
||||
grep: !!args.grep ? new RegExp(args.grep) : undefined,
|
||||
timeout: 25000
|
||||
timeout: 30000
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
289
package-lock.json
generated
289
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "typeorm",
|
||||
"version": "0.1.12",
|
||||
"version": "0.2.0-alpha.18",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -50,7 +50,7 @@
|
||||
"@types/chai-as-promised": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/chai-as-promised/-/chai-as-promised-7.1.0.tgz",
|
||||
"integrity": "sha512-MFiW54UOSt+f2bRw8J7LgQeIvE/9b4oGvwU7XW30S9QGAiHGnU/fmiOprsyMkdmH2rl8xSPc0/yrQw8juXU6bQ==",
|
||||
"integrity": "sha1-AQsEzeeOrPtucr/ds+WP4jwueLk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/chai": "4.0.4"
|
||||
@ -65,7 +65,7 @@
|
||||
"@types/glob": {
|
||||
"version": "5.0.33",
|
||||
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-5.0.33.tgz",
|
||||
"integrity": "sha512-BcD4yyWz+qmCggaYMSFF0Xn7GkO6tgwm3Fh9Gxk/kQmEU3Z7flQTnVlMyKBUNvXXNTCCyjqK4XT4/2hLd1gQ2A==",
|
||||
"integrity": "sha1-Pf98bOCdZavpGceWHcPe4Bbzatc=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/minimatch": "3.0.1",
|
||||
@ -75,7 +75,7 @@
|
||||
"@types/minimatch": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.1.tgz",
|
||||
"integrity": "sha512-rUO/jz10KRSyA9SHoCWQ8WX9BICyj5jZYu1/ucKEJKb4KzLZCKMURdYbadP157Q6Zl1x0vHsrU+Z/O0XlhYQDw==",
|
||||
"integrity": "sha1-toPrYL41gwTvFG9XddtMDjaWpVA=",
|
||||
"dev": true
|
||||
},
|
||||
"@types/mocha": {
|
||||
@ -87,13 +87,12 @@
|
||||
"@types/node": {
|
||||
"version": "8.0.41",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.41.tgz",
|
||||
"integrity": "sha512-6XPVDfoTQE5O6FRCbSgFg0YEobbsqUuu6Wxnp7g3kydKTTQep/Mo3rT9CCS1igzQeAb1GLB7r3+xTgcHv+4KSQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-6XPVDfoTQE5O6FRCbSgFg0YEobbsqUuu6Wxnp7g3kydKTTQep/Mo3rT9CCS1igzQeAb1GLB7r3+xTgcHv+4KSQ=="
|
||||
},
|
||||
"@types/rimraf": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/rimraf/-/rimraf-2.0.2.tgz",
|
||||
"integrity": "sha512-Hm/bnWq0TCy7jmjeN5bKYij9vw5GrDFWME4IuxV08278NtU/VdGbzsBohcCUJ7+QMqmUq5hpRKB39HeQWJjztQ==",
|
||||
"integrity": "sha1-fw/Dzw/wrSqZu3I64XZPMKyvi24=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/glob": "5.0.33",
|
||||
@ -143,7 +142,7 @@
|
||||
"ansi-styles": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
|
||||
"integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
|
||||
"integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=",
|
||||
"requires": {
|
||||
"color-convert": "1.9.0"
|
||||
}
|
||||
@ -190,7 +189,7 @@
|
||||
"arr-flatten": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
|
||||
"integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
|
||||
"integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=",
|
||||
"dev": true
|
||||
},
|
||||
"array-differ": {
|
||||
@ -330,7 +329,7 @@
|
||||
"bignumber.js": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-4.0.4.tgz",
|
||||
"integrity": "sha512-LDXpJKVzEx2/OqNbG9mXBNvHuiRL4PzHCGfnANHMJ+fv68Ads3exDVJeGDJws+AoNEuca93bU3q+S0woeUaCdg==",
|
||||
"integrity": "sha1-fED1q80tZiOre5loLufbgbEYiaQ=",
|
||||
"dev": true
|
||||
},
|
||||
"binaryextensions": {
|
||||
@ -357,7 +356,7 @@
|
||||
"readable-stream": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
|
||||
"integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
|
||||
"integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"core-util-is": "1.0.2",
|
||||
@ -372,7 +371,7 @@
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
@ -429,11 +428,6 @@
|
||||
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
|
||||
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8="
|
||||
},
|
||||
"camelcase": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
|
||||
"integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo="
|
||||
},
|
||||
"camelcase-keys": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz",
|
||||
@ -487,7 +481,7 @@
|
||||
"chai-as-promised": {
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
|
||||
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
|
||||
"integrity": "sha1-CGRdgl3rhpbuYXJdv1kMAS6wDKA=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"check-error": "1.0.2"
|
||||
@ -510,58 +504,117 @@
|
||||
"dev": true
|
||||
},
|
||||
"cli-highlight": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-1.1.4.tgz",
|
||||
"integrity": "sha1-5FWQwU+xjhOGXjiZ6CTFWSzCKSY=",
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-1.2.3.tgz",
|
||||
"integrity": "sha512-cmc4Y2kJuEpT2KZd9pgWWskpDMMfJu2roIcY1Ya/aIItufF5FKsV/NtA6vvdhSUllR8KJfvQDNmIcskU+MKLDg==",
|
||||
"requires": {
|
||||
"chalk": "1.1.3",
|
||||
"he": "1.1.1",
|
||||
"chalk": "2.3.0",
|
||||
"highlight.js": "9.12.0",
|
||||
"mz": "2.6.0",
|
||||
"yargs": "4.8.1"
|
||||
"parse5": "3.0.3",
|
||||
"yargs": "10.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-styles": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
||||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
|
||||
"ansi-regex": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
|
||||
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg="
|
||||
},
|
||||
"camelcase": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
|
||||
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0="
|
||||
},
|
||||
"chalk": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
||||
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
|
||||
"integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
|
||||
"requires": {
|
||||
"ansi-styles": "2.2.1",
|
||||
"ansi-styles": "3.2.0",
|
||||
"escape-string-regexp": "1.0.5",
|
||||
"has-ansi": "2.0.0",
|
||||
"strip-ansi": "3.0.1",
|
||||
"supports-color": "2.0.0"
|
||||
"supports-color": "4.4.0"
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"cliui": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-4.0.0.tgz",
|
||||
"integrity": "sha512-nY3W5Gu2racvdDk//ELReY+dHjb9PlIcVDFXP72nVIhq2Gy3LuVXYwJoPVudwQnv1shtohpgkdCKT2YaKY0CKw==",
|
||||
"requires": {
|
||||
"string-width": "2.1.1",
|
||||
"strip-ansi": "4.0.0",
|
||||
"wrap-ansi": "2.1.0"
|
||||
}
|
||||
},
|
||||
"find-up": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
|
||||
"integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
|
||||
"requires": {
|
||||
"locate-path": "2.0.0"
|
||||
}
|
||||
},
|
||||
"is-fullwidth-code-point": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
|
||||
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc="
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
|
||||
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
|
||||
},
|
||||
"os-locale": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz",
|
||||
"integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==",
|
||||
"requires": {
|
||||
"execa": "0.7.0",
|
||||
"lcid": "1.0.0",
|
||||
"mem": "1.1.0"
|
||||
}
|
||||
},
|
||||
"string-width": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
|
||||
"integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
|
||||
"requires": {
|
||||
"is-fullwidth-code-point": "2.0.0",
|
||||
"strip-ansi": "4.0.0"
|
||||
}
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
|
||||
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
|
||||
"requires": {
|
||||
"ansi-regex": "3.0.0"
|
||||
}
|
||||
},
|
||||
"which-module": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
|
||||
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
|
||||
},
|
||||
"yargs": {
|
||||
"version": "4.8.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz",
|
||||
"integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=",
|
||||
"version": "10.1.2",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-10.1.2.tgz",
|
||||
"integrity": "sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig==",
|
||||
"requires": {
|
||||
"cliui": "3.2.0",
|
||||
"cliui": "4.0.0",
|
||||
"decamelize": "1.2.0",
|
||||
"find-up": "2.1.0",
|
||||
"get-caller-file": "1.0.2",
|
||||
"lodash.assign": "4.2.0",
|
||||
"os-locale": "1.4.0",
|
||||
"read-pkg-up": "1.0.1",
|
||||
"os-locale": "2.1.0",
|
||||
"require-directory": "2.1.1",
|
||||
"require-main-filename": "1.0.1",
|
||||
"set-blocking": "2.0.0",
|
||||
"string-width": "1.0.2",
|
||||
"which-module": "1.0.0",
|
||||
"window-size": "0.2.0",
|
||||
"string-width": "2.1.1",
|
||||
"which-module": "2.0.0",
|
||||
"y18n": "3.2.1",
|
||||
"yargs-parser": "2.4.1"
|
||||
"yargs-parser": "8.1.0"
|
||||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.1.0.tgz",
|
||||
"integrity": "sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==",
|
||||
"requires": {
|
||||
"camelcase": "4.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -805,7 +858,7 @@
|
||||
"denque": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/denque/-/denque-1.2.2.tgz",
|
||||
"integrity": "sha512-x92Ql74lcTbGylXILO9Xf9S0cMpEPP04zVp2bB9e2C7G/n/Q1SgLl78RaSYEPSgpDX9uLgQXCEGAS5BI5dP3yA==",
|
||||
"integrity": "sha1-4Gz3zw2outyIy9qr+PwKcNZZ8dQ=",
|
||||
"dev": true
|
||||
},
|
||||
"deprecated": {
|
||||
@ -885,7 +938,7 @@
|
||||
"readable-stream": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
|
||||
"integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
|
||||
"integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"core-util-is": "1.0.2",
|
||||
@ -900,7 +953,7 @@
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
@ -1014,7 +1067,7 @@
|
||||
"esprima": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",
|
||||
"integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw=="
|
||||
"integrity": "sha1-RJnt3NERDgshi6zy+n9/WfVcqAQ="
|
||||
},
|
||||
"estraverse": {
|
||||
"version": "1.9.3",
|
||||
@ -1180,6 +1233,7 @@
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
|
||||
"integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-exists": "2.1.0",
|
||||
"pinkie-promise": "2.0.1"
|
||||
@ -1308,7 +1362,7 @@
|
||||
"glob": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
|
||||
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
|
||||
"integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=",
|
||||
"requires": {
|
||||
"fs.realpath": "1.0.0",
|
||||
"inflight": "1.0.6",
|
||||
@ -1796,7 +1850,7 @@
|
||||
"gulp-istanbul": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/gulp-istanbul/-/gulp-istanbul-1.1.2.tgz",
|
||||
"integrity": "sha512-53+BDhGlGNHYfeFh/mSXWhNu9wSFmE8qAEFj6ViMiWzTwI9pYxedUxMmGfigwaddsHHQxBl9TgnzUydrX84Kog==",
|
||||
"integrity": "sha1-r2X6KL/bNXbaq5Xc+qcypqJ8Wgc=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"gulp-util": "3.0.8",
|
||||
@ -1917,7 +1971,7 @@
|
||||
"readable-stream": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
|
||||
"integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
|
||||
"integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"core-util-is": "1.0.2",
|
||||
@ -1932,7 +1986,7 @@
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
@ -1972,7 +2026,7 @@
|
||||
"gulp-sourcemaps": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-2.6.1.tgz",
|
||||
"integrity": "sha512-1qHCI3hdmsMdq/SUotxwUh/L8YzlI6J9zQ5ifNOtx4Y6KV5y5sGuORv1KZzWhuKtz/mXNh5xLESUtwC4EndCjA==",
|
||||
"integrity": "sha1-gzpOKPC49GYQdQMs14JBf3zY+ws=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@gulp-sourcemaps/identity-map": "1.0.1",
|
||||
@ -2005,7 +2059,7 @@
|
||||
"gulp-tslint": {
|
||||
"version": "8.1.2",
|
||||
"resolved": "https://registry.npmjs.org/gulp-tslint/-/gulp-tslint-8.1.2.tgz",
|
||||
"integrity": "sha512-0RNGqbp2TKPdbG+sWU3mNMXEMuF/noY1KS4+jd5lOStkvuFINkFL29dHX3IT1u+vVFD4Glwf+lkcdR2QMVNMzA==",
|
||||
"integrity": "sha1-4PQxlLRz1+drtFpY/oxg59/jvrI=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"gulp-util": "3.0.8",
|
||||
@ -2400,7 +2454,8 @@
|
||||
"he": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz",
|
||||
"integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0="
|
||||
"integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=",
|
||||
"dev": true
|
||||
},
|
||||
"highlight.js": {
|
||||
"version": "9.12.0",
|
||||
@ -2419,7 +2474,7 @@
|
||||
"hosted-git-info": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz",
|
||||
"integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg=="
|
||||
"integrity": "sha1-bWDjSzq7yDEwYsO3mO+NkBoHrzw="
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.19",
|
||||
@ -2591,7 +2646,7 @@
|
||||
"is-plain-object": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
|
||||
"integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
|
||||
"integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"isobject": "3.0.1"
|
||||
@ -2649,7 +2704,8 @@
|
||||
"is-utf8": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
|
||||
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI="
|
||||
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
|
||||
"dev": true
|
||||
},
|
||||
"is-valid-glob": {
|
||||
"version": "0.3.0",
|
||||
@ -2883,7 +2939,7 @@
|
||||
"readable-stream": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
|
||||
"integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
|
||||
"integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"core-util-is": "1.0.2",
|
||||
@ -2898,7 +2954,7 @@
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
@ -2945,6 +3001,7 @@
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
|
||||
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "4.1.11",
|
||||
"parse-json": "2.2.0",
|
||||
@ -3110,11 +3167,6 @@
|
||||
"lodash._objecttypes": "2.4.1"
|
||||
}
|
||||
},
|
||||
"lodash.assign": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz",
|
||||
"integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc="
|
||||
},
|
||||
"lodash.create": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz",
|
||||
@ -3336,7 +3388,7 @@
|
||||
"lru-cache": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz",
|
||||
"integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==",
|
||||
"integrity": "sha1-Yi4y6CSItJJ5EUpPns9F581rulU=",
|
||||
"requires": {
|
||||
"pseudomap": "1.0.2",
|
||||
"yallist": "2.1.2"
|
||||
@ -3452,7 +3504,7 @@
|
||||
"readable-stream": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
|
||||
"integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
|
||||
"integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"core-util-is": "1.0.2",
|
||||
@ -3467,7 +3519,7 @@
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
@ -3510,7 +3562,7 @@
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=",
|
||||
"requires": {
|
||||
"brace-expansion": "1.1.8"
|
||||
}
|
||||
@ -3648,7 +3700,7 @@
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
@ -3705,7 +3757,7 @@
|
||||
"mysql": {
|
||||
"version": "2.15.0",
|
||||
"resolved": "https://registry.npmjs.org/mysql/-/mysql-2.15.0.tgz",
|
||||
"integrity": "sha512-C7tjzWtbN5nzkLIV+E8Crnl9bFyc7d3XJcBAvHKEVkjrYjogz3llo22q6s/hw+UcsE4/844pDob9ac+3dVjQSA==",
|
||||
"integrity": "sha1-6haEEVY0Po8uR/yJhexBzdlXO1w=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bignumber.js": "4.0.4",
|
||||
@ -3723,7 +3775,7 @@
|
||||
"readable-stream": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
|
||||
"integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
|
||||
"integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"core-util-is": "1.0.2",
|
||||
@ -3744,7 +3796,7 @@
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
@ -3867,7 +3919,7 @@
|
||||
"normalize-package-data": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
|
||||
"integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==",
|
||||
"integrity": "sha1-EvlaMH1YNSB1oEkHuErIvpisAS8=",
|
||||
"requires": {
|
||||
"hosted-git-info": "2.5.0",
|
||||
"is-builtin-module": "1.0.0",
|
||||
@ -4004,6 +4056,11 @@
|
||||
"wordwrap": "1.0.0"
|
||||
}
|
||||
},
|
||||
"oracledb": {
|
||||
"version": "2.0.15",
|
||||
"resolved": "https://registry.npmjs.org/oracledb/-/oracledb-2.0.15.tgz",
|
||||
"integrity": "sha1-9+IBtp+ngjUIFV6fNKumXVdCbx0="
|
||||
},
|
||||
"orchestrator": {
|
||||
"version": "0.3.8",
|
||||
"resolved": "https://registry.npmjs.org/orchestrator/-/orchestrator-0.3.8.tgz",
|
||||
@ -4027,14 +4084,6 @@
|
||||
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
|
||||
"dev": true
|
||||
},
|
||||
"os-locale": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
|
||||
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
|
||||
"requires": {
|
||||
"lcid": "1.0.0"
|
||||
}
|
||||
},
|
||||
"os-tmpdir": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
||||
@ -4113,6 +4162,14 @@
|
||||
"integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=",
|
||||
"dev": true
|
||||
},
|
||||
"parse5": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz",
|
||||
"integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==",
|
||||
"requires": {
|
||||
"@types/node": "8.0.41"
|
||||
}
|
||||
},
|
||||
"path-dirname": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz",
|
||||
@ -4123,6 +4180,7 @@
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
|
||||
"integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"pinkie-promise": "2.0.1"
|
||||
}
|
||||
@ -4177,6 +4235,7 @@
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
|
||||
"integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "4.1.11",
|
||||
"pify": "2.3.0",
|
||||
@ -4184,9 +4243,9 @@
|
||||
}
|
||||
},
|
||||
"pg": {
|
||||
"version": "7.3.0",
|
||||
"resolved": "https://registry.npmjs.org/pg/-/pg-7.3.0.tgz",
|
||||
"integrity": "sha1-J14nRm5UpkX2tKFvasrfa4Sa2Ds=",
|
||||
"version": "7.4.1",
|
||||
"resolved": "https://registry.npmjs.org/pg/-/pg-7.4.1.tgz",
|
||||
"integrity": "sha512-Pi5qYuXro5PAD9xXx8h7bFtmHgAQEG6/SCNyi7gS3rvb/ZQYDmxKchfB0zYtiSJNWq9iXTsYsHjrM+21eBcN1A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"buffer-writer": "1.0.1",
|
||||
@ -4248,12 +4307,14 @@
|
||||
"pinkie": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
|
||||
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA="
|
||||
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=",
|
||||
"dev": true
|
||||
},
|
||||
"pinkie-promise": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
|
||||
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"pinkie": "2.0.4"
|
||||
}
|
||||
@ -4288,7 +4349,7 @@
|
||||
"postgres-interval": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.1.1.tgz",
|
||||
"integrity": "sha512-OkuCi9t/3CZmeQreutGgx/OVNv9MKHGIT5jH8KldQ4NLYXkvmT9nDVxEuCENlNwhlGPE374oA/xMqn05G49pHA==",
|
||||
"integrity": "sha1-rNsPiXtLHG5JbZ1OCoU+HEKPBvA=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"xtend": "4.0.1"
|
||||
@ -4326,7 +4387,7 @@
|
||||
"randomatic": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz",
|
||||
"integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==",
|
||||
"integrity": "sha1-x6vpzIuHwLqodrGf3oP9RkeX44w=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-number": "3.0.0",
|
||||
@ -4368,6 +4429,7 @@
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
|
||||
"integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"load-json-file": "1.1.0",
|
||||
"normalize-package-data": "2.4.0",
|
||||
@ -4378,6 +4440,7 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
|
||||
"integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"find-up": "1.1.2",
|
||||
"read-pkg": "1.1.0"
|
||||
@ -4434,7 +4497,7 @@
|
||||
"redis": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/redis/-/redis-2.8.0.tgz",
|
||||
"integrity": "sha512-M1OkonEQwtRmZv4tEWF2VgpG0JWJ8Fv1PhlgT5+B+uNq2cA3Rt1Yt/ryoR+vQNOQcIEgdCdfH0jr3bDpihAw1A==",
|
||||
"integrity": "sha1-ICKI4/WMSfYHnZevehDhMDrhSwI=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"double-ended-queue": "2.1.0-0",
|
||||
@ -4706,7 +4769,7 @@
|
||||
"require_optional": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz",
|
||||
"integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==",
|
||||
"integrity": "sha1-TPNaQkf2TKPfjC7yCMxJSxyo/C4=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"resolve-from": "2.0.0",
|
||||
@ -4757,7 +4820,7 @@
|
||||
"rimraf": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
|
||||
"integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
|
||||
"integrity": "sha1-LtgVDSShbqhlHm1u8PR8QVjOejY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"glob": "7.1.2"
|
||||
@ -4776,7 +4839,7 @@
|
||||
"safe-buffer": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
|
||||
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
|
||||
"integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=",
|
||||
"dev": true
|
||||
},
|
||||
"samsam": {
|
||||
@ -4788,7 +4851,7 @@
|
||||
"sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
||||
"integrity": "sha1-KBYjTiN4vdxOU1T6tcqold9xANk="
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.4.1",
|
||||
@ -4839,7 +4902,7 @@
|
||||
"sinon": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-2.4.1.tgz",
|
||||
"integrity": "sha512-vFTrO9Wt0ECffDYIPSP/E5bBugt0UjcBQOfQUMh66xzkyPEnhl/vM2LRZi2ajuTdkH07sA6DzrM6KvdvGIH8xw==",
|
||||
"integrity": "sha1-Ah/WS1TLd9nS+w1Dze3652KcOjY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"diff": "3.2.0",
|
||||
@ -4890,7 +4953,7 @@
|
||||
"source-map-support": {
|
||||
"version": "0.4.18",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz",
|
||||
"integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==",
|
||||
"integrity": "sha1-Aoam3ovkJkEzhZTpfM6nXwosWF8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"source-map": "0.5.7"
|
||||
@ -4937,7 +5000,7 @@
|
||||
"split": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
|
||||
"integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
|
||||
"integrity": "sha1-YFvZvjA6pZ+zX5Ip++oN3snqB9k=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"through": "2.3.8"
|
||||
@ -5831,6 +5894,7 @@
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
|
||||
"integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-utf8": "0.2.1"
|
||||
}
|
||||
@ -6002,7 +6066,7 @@
|
||||
"readable-stream": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
|
||||
"integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
|
||||
"integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"core-util-is": "1.0.2",
|
||||
@ -6017,7 +6081,7 @@
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
@ -6520,16 +6584,6 @@
|
||||
"isexe": "2.0.0"
|
||||
}
|
||||
},
|
||||
"which-module": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz",
|
||||
"integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8="
|
||||
},
|
||||
"window-size": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz",
|
||||
"integrity": "sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU="
|
||||
},
|
||||
"wordwrap": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
|
||||
@ -6742,15 +6796,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz",
|
||||
"integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=",
|
||||
"requires": {
|
||||
"camelcase": "3.0.0",
|
||||
"lodash.assign": "4.2.0"
|
||||
}
|
||||
},
|
||||
"yn": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz",
|
||||
|
||||
36
src/cache/DbQueryResultCache.ts
vendored
36
src/cache/DbQueryResultCache.ts
vendored
@ -6,6 +6,7 @@ import {Connection} from "../connection/Connection";
|
||||
import {SqlServerDriver} from "../driver/sqlserver/SqlServerDriver";
|
||||
import {MssqlParameter} from "../driver/sqlserver/MssqlParameter";
|
||||
import {ObjectLiteral} from "../common/ObjectLiteral";
|
||||
import {OracleDriver} from "../driver/oracle/OracleDriver";
|
||||
|
||||
/**
|
||||
* Caches query result into current database, into separate table called "query-result-cache".
|
||||
@ -109,6 +110,12 @@ export class DbQueryResultCache implements QueryResultCache {
|
||||
.getRawOne();
|
||||
|
||||
} else if (options.query) {
|
||||
if (this.connection.driver instanceof OracleDriver) {
|
||||
return qb
|
||||
.where(`dbms_lob.compare(${qb.escape("cache")}.${qb.escape("query")}, :query) = 0`, { query: options.query })
|
||||
.getRawOne();
|
||||
}
|
||||
|
||||
return qb
|
||||
.where(`${qb.escape("cache")}.${qb.escape("query")} = :query`)
|
||||
.setParameters({ query: this.connection.driver instanceof SqlServerDriver ? new MssqlParameter(options.query, "nvarchar") : options.query })
|
||||
@ -143,25 +150,30 @@ export class DbQueryResultCache implements QueryResultCache {
|
||||
}
|
||||
|
||||
if (savedCache && savedCache.identifier) { // if exist then update
|
||||
|
||||
await queryRunner.manager
|
||||
const qb = queryRunner.manager
|
||||
.createQueryBuilder()
|
||||
.update("query-result-cache")
|
||||
.set(insertedValues)
|
||||
.where({ identifier: insertedValues.identifier })
|
||||
.execute();
|
||||
.set(insertedValues);
|
||||
|
||||
qb.where(`${qb.escape("identifier")} = :condition`, { condition: insertedValues.identifier });
|
||||
await qb.execute();
|
||||
|
||||
} else if (savedCache && savedCache.query) { // if exist then update
|
||||
|
||||
await queryRunner.manager
|
||||
const qb = queryRunner.manager
|
||||
.createQueryBuilder()
|
||||
.update("query-result-cache")
|
||||
.set(insertedValues)
|
||||
.where({ query: insertedValues.query })
|
||||
.execute();
|
||||
.set(insertedValues);
|
||||
|
||||
if (this.connection.driver instanceof OracleDriver) {
|
||||
qb.where(`dbms_lob.compare("query", :condition) = 0`, { condition: insertedValues.query });
|
||||
|
||||
} else {
|
||||
qb.where(`${qb.escape("query")} = :condition`, { condition: insertedValues.query });
|
||||
}
|
||||
|
||||
await qb.execute();
|
||||
|
||||
} else { // otherwise insert
|
||||
|
||||
await queryRunner.manager
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
@ -187,7 +199,7 @@ export class DbQueryResultCache implements QueryResultCache {
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from("query-result-cache")
|
||||
.where(identifier)
|
||||
.where(`"identifier" = :identifier`, { identifier })
|
||||
.execute();
|
||||
}));
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ export interface Driver {
|
||||
/**
|
||||
* Normalizes "default" value of the column.
|
||||
*/
|
||||
normalizeDefault(defaultValue: string): string;
|
||||
normalizeDefault(defaultValue: string|Function): string;
|
||||
|
||||
/**
|
||||
* Normalizes "isUnique" value of the column.
|
||||
|
||||
@ -398,7 +398,7 @@ export class MysqlDriver implements Driver {
|
||||
/**
|
||||
* Normalizes "default" value of the column.
|
||||
*/
|
||||
normalizeDefault(defaultValue: string): string {
|
||||
normalizeDefault(defaultValue: any): string {
|
||||
if (typeof defaultValue === "number") {
|
||||
return "" + defaultValue;
|
||||
|
||||
|
||||
@ -430,6 +430,7 @@ export class MysqlQueryRunner extends BaseQueryRunner implements QueryRunner {
|
||||
upQueries.push(`ALTER TABLE ${this.escapeTableName(table)} ADD ${this.buildCreateColumnSql(column, skipColumnLevelPrimary)}`);
|
||||
downQueries.push(`ALTER TABLE ${this.escapeTableName(table)} DROP COLUMN \`${column.name}\``);
|
||||
|
||||
// create or update primary key constraint
|
||||
if (column.isPrimary && skipColumnLevelPrimary) {
|
||||
const primaryColumns = clonedTable.primaryColumns;
|
||||
if (primaryColumns.length > 0) {
|
||||
@ -444,7 +445,13 @@ export class MysqlQueryRunner extends BaseQueryRunner implements QueryRunner {
|
||||
downQueries.push(`ALTER TABLE ${this.escapeTableName(table)} DROP PRIMARY KEY`);
|
||||
}
|
||||
|
||||
if (column.isUnique) {
|
||||
// create column index
|
||||
const columnIndex = table.indices.find(index => index.columnNames.length === 1 && index.columnNames[0] === column.name);
|
||||
if (columnIndex) {
|
||||
upQueries.push(this.createIndexSql(table, columnIndex));
|
||||
downQueries.push(this.dropIndexSql(table, columnIndex));
|
||||
|
||||
} else if (column.isUnique) {
|
||||
const uniqueIndex = new TableIndex({
|
||||
name: this.connection.namingStrategy.indexName(table.name, [column.name]),
|
||||
columnNames: [column.name],
|
||||
@ -707,6 +714,7 @@ export class MysqlQueryRunner extends BaseQueryRunner implements QueryRunner {
|
||||
const upQueries: string[] = [];
|
||||
const downQueries: string[] = [];
|
||||
|
||||
// drop primary key constraint
|
||||
const primaryColumns = clonedTable.primaryColumns;
|
||||
if (primaryColumns.length > 0 && primaryColumns.find(primaryColumn => primaryColumn.name === column.name)) {
|
||||
const columnNames = primaryColumns.map(primaryColumn => `\`${primaryColumn.name}\``).join(", ");
|
||||
@ -722,7 +730,13 @@ export class MysqlQueryRunner extends BaseQueryRunner implements QueryRunner {
|
||||
}
|
||||
}
|
||||
|
||||
if (column.isUnique) {
|
||||
// drop column index
|
||||
const columnIndex = table.indices.find(index => index.columnNames.length === 1 && index.columnNames[0] === column.name);
|
||||
if (columnIndex) {
|
||||
upQueries.push(this.dropIndexSql(table, columnIndex));
|
||||
downQueries.push(this.createIndexSql(table, columnIndex));
|
||||
|
||||
} else if (column.isUnique) {
|
||||
// we splice constraints both from table uniques and indices.
|
||||
const uniqueName = this.connection.namingStrategy.uniqueConstraintName(table.name, [column.name]);
|
||||
const foundUnique = clonedTable.uniques.find(unique => unique.name === uniqueName);
|
||||
|
||||
@ -139,7 +139,7 @@ export class OracleDriver implements Driver {
|
||||
migrationTimestamp: "timestamp",
|
||||
cacheId: "number",
|
||||
cacheIdentifier: "varchar2",
|
||||
cacheTime: "timestamp",
|
||||
cacheTime: "number",
|
||||
cacheDuration: "number",
|
||||
cacheQuery: "clob",
|
||||
cacheResult: "clob",
|
||||
@ -337,7 +337,7 @@ export class OracleDriver implements Driver {
|
||||
return value;
|
||||
|
||||
if (columnMetadata.type === Boolean) {
|
||||
return value === 1 ? true : false;
|
||||
value = value === 1 ? true : false;
|
||||
|
||||
} else if (columnMetadata.type === "date") {
|
||||
value = DateUtils.mixedDateToDateString(value);
|
||||
@ -345,14 +345,12 @@ export class OracleDriver implements Driver {
|
||||
} else if (columnMetadata.type === "time") {
|
||||
value = DateUtils.mixedTimeToString(value);
|
||||
|
||||
} else if (columnMetadata.type === "datetime") {
|
||||
value = DateUtils.normalizeHydratedDate(value);
|
||||
|
||||
} else if (columnMetadata.type === Date
|
||||
|| columnMetadata.type === "datetime"
|
||||
|| columnMetadata.type === "timestamp"
|
||||
|| columnMetadata.type === "timestamp with time zone"
|
||||
|| columnMetadata.type === "timestamp with local time zone") {
|
||||
return DateUtils.normalizeHydratedDate(value);
|
||||
value = DateUtils.normalizeHydratedDate(value);
|
||||
|
||||
} else if (columnMetadata.type === "json") {
|
||||
value = JSON.parse(value);
|
||||
@ -408,7 +406,7 @@ export class OracleDriver implements Driver {
|
||||
/**
|
||||
* Normalizes "default" value of the column.
|
||||
*/
|
||||
normalizeDefault(defaultValue: string): string {
|
||||
normalizeDefault(defaultValue: any): string {
|
||||
if (typeof defaultValue === "number") {
|
||||
return "" + defaultValue;
|
||||
|
||||
|
||||
@ -96,6 +96,8 @@ export class OracleQueryRunner extends BaseQueryRunner implements QueryRunner {
|
||||
|
||||
ok();
|
||||
});
|
||||
} else {
|
||||
ok();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -302,9 +304,8 @@ export class OracleQueryRunner extends BaseQueryRunner implements QueryRunner {
|
||||
|
||||
if (createIndices) {
|
||||
table.indices.forEach(index => {
|
||||
const primaryColumnNames = table.primaryColumns.map(column => column.name).sort();
|
||||
const indexColumnNames = [...index.columnNames].sort();
|
||||
if (OrmUtils.isArraysEqual(primaryColumnNames, indexColumnNames))
|
||||
const hasPrimaryAndIndexedColumns = table.primaryColumns.every(column => index.columnNames.indexOf(column.name) !== -1);
|
||||
if (hasPrimaryAndIndexedColumns)
|
||||
return;
|
||||
|
||||
// new index may be passed without name. In this case we generate index name manually.
|
||||
@ -446,6 +447,7 @@ export class OracleQueryRunner extends BaseQueryRunner implements QueryRunner {
|
||||
upQueries.push(`ALTER TABLE "${table.name}" ADD ${this.buildCreateColumnSql(column)}`);
|
||||
downQueries.push(`ALTER TABLE "${table.name}" DROP COLUMN "${column.name}"`);
|
||||
|
||||
// create or update primary key constraint
|
||||
if (column.isPrimary) {
|
||||
const primaryColumns = clonedTable.primaryColumns;
|
||||
// if table already have primary key, me must drop it and recreate again
|
||||
@ -463,6 +465,14 @@ export class OracleQueryRunner extends BaseQueryRunner implements QueryRunner {
|
||||
downQueries.push(`ALTER TABLE "${table.name}" DROP CONSTRAINT "${pkName}"`);
|
||||
}
|
||||
|
||||
// create column index
|
||||
const columnIndex = table.indices.find(index => index.columnNames.length === 1 && index.columnNames[0] === column.name);
|
||||
if (columnIndex) {
|
||||
upQueries.push(this.createIndexSql(table, columnIndex));
|
||||
downQueries.push(this.dropIndexSql(columnIndex));
|
||||
}
|
||||
|
||||
// create unique constraint
|
||||
if (column.isUnique) {
|
||||
const uniqueConstraint = new TableUnique({
|
||||
name: this.connection.namingStrategy.uniqueConstraintName(table.name, [column.name]),
|
||||
@ -715,6 +725,7 @@ export class OracleQueryRunner extends BaseQueryRunner implements QueryRunner {
|
||||
const upQueries: string[] = [];
|
||||
const downQueries: string[] = [];
|
||||
|
||||
// drop primary key constraint
|
||||
const primaryColumns = clonedTable.primaryColumns;
|
||||
if (primaryColumns.length > 0 && primaryColumns.find(primaryColumn => primaryColumn.name === column.name)) {
|
||||
const pkName = this.connection.namingStrategy.primaryKeyName(clonedTable.name, primaryColumns.map(column => column.name));
|
||||
@ -732,6 +743,14 @@ export class OracleQueryRunner extends BaseQueryRunner implements QueryRunner {
|
||||
}
|
||||
}
|
||||
|
||||
// drop column index
|
||||
const columnIndex = table.indices.find(index => index.columnNames.length === 1 && index.columnNames[0] === column.name);
|
||||
if (columnIndex) {
|
||||
upQueries.push(this.dropIndexSql(columnIndex));
|
||||
downQueries.push(this.createIndexSql(table, columnIndex));
|
||||
}
|
||||
|
||||
// drop unique constraint
|
||||
if (column.isUnique) {
|
||||
const uniqueName = this.connection.namingStrategy.uniqueConstraintName(table.name, [column.name]);
|
||||
const foundUnique = clonedTable.uniques.find(unique => unique.name === uniqueName);
|
||||
|
||||
@ -511,7 +511,7 @@ export class PostgresDriver implements Driver {
|
||||
/**
|
||||
* Normalizes "default" value of the column.
|
||||
*/
|
||||
normalizeDefault(defaultValue: string): string {
|
||||
normalizeDefault(defaultValue: any): string {
|
||||
if (typeof defaultValue === "number") {
|
||||
return "" + defaultValue;
|
||||
|
||||
|
||||
@ -485,6 +485,7 @@ export class PostgresQueryRunner extends BaseQueryRunner implements QueryRunner
|
||||
upQueries.push(`ALTER TABLE ${this.escapeTableName(table)} ADD ${this.buildCreateColumnSql(table, column)}`);
|
||||
downQueries.push(`ALTER TABLE ${this.escapeTableName(table)} DROP COLUMN "${column.name}"`);
|
||||
|
||||
// create or update primary key constraint
|
||||
if (column.isPrimary) {
|
||||
const primaryColumns = clonedTable.primaryColumns;
|
||||
// if table already have primary key, me must drop it and recreate again
|
||||
@ -502,6 +503,14 @@ export class PostgresQueryRunner extends BaseQueryRunner implements QueryRunner
|
||||
downQueries.push(`ALTER TABLE ${this.escapeTableName(table)} DROP CONSTRAINT "${pkName}"`);
|
||||
}
|
||||
|
||||
// create column index
|
||||
const columnIndex = table.indices.find(index => index.columnNames.length === 1 && index.columnNames[0] === column.name);
|
||||
if (columnIndex) {
|
||||
upQueries.push(this.createIndexSql(table, columnIndex));
|
||||
downQueries.push(this.dropIndexSql(table, columnIndex));
|
||||
}
|
||||
|
||||
// create unique constraint
|
||||
if (column.isUnique) {
|
||||
const uniqueConstraint = new TableUnique({
|
||||
name: this.connection.namingStrategy.uniqueConstraintName(table.name, [column.name]),
|
||||
@ -851,6 +860,7 @@ export class PostgresQueryRunner extends BaseQueryRunner implements QueryRunner
|
||||
const upQueries: string[] = [];
|
||||
const downQueries: string[] = [];
|
||||
|
||||
// drop primary key constraint
|
||||
const primaryColumns = clonedTable.primaryColumns;
|
||||
if (primaryColumns.length > 0 && primaryColumns.find(primaryColumn => primaryColumn.name === column.name)) {
|
||||
const pkName = this.connection.namingStrategy.primaryKeyName(clonedTable.name, primaryColumns.map(column => column.name));
|
||||
@ -868,6 +878,14 @@ export class PostgresQueryRunner extends BaseQueryRunner implements QueryRunner
|
||||
}
|
||||
}
|
||||
|
||||
// drop column index
|
||||
const columnIndex = table.indices.find(index => index.columnNames.length === 1 && index.columnNames[0] === column.name);
|
||||
if (columnIndex) {
|
||||
upQueries.push(this.dropIndexSql(table, columnIndex));
|
||||
downQueries.push(this.createIndexSql(table, columnIndex));
|
||||
}
|
||||
|
||||
// drop unique constraint
|
||||
if (column.isUnique) {
|
||||
const uniqueName = this.connection.namingStrategy.uniqueConstraintName(table.name, [column.name]);
|
||||
const foundUnique = clonedTable.uniques.find(unique => unique.name === uniqueName);
|
||||
@ -880,6 +898,7 @@ export class PostgresQueryRunner extends BaseQueryRunner implements QueryRunner
|
||||
upQueries.push(`ALTER TABLE ${this.escapeTableName(table)} DROP COLUMN "${column.name}"`);
|
||||
downQueries.push(`ALTER TABLE ${this.escapeTableName(table)} ADD ${this.buildCreateColumnSql(table, column)}`);
|
||||
|
||||
// drop enum type
|
||||
if (column.type === "enum") {
|
||||
const hasEnum = await this.hasEnumType(table, column);
|
||||
if (hasEnum) {
|
||||
|
||||
@ -350,7 +350,7 @@ export abstract class AbstractSqliteDriver implements Driver {
|
||||
/**
|
||||
* Normalizes "default" value of the column.
|
||||
*/
|
||||
normalizeDefault(defaultValue: string): string {
|
||||
normalizeDefault(defaultValue: any): string {
|
||||
if (typeof defaultValue === "number") {
|
||||
return "" + defaultValue;
|
||||
|
||||
|
||||
@ -627,6 +627,7 @@ export class SqlServerQueryRunner extends BaseQueryRunner implements QueryRunner
|
||||
upQueries.push(`ALTER TABLE ${this.escapeTableName(table)} ADD ${this.buildCreateColumnSql(table, column, false, false)}`);
|
||||
downQueries.push(`ALTER TABLE ${this.escapeTableName(table)} DROP COLUMN "${column.name}"`);
|
||||
|
||||
// create or update primary key constraint
|
||||
if (column.isPrimary) {
|
||||
const primaryColumns = clonedTable.primaryColumns;
|
||||
// if table already have primary key, me must drop it and recreate again
|
||||
@ -644,6 +645,14 @@ export class SqlServerQueryRunner extends BaseQueryRunner implements QueryRunner
|
||||
downQueries.push(`ALTER TABLE ${this.escapeTableName(table)} DROP CONSTRAINT "${pkName}"`);
|
||||
}
|
||||
|
||||
// create column index
|
||||
const columnIndex = table.indices.find(index => index.columnNames.length === 1 && index.columnNames[0] === column.name);
|
||||
if (columnIndex) {
|
||||
upQueries.push(this.createIndexSql(table, columnIndex));
|
||||
downQueries.push(this.dropIndexSql(table, columnIndex));
|
||||
}
|
||||
|
||||
// create unique constraint
|
||||
if (column.isUnique) {
|
||||
const uniqueConstraint = new TableUnique({
|
||||
name: this.connection.namingStrategy.uniqueConstraintName(table.name, [column.name]),
|
||||
@ -654,6 +663,7 @@ export class SqlServerQueryRunner extends BaseQueryRunner implements QueryRunner
|
||||
downQueries.push(`ALTER TABLE ${this.escapeTableName(table)} DROP CONSTRAINT "${uniqueConstraint.name}"`);
|
||||
}
|
||||
|
||||
// create default constraint
|
||||
if (column.default !== null && column.default !== undefined) {
|
||||
const defaultName = this.connection.namingStrategy.defaultConstraintName(table.name, column.name);
|
||||
upQueries.push(`ALTER TABLE ${this.escapeTableName(table)} ADD CONSTRAINT "${defaultName}" DEFAULT ${column.default} FOR "${column.name}"`);
|
||||
@ -926,6 +936,7 @@ export class SqlServerQueryRunner extends BaseQueryRunner implements QueryRunner
|
||||
const upQueries: string[] = [];
|
||||
const downQueries: string[] = [];
|
||||
|
||||
// drop primary key constraint
|
||||
const primaryColumns = clonedTable.primaryColumns;
|
||||
if (primaryColumns.length > 0 && primaryColumns.find(primaryColumn => primaryColumn.name === column.name)) {
|
||||
const pkName = this.connection.namingStrategy.primaryKeyName(clonedTable.name, primaryColumns.map(column => column.name));
|
||||
@ -943,6 +954,14 @@ export class SqlServerQueryRunner extends BaseQueryRunner implements QueryRunner
|
||||
}
|
||||
}
|
||||
|
||||
// drop column index
|
||||
const columnIndex = table.indices.find(index => index.columnNames.length === 1 && index.columnNames[0] === column.name);
|
||||
if (columnIndex) {
|
||||
upQueries.push(this.dropIndexSql(table, columnIndex));
|
||||
downQueries.push(this.createIndexSql(table, columnIndex));
|
||||
}
|
||||
|
||||
// drop unique constraint
|
||||
if (column.isUnique) {
|
||||
const uniqueName = this.connection.namingStrategy.uniqueConstraintName(table.name, [column.name]);
|
||||
const foundUnique = clonedTable.uniques.find(unique => unique.name === uniqueName);
|
||||
@ -952,6 +971,7 @@ export class SqlServerQueryRunner extends BaseQueryRunner implements QueryRunner
|
||||
downQueries.push(`ALTER TABLE ${this.escapeTableName(table)} ADD CONSTRAINT "${uniqueName}" UNIQUE ("${column.name}")`);
|
||||
}
|
||||
|
||||
// drop default constraint
|
||||
if (column.default !== null && column.default !== undefined) {
|
||||
const defaultName = this.connection.namingStrategy.defaultConstraintName(table.name, column.name);
|
||||
upQueries.push(`ALTER TABLE ${this.escapeTableName(table)} DROP CONSTRAINT "${defaultName}"`);
|
||||
|
||||
@ -324,7 +324,7 @@ export class EntityMetadataBuilder {
|
||||
options: /*tree.column || */ {
|
||||
name: "mpath",
|
||||
type: "varchar",
|
||||
nullable: false,
|
||||
nullable: true,
|
||||
default: ""
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,6 +151,12 @@ export class ColumnMetadata {
|
||||
*/
|
||||
propertyPath: string;
|
||||
|
||||
/**
|
||||
* Same as property path, but dots are replaced with '_'.
|
||||
* Used in query builder statements.
|
||||
*/
|
||||
propertyAliasName: string;
|
||||
|
||||
/**
|
||||
* Gets full path to this column database name (including column database name).
|
||||
* Full path is relevant when column is used in embeds (one or multiple nested).
|
||||
@ -561,6 +567,7 @@ export class ColumnMetadata {
|
||||
|
||||
build(connection: Connection): this {
|
||||
this.propertyPath = this.buildPropertyPath();
|
||||
this.propertyAliasName = this.propertyPath.replace(".", "_");
|
||||
this.databaseName = this.buildDatabaseName(connection);
|
||||
this.databasePath = this.buildDatabasePath();
|
||||
this.databaseNameWithoutPrefixes = connection.namingStrategy.columnName(this.propertyName, this.givenDatabaseName, []);
|
||||
|
||||
@ -314,6 +314,18 @@ export class SubjectExecutor {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
subjects.forEach(subject => {
|
||||
if (subject.generatedMap) {
|
||||
subject.metadata.columns.forEach(column => {
|
||||
const value = column.getEntityValue(subject.generatedMap!);
|
||||
if (value !== undefined && value !== null) {
|
||||
const preparedValue = this.queryRunner.connection.driver.prepareHydratedValue(value, column);
|
||||
column.setEntityValue(subject.generatedMap!, preparedValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -356,6 +368,15 @@ export class SubjectExecutor {
|
||||
|
||||
const updateResult = await updateQueryBuilder.execute();
|
||||
subject.generatedMap = updateResult.generatedMaps[0];
|
||||
if (subject.generatedMap) {
|
||||
subject.metadata.columns.forEach(column => {
|
||||
const value = column.getEntityValue(subject.generatedMap!);
|
||||
if (value !== undefined && value !== null) {
|
||||
const preparedValue = this.queryRunner.connection.driver.prepareHydratedValue(value, column);
|
||||
column.setEntityValue(subject.generatedMap!, preparedValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// experiments, remove probably, need to implement tree tables children removal
|
||||
// if (subject.updatedRelationMaps.length > 0) {
|
||||
|
||||
@ -356,8 +356,9 @@ export abstract class QueryBuilder<Entity> {
|
||||
/**
|
||||
* Prints sql to stdout using console.log.
|
||||
*/
|
||||
printSql(): this {
|
||||
console.log(this.getSql());
|
||||
printSql(): this { // TODO rename to logSql()
|
||||
const [query, parameters] = this.getQueryAndParameters();
|
||||
this.connection.logger.logQuery(query, parameters);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -589,7 +590,11 @@ export abstract class QueryBuilder<Entity> {
|
||||
if (this.expressionMap.mainAlias!.hasMetadata) {
|
||||
const metadata = this.expressionMap.mainAlias!.metadata;
|
||||
if (metadata.discriminatorColumn && metadata.parentEntityMetadata) {
|
||||
const condition = `${this.replacePropertyNames(this.expressionMap.mainAlias!.name + "." + metadata.discriminatorColumn.databaseName)} IN (:discriminatorColumnValues)`;
|
||||
const column = this.expressionMap.aliasNamePrefixingEnabled
|
||||
? this.expressionMap.mainAlias!.name + "." + metadata.discriminatorColumn.databaseName
|
||||
: metadata.discriminatorColumn.databaseName;
|
||||
|
||||
const condition = `${this.replacePropertyNames(column)} IN (:discriminatorColumnValues)`;
|
||||
return ` WHERE ${ conditions.length ? "(" + conditions + ") AND" : "" } ${condition}`;
|
||||
}
|
||||
}
|
||||
@ -634,7 +639,7 @@ export abstract class QueryBuilder<Entity> {
|
||||
}
|
||||
}).join(", ");
|
||||
|
||||
if (driver instanceof OracleDriver && this.expressionMap.queryType === "insert") {
|
||||
if (driver instanceof OracleDriver) {
|
||||
columnsExpression += " INTO " + columns.map(column => {
|
||||
const parameterName = "output_" + column.databaseName;
|
||||
this.expressionMap.nativeParameters[parameterName] = { type: driver.columnTypeToNativeParameter(column.type), dir: driver.oracle.BIND_OUT };
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import {QueryBuilder} from "./QueryBuilder";
|
||||
import {ObjectLiteral} from "../common/ObjectLiteral";
|
||||
import {QueryExpressionMap} from "./QueryExpressionMap";
|
||||
import {OracleDriver} from "../driver/oracle/OracleDriver";
|
||||
|
||||
/**
|
||||
* Allows to work with entity relations and perform specific operations with those relations.
|
||||
@ -116,12 +117,23 @@ export class RelationUpdater {
|
||||
|
||||
if (!bulkInserted.length) return;
|
||||
|
||||
await this.queryBuilder
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(junctionMetadata.tableName)
|
||||
.values(bulkInserted)
|
||||
.execute();
|
||||
if (this.queryBuilder.connection.driver instanceof OracleDriver) {
|
||||
await Promise.all(bulkInserted.map(value => {
|
||||
return this.queryBuilder
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(junctionMetadata.tableName)
|
||||
.values(value)
|
||||
.execute();
|
||||
}));
|
||||
} else {
|
||||
await this.queryBuilder
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(junctionMetadata.tableName)
|
||||
.values(bulkInserted)
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,12 @@ export class ReturningResultsEntityUpdator {
|
||||
|
||||
// if database supports returning/output statement then we already should have updating values in the raw data returned by insert query
|
||||
if (this.queryRunner.connection.driver.isReturningSqlSupported()) {
|
||||
if (this.queryRunner.connection.driver instanceof OracleDriver && updateResult.raw instanceof Array && this.expressionMap.extraReturningColumns.length > 0) {
|
||||
updateResult.raw = updateResult.raw.reduce((newRaw, rawItem, rawItemIndex) => {
|
||||
newRaw[this.expressionMap.extraReturningColumns[rawItemIndex].databaseName] = rawItem[0];
|
||||
return newRaw;
|
||||
}, {} as ObjectLiteral);
|
||||
}
|
||||
const result = updateResult.raw instanceof Array ? updateResult.raw[entityIndex] : updateResult.raw;
|
||||
const returningColumns = this.queryRunner.connection.driver.createGeneratedMap(metadata, result);
|
||||
if (returningColumns) {
|
||||
|
||||
@ -368,7 +368,7 @@ export class UpdateQueryBuilder<Entity> extends QueryBuilder<Entity> implements
|
||||
// todo: make this and other query builder to work with properly with tables without metadata
|
||||
const columns = metadata.findColumnsWithPropertyPath(propertyPath);
|
||||
columns.forEach(column => {
|
||||
const paramName = "updated_" + column.databaseName;
|
||||
const paramName = "upd_" + column.databaseName;
|
||||
|
||||
//
|
||||
let value = column.getEntityValue(valuesSet);
|
||||
@ -450,7 +450,7 @@ export class UpdateQueryBuilder<Entity> extends QueryBuilder<Entity> implements
|
||||
const returningExpression = this.createReturningExpression();
|
||||
|
||||
// generate and return sql update query
|
||||
if (returningExpression && this.connection.driver instanceof PostgresDriver) {
|
||||
if (returningExpression && (this.connection.driver instanceof PostgresDriver || this.connection.driver instanceof OracleDriver)) {
|
||||
return `UPDATE ${this.getTableName(this.getMainTableName())} SET ${updateColumnAndValues.join(", ")}${whereExpression} RETURNING ${returningExpression}`;
|
||||
|
||||
} else if (returningExpression && this.connection.driver instanceof SqlServerDriver) {
|
||||
|
||||
@ -72,7 +72,7 @@ export class RelationCountAttribute {
|
||||
|
||||
get junctionAlias(): string {
|
||||
const [parentAlias, relationProperty] = this.relationName.split(".");
|
||||
return parentAlias + "_" + relationProperty + "_relation_count";
|
||||
return parentAlias + "_" + relationProperty + "_rc";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -103,7 +103,7 @@ export class RelationIdAttribute {
|
||||
*/
|
||||
get junctionAlias(): string {
|
||||
const [parentAlias, relationProperty] = this.relationName.split(".");
|
||||
return parentAlias + "_" + relationProperty + "_relation_id";
|
||||
return parentAlias + "_" + relationProperty + "_rid";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -3,6 +3,7 @@ import {Connection} from "../../connection/Connection";
|
||||
import {RelationIdLoadResult} from "./RelationIdLoadResult";
|
||||
import {ObjectLiteral} from "../../common/ObjectLiteral";
|
||||
import {QueryRunner} from "../../query-runner/QueryRunner";
|
||||
import {abbreviate} from "../../util/StringUtils";
|
||||
|
||||
export class RelationIdLoader {
|
||||
|
||||
@ -34,11 +35,11 @@ export class RelationIdLoader {
|
||||
const results = rawEntities.map(rawEntity => {
|
||||
const result: ObjectLiteral = {};
|
||||
relationIdAttr.relation.joinColumns.forEach(joinColumn => {
|
||||
result[joinColumn.databaseName] = rawEntity[relationIdAttr.parentAlias + "_" + joinColumn.databaseName];
|
||||
result[joinColumn.databaseName] = rawEntity[this.buildColumnAlias(relationIdAttr.parentAlias, joinColumn.databaseName)];
|
||||
});
|
||||
|
||||
relationIdAttr.relation.entityMetadata.primaryColumns.forEach(primaryColumn => {
|
||||
result[primaryColumn.databaseName] = rawEntity[relationIdAttr.parentAlias + "_" + primaryColumn.databaseName];
|
||||
result[primaryColumn.databaseName] = rawEntity[this.buildColumnAlias(relationIdAttr.parentAlias, primaryColumn.databaseName)];
|
||||
});
|
||||
return result;
|
||||
});
|
||||
@ -63,7 +64,7 @@ export class RelationIdLoader {
|
||||
const condition = rawEntities.map((rawEntity, index) => {
|
||||
return joinColumns.map(joinColumn => {
|
||||
const parameterName = joinColumn.databaseName + index;
|
||||
parameters[parameterName] = rawEntity[relationIdAttr.parentAlias + "_" + joinColumn.referencedColumn!.databaseName];
|
||||
parameters[parameterName] = rawEntity[this.buildColumnAlias(relationIdAttr.parentAlias, joinColumn.referencedColumn!.databaseName)];
|
||||
return tableAlias + "." + joinColumn.propertyPath + " = :" + parameterName;
|
||||
}).join(" AND ");
|
||||
}).map(condition => "(" + condition + ")")
|
||||
@ -100,6 +101,7 @@ export class RelationIdLoader {
|
||||
};
|
||||
|
||||
} else {
|
||||
// many-to-many
|
||||
// example: Post and Category
|
||||
// owner side: loadRelationIdAndMap("post.categoryIds", "post.categories")
|
||||
// inverse side: loadRelationIdAndMap("category.postIds", "category.posts")
|
||||
@ -116,7 +118,7 @@ export class RelationIdLoader {
|
||||
|
||||
const mappedColumns = rawEntities.map(rawEntity => {
|
||||
return joinColumns.reduce((map, joinColumn) => {
|
||||
map[joinColumn.propertyPath] = rawEntity[relationIdAttr.parentAlias + "_" + joinColumn.referencedColumn!.databaseName];
|
||||
map[joinColumn.propertyPath] = rawEntity[this.buildColumnAlias(relationIdAttr.parentAlias, joinColumn.referencedColumn!.databaseName)];
|
||||
return map;
|
||||
}, {} as ObjectLiteral);
|
||||
});
|
||||
@ -173,4 +175,20 @@ export class RelationIdLoader {
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Protected Methods
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Builds column alias from given alias name and column name,
|
||||
* If alias length is more than 29, abbreviates column name.
|
||||
*/
|
||||
protected buildColumnAlias(aliasName: string, columnName: string): string {
|
||||
const columnAliasName = aliasName + "_" + columnName;
|
||||
if (columnAliasName.length > 29)
|
||||
return aliasName + "_" + abbreviate(columnName, 2);
|
||||
|
||||
return columnAliasName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -210,11 +210,6 @@ export class RawSqlResultsToEntityTransformer {
|
||||
}
|
||||
}
|
||||
|
||||
// const idMapColumns = (relation.isOneToMany || relation.isOneToOneNotOwner) ? columns : columns.map(column => column.referencedColumn!);
|
||||
// const idMap = idMapColumns.reduce((idMap, column) => {
|
||||
// return OrmUtils.mergeDeep(idMap, column.createValueMap(result[column.databaseName]));
|
||||
// }, {} as ObjectLiteral); // need to create reusable function for this process
|
||||
|
||||
const idMap = columns.reduce((idMap, column) => {
|
||||
if (relation.isOneToMany || relation.isOneToOneNotOwner) {
|
||||
return OrmUtils.mergeDeep(idMap, column.createValueMap(result[column.databaseName]));
|
||||
@ -277,7 +272,7 @@ export class RawSqlResultsToEntityTransformer {
|
||||
referenceColumnName = relation.isOwning ? relation.joinColumns[0].referencedColumn!.databaseName : relation.inverseRelation!.joinColumns[0].referencedColumn!.databaseName;
|
||||
}
|
||||
|
||||
const referenceColumnValue = rawSqlResults[0][alias.name + "_" + referenceColumnName]; // we use zero index since its grouped data // todo: selection with alias for entity columns wont work
|
||||
const referenceColumnValue = rawSqlResults[0][this.buildColumnAlias(alias.name, referenceColumnName)]; // we use zero index since its grouped data // todo: selection with alias for entity columns wont work
|
||||
if (referenceColumnValue !== undefined && referenceColumnValue !== null) {
|
||||
entity[rawRelationCountResult.relationCountAttribute.mapToPropertyPropertyName] = 0;
|
||||
rawRelationCountResult.results
|
||||
|
||||
@ -121,15 +121,15 @@ export class TreeRepository<Entity> extends Repository<Entity> {
|
||||
.createQueryBuilder(alias)
|
||||
.where(qb => {
|
||||
const subQuery = qb.subQuery()
|
||||
.select(this.metadata.materializedPathColumn!.propertyPath, "path")
|
||||
.select(`${this.metadata.targetName}.${this.metadata.materializedPathColumn!.propertyPath}`, "path")
|
||||
.from(this.metadata.target, this.metadata.targetName)
|
||||
.whereInIds(this.metadata.getEntityIdMap(entity));
|
||||
|
||||
qb.setNativeParameters(subQuery.expressionMap.nativeParameters);
|
||||
if (this.manager.connection.driver instanceof AbstractSqliteDriver) {
|
||||
return this.metadata.materializedPathColumn!.propertyPath + " LIKE " + subQuery.getQuery() + " || '%'";
|
||||
return `${alias}.${this.metadata.materializedPathColumn!.propertyPath} LIKE ${subQuery.getQuery()} || '%'`;
|
||||
} else {
|
||||
return this.metadata.materializedPathColumn!.propertyPath + " LIKE CONCAT(" + subQuery.getQuery() + ", '%')";
|
||||
return `${alias}.${this.metadata.materializedPathColumn!.propertyPath} LIKE CONCAT(${subQuery.getQuery()}, '%')`;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -176,17 +176,17 @@ export class TreeRepository<Entity> extends Repository<Entity> {
|
||||
createAncestorsQueryBuilder(alias: string, closureTableAlias: string, entity: Entity): SelectQueryBuilder<Entity> {
|
||||
|
||||
// create shortcuts for better readability
|
||||
const escape = (alias: string) => this.manager.connection.driver.escape(alias);
|
||||
// const escape = (alias: string) => this.manager.connection.driver.escape(alias);
|
||||
|
||||
if (this.metadata.treeType === "closure-table") {
|
||||
const joinCondition = this.metadata.closureJunctionTable.ancestorColumns.map(column => {
|
||||
return escape(closureTableAlias) + "." + escape(column.propertyPath) + " = " + escape(alias) + "." + escape(column.referencedColumn!.propertyPath);
|
||||
return closureTableAlias + "." + column.propertyPath + " = " + alias + "." + column.referencedColumn!.propertyPath;
|
||||
}).join(" AND ");
|
||||
|
||||
const parameters: ObjectLiteral = {};
|
||||
const whereCondition = this.metadata.closureJunctionTable.descendantColumns.map(column => {
|
||||
parameters[column.referencedColumn!.propertyName] = column.referencedColumn!.getEntityValue(entity);
|
||||
return escape(closureTableAlias) + "." + escape(column.propertyPath) + " = :" + column.referencedColumn!.propertyName;
|
||||
return closureTableAlias + "." + column.propertyPath + " = :" + column.referencedColumn!.propertyName;
|
||||
}).join(" AND ");
|
||||
|
||||
return this
|
||||
@ -213,21 +213,21 @@ export class TreeRepository<Entity> extends Repository<Entity> {
|
||||
|
||||
|
||||
} else if (this.metadata.treeType === "materialized-path") {
|
||||
// example: SELECT * FROM category WHERE (SELECT mpath FROM `category` WHERE id = 2) LIKE CONCAT(mpath, '%');
|
||||
// example: SELECT * FROM category category WHERE (SELECT mpath FROM `category` WHERE id = 2) LIKE CONCAT(category.mpath, '%');
|
||||
return this
|
||||
.createQueryBuilder(alias)
|
||||
.where(qb => {
|
||||
const subQuery = qb.subQuery()
|
||||
.select(this.metadata.materializedPathColumn!.propertyPath, "path")
|
||||
.select(`${this.metadata.targetName}.${this.metadata.materializedPathColumn!.propertyPath}`, "path")
|
||||
.from(this.metadata.target, this.metadata.targetName)
|
||||
.whereInIds(this.metadata.getEntityIdMap(entity));
|
||||
|
||||
qb.setNativeParameters(subQuery.expressionMap.nativeParameters);
|
||||
if (this.manager.connection.driver instanceof AbstractSqliteDriver) {
|
||||
return subQuery.getQuery() + " LIKE " + this.metadata.materializedPathColumn!.propertyPath + " || '%'";
|
||||
return `${subQuery.getQuery()} LIKE ${alias}.${this.metadata.materializedPathColumn!.propertyPath} || '%'`;
|
||||
|
||||
} else {
|
||||
return subQuery.getQuery() + " LIKE CONCAT(" + this.metadata.materializedPathColumn!.propertyPath + ", '%')";
|
||||
return `${subQuery.getQuery()} LIKE CONCAT(${alias}.${this.metadata.materializedPathColumn!.propertyPath}, '%')`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -223,8 +223,7 @@ describe("database schema > column types > oracle", () => {
|
||||
table!.findColumnByName("id")!.type.should.be.equal("number");
|
||||
table!.findColumnByName("name")!.type.should.be.equal("varchar2");
|
||||
table!.findColumnByName("name")!.length!.should.be.equal("255");
|
||||
table!.findColumnByName("boolean")!.type.should.be.equal("char");
|
||||
table!.findColumnByName("boolean")!.length!.should.be.equal("1");
|
||||
table!.findColumnByName("boolean")!.type.should.be.equal("number");
|
||||
table!.findColumnByName("blob")!.type.should.be.equal("blob");
|
||||
table!.findColumnByName("datetime")!.type.should.be.equal("timestamp");
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ export class Post {
|
||||
@RelationCount((post: Post) => post.categories)
|
||||
categoryCount: number;
|
||||
|
||||
@RelationCount((post: Post) => post.categories, "removedCategories", qb => qb.andWhere("removedCategories.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
@RelationCount((post: Post) => post.categories, "rc", qb => qb.andWhere("rc.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
removedCategoryCount: number;
|
||||
|
||||
}
|
||||
@ -29,13 +29,13 @@ export class Post {
|
||||
@RelationId((post: Post) => post.categories)
|
||||
categoryIds: number[];
|
||||
|
||||
@RelationId((post: Post) => post.categories, "removedCategories", qb => qb.andWhere("removedCategories.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
@RelationId((post: Post) => post.categories, "rc", qb => qb.andWhere("rc.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
removedCategoryIds: number[];
|
||||
|
||||
@RelationId((post: Post) => post.subcategories)
|
||||
subcategoryIds: number[];
|
||||
|
||||
@RelationId((post: Post) => post.subcategories, "removedSubcategories", qb => qb.andWhere("removedSubcategories.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
@RelationId((post: Post) => post.subcategories, "rsc", qb => qb.andWhere("rsc.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
removedSubcategoryIds: number[];
|
||||
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
export default {
|
||||
name: "default",
|
||||
host: "localhost",
|
||||
username: "root",
|
||||
password: "admin",
|
||||
port: 3000,
|
||||
logging: true
|
||||
};
|
||||
// export default {
|
||||
// name: "default",
|
||||
// host: "localhost",
|
||||
// username: "root",
|
||||
// password: "admin",
|
||||
// port: 3000,
|
||||
// logging: true
|
||||
// };
|
||||
@ -5,7 +5,7 @@ import {Post} from "./entity/Post";
|
||||
import {Category} from "./entity/Category";
|
||||
import {User} from "./entity/User";
|
||||
|
||||
describe.skip("persistence > basic functionality", function() {
|
||||
describe("persistence > basic functionality", function() {
|
||||
|
||||
let connections: Connection[];
|
||||
before(async () => {
|
||||
|
||||
@ -6,6 +6,7 @@ import {User} from "./entity/User";
|
||||
import {SqlServerDriver} from "../../../../src/driver/sqlserver/SqlServerDriver";
|
||||
import {Photo} from "./entity/Photo";
|
||||
import {AbstractSqliteDriver} from "../../../../src/driver/sqlite-abstract/AbstractSqliteDriver";
|
||||
import {OracleDriver} from "../../../../src/driver/oracle/OracleDriver";
|
||||
|
||||
describe("query builder > insert", () => {
|
||||
|
||||
@ -36,16 +37,6 @@ describe("query builder > insert", () => {
|
||||
})
|
||||
.execute();
|
||||
|
||||
await connection.createQueryBuilder()
|
||||
.insert()
|
||||
.into(User)
|
||||
.values([
|
||||
{ name: "Umed Khudoiberdiev" },
|
||||
{ name: "Bakhrom Baubekov" },
|
||||
{ name: "Bakhodur Kandikov" },
|
||||
])
|
||||
.execute();
|
||||
|
||||
await connection.getRepository(User)
|
||||
.createQueryBuilder("user")
|
||||
.insert()
|
||||
@ -56,10 +47,31 @@ describe("query builder > insert", () => {
|
||||
users.should.be.eql([
|
||||
{ id: 1, name: "Alex Messer" },
|
||||
{ id: 2, name: "Dima Zotov" },
|
||||
{ id: 3, name: "Umed Khudoiberdiev" },
|
||||
{ id: 4, name: "Bakhrom Baubekov" },
|
||||
{ id: 5, name: "Bakhodur Kandikov" },
|
||||
{ id: 6, name: "Muhammad Mirzoev" },
|
||||
{ id: 3, name: "Muhammad Mirzoev" }
|
||||
]);
|
||||
|
||||
})));
|
||||
|
||||
it("should perform bulk insertion correctly", () => Promise.all(connections.map(async connection => {
|
||||
// it is skipped for Oracle because it does not support bulk insertion
|
||||
if (connection.driver instanceof OracleDriver)
|
||||
return;
|
||||
|
||||
await connection.createQueryBuilder()
|
||||
.insert()
|
||||
.into(User)
|
||||
.values([
|
||||
{ name: "Umed Khudoiberdiev" },
|
||||
{ name: "Bakhrom Baubekov" },
|
||||
{ name: "Bakhodur Kandikov" },
|
||||
])
|
||||
.execute();
|
||||
|
||||
const users = await connection.getRepository(User).find();
|
||||
users.should.be.eql([
|
||||
{ id: 1, name: "Umed Khudoiberdiev" },
|
||||
{ id: 2, name: "Bakhrom Baubekov" },
|
||||
{ id: 3, name: "Bakhodur Kandikov" }
|
||||
]);
|
||||
|
||||
})));
|
||||
@ -81,7 +93,9 @@ describe("query builder > insert", () => {
|
||||
})));
|
||||
|
||||
it("should be able to insert entities with different properties set even inside embeds", () => Promise.all(connections.map(async connection => {
|
||||
if (connection.driver instanceof AbstractSqliteDriver) // this test is skipped for sqlite based drivers because it does not support DEFAULT values in insertions
|
||||
// this test is skipped for sqlite based drivers because it does not support DEFAULT values in insertions,
|
||||
// also it is skipped for Oracle because it does not support bulk insertion
|
||||
if (connection.driver instanceof AbstractSqliteDriver || connection.driver instanceof OracleDriver)
|
||||
return;
|
||||
|
||||
await connection
|
||||
|
||||
@ -495,8 +495,8 @@ describe("query builder > joins", () => {
|
||||
|
||||
const loadedPosts = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.leftJoinAndMapMany("post.removedCategories", "post.categories", "removedCategories", "removedCategories.isRemoved = :isRemoved")
|
||||
.leftJoinAndMapMany("removedCategories.removedImages", "removedCategories.images", "removedImages", "removedImages.isRemoved = :isRemoved")
|
||||
.leftJoinAndMapMany("post.removedCategories", "post.categories", "rc", "rc.isRemoved = :isRemoved")
|
||||
.leftJoinAndMapMany("rc.removedImages", "rc.images", "removedImages", "removedImages.isRemoved = :isRemoved")
|
||||
.leftJoinAndMapMany("post.subcategories", "post.categories", "subcategories", "subcategories.id IN (:subcategoryIds)")
|
||||
.leftJoinAndMapOne("subcategories.titleImage", "subcategories.images", "titleImage", "titleImage.id = :titleImageId")
|
||||
.setParameters({ isRemoved: true, subcategoryIds: [1, 2], titleImageId: 1 })
|
||||
@ -525,8 +525,8 @@ describe("query builder > joins", () => {
|
||||
|
||||
const loadedPost = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.leftJoinAndMapMany("post.removedCategories", "post.categories", "removedCategories", "removedCategories.isRemoved = :isRemoved")
|
||||
.leftJoinAndMapMany("removedCategories.removedImages", "removedCategories.images", "removedImages", "removedImages.isRemoved = :isRemoved")
|
||||
.leftJoinAndMapMany("post.removedCategories", "post.categories", "rc", "rc.isRemoved = :isRemoved")
|
||||
.leftJoinAndMapMany("rc.removedImages", "rc.images", "removedImages", "removedImages.isRemoved = :isRemoved")
|
||||
.leftJoinAndMapMany("post.subcategories", "post.categories", "subcategories", "subcategories.id IN (:subcategoryIds)")
|
||||
.leftJoinAndMapOne("subcategories.titleImage", "subcategories.images", "titleImage", "titleImage.id = :titleImageId")
|
||||
.setParameters({ isRemoved: true, subcategoryIds: [1, 2], titleImageId: 1 })
|
||||
@ -745,8 +745,8 @@ describe("query builder > joins", () => {
|
||||
|
||||
const loadedPosts = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.leftJoinAndMapMany("post.removedCategories", "post.categories", "removedCategories", "removedCategories.isRemoved = :isRemoved")
|
||||
.leftJoinAndMapMany("removedCategories.removedImages", "removedCategories.images", "removedImages", "removedImages.isRemoved = :isRemoved")
|
||||
.leftJoinAndMapMany("post.removedCategories", "post.categories", "rc", "rc.isRemoved = :isRemoved")
|
||||
.leftJoinAndMapMany("rc.removedImages", "rc.images", "removedImages", "removedImages.isRemoved = :isRemoved")
|
||||
.leftJoinAndMapMany("post.subcategories", "post.categories", "subcategories", "subcategories.id IN (:subcategoryIds)")
|
||||
.leftJoinAndMapOne("subcategories.titleImage", "subcategories.images", "titleImage", "titleImage.id = :titleImageId")
|
||||
.setParameters({ isRemoved: true, subcategoryIds: [1, 2], titleImageId: 1 })
|
||||
@ -775,8 +775,8 @@ describe("query builder > joins", () => {
|
||||
|
||||
const loadedPost = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.innerJoinAndMapMany("post.removedCategories", "post.categories", "removedCategories", "removedCategories.isRemoved = :isRemoved")
|
||||
.innerJoinAndMapMany("removedCategories.removedImages", "removedCategories.images", "removedImages", "removedImages.isRemoved = :isRemoved")
|
||||
.innerJoinAndMapMany("post.removedCategories", "post.categories", "rc", "rc.isRemoved = :isRemoved")
|
||||
.innerJoinAndMapMany("rc.removedImages", "rc.images", "removedImages", "removedImages.isRemoved = :isRemoved")
|
||||
.innerJoinAndMapMany("post.subcategories", "post.categories", "subcategories", "subcategories.id IN (:subcategoryIds)")
|
||||
.innerJoinAndMapOne("subcategories.titleImage", "subcategories.images", "titleImage", "titleImage.id = :titleImageId")
|
||||
.setParameters({ isRemoved: true, subcategoryIds: [1, 2], titleImageId: 1 })
|
||||
|
||||
@ -4,7 +4,7 @@ import {Column} from "../../../../../src/decorator/columns/Column";
|
||||
import {VersionColumn} from "../../../../../src/decorator/columns/VersionColumn";
|
||||
import {UpdateDateColumn} from "../../../../../src/decorator/columns/UpdateDateColumn";
|
||||
|
||||
@Entity()
|
||||
@Entity("post_with_v_ud")
|
||||
export class PostWithVersionAndUpdatedDate {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
|
||||
@ -2,7 +2,7 @@ import {Entity} from "../../../../../src/decorator/entity/Entity";
|
||||
import {PrimaryGeneratedColumn} from "../../../../../src/decorator/columns/PrimaryGeneratedColumn";
|
||||
import {Column} from "../../../../../src/decorator/columns/Column";
|
||||
|
||||
@Entity()
|
||||
@Entity("post_without_v_ud")
|
||||
export class PostWithoutVersionAndUpdateDate {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
|
||||
@ -97,6 +97,7 @@ describe("query builder > load-relation-count-and-map > many-to-many", () => {
|
||||
await connection.manager.save(post2);
|
||||
|
||||
const post3 = new Post();
|
||||
|
||||
post3.title = "about Audi";
|
||||
await connection.manager.save(post3);
|
||||
|
||||
@ -168,8 +169,8 @@ describe("query builder > load-relation-count-and-map > many-to-many", () => {
|
||||
.createQueryBuilder(Post, "post")
|
||||
.leftJoinAndSelect("post.categories", "categories")
|
||||
.loadRelationCountAndMap("post.categoryCount", "post.categories")
|
||||
.loadRelationCountAndMap("post.removedCategoryCount", "post.categories", "removedCategories", qb => qb.andWhere("removedCategories.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
.loadRelationCountAndMap("categories.imageCount", "categories.images")
|
||||
.loadRelationCountAndMap("post.removedCategoryCount", "post.categories", "rc", qb => qb.andWhere("rc.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
.loadRelationCountAndMap("categories.imageCount", "categories.images", "ic")
|
||||
.loadRelationCountAndMap("categories.removedImageCount", "categories.images", "removedImages", qb => qb.andWhere("removedImages.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
.addOrderBy("post.id, categories.id")
|
||||
.getMany();
|
||||
@ -187,8 +188,8 @@ describe("query builder > load-relation-count-and-map > many-to-many", () => {
|
||||
.createQueryBuilder(Post, "post")
|
||||
.leftJoinAndSelect("post.categories", "categories")
|
||||
.loadRelationCountAndMap("post.categoryCount", "post.categories")
|
||||
.loadRelationCountAndMap("post.removedCategoryCount", "post.categories", "removedCategories", qb => qb.andWhere("removedCategories.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
.loadRelationCountAndMap("categories.imageCount", "categories.images")
|
||||
.loadRelationCountAndMap("post.removedCategoryCount", "post.categories", "rc", qb => qb.andWhere("rc.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
.loadRelationCountAndMap("categories.imageCount", "categories.images", "ic")
|
||||
.loadRelationCountAndMap("categories.removedImageCount", "categories.images", "removedImages", qb => qb.andWhere("removedImages.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
.where("post.id = :id", { id: 1 })
|
||||
.addOrderBy("post.id, categories.id")
|
||||
|
||||
@ -150,7 +150,7 @@ describe("query builder > load-relation-count-and-map > one-to-many", () => {
|
||||
const loadedPosts = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.loadRelationCountAndMap("post.categoryCount", "post.categories")
|
||||
.loadRelationCountAndMap("post.removedCategoryCount", "post.categories", "removedCategories", qb => qb.andWhere("removedCategories.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
.loadRelationCountAndMap("post.removedCategoryCount", "post.categories", "rc", qb => qb.andWhere("rc.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
.getMany();
|
||||
|
||||
expect(loadedPosts[0]!.categoryCount).to.be.equal(2);
|
||||
@ -160,7 +160,7 @@ describe("query builder > load-relation-count-and-map > one-to-many", () => {
|
||||
const loadedPost = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.loadRelationCountAndMap("post.categoryCount", "post.categories")
|
||||
.loadRelationCountAndMap("post.removedCategoryCount", "post.categories", "removedCategories", qb => qb.andWhere("removedCategories.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
.loadRelationCountAndMap("post.removedCategoryCount", "post.categories", "rc", qb => qb.andWhere("rc.isRemoved = :isRemoved", { isRemoved: true }))
|
||||
.where("post.id = :id", { id: 1 })
|
||||
.getOne();
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import {Counters} from "./entity/Counters";
|
||||
import {User} from "./entity/User";
|
||||
import {Subcounters} from "./entity/Subcounters";
|
||||
|
||||
describe.skip("query builder > relation-id > many-to-many > embedded-with-multiple-pk", () => {
|
||||
describe("query builder > relation-id > many-to-many > embedded-with-multiple-pk", () => {
|
||||
|
||||
let connections: Connection[];
|
||||
before(async () => connections = await createTestingConnections({
|
||||
@ -69,10 +69,10 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
post1.counters.comments = 2;
|
||||
post1.counters.favorites = 3;
|
||||
post1.counters.categories = [category1, category2];
|
||||
post1.counters.subcounters = new Subcounters();
|
||||
post1.counters.subcounters.version = 1;
|
||||
post1.counters.subcounters.watches = 2;
|
||||
post1.counters.subcounters.watchedUsers = [user1, user2];
|
||||
post1.counters.subcntrs = new Subcounters();
|
||||
post1.counters.subcntrs.version = 1;
|
||||
post1.counters.subcntrs.watches = 2;
|
||||
post1.counters.subcntrs.watchedUsers = [user1, user2];
|
||||
await connection.manager.save(post1);
|
||||
|
||||
const post2 = new Post();
|
||||
@ -84,16 +84,16 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
post2.counters.comments = 4;
|
||||
post2.counters.favorites = 5;
|
||||
post2.counters.categories = [category3, category4];
|
||||
post2.counters.subcounters = new Subcounters();
|
||||
post2.counters.subcounters.version = 1;
|
||||
post2.counters.subcounters.watches = 1;
|
||||
post2.counters.subcounters.watchedUsers = [user3];
|
||||
post2.counters.subcntrs = new Subcounters();
|
||||
post2.counters.subcntrs.version = 1;
|
||||
post2.counters.subcntrs.watches = 1;
|
||||
post2.counters.subcntrs.watchedUsers = [user3];
|
||||
await connection.manager.save(post2);
|
||||
|
||||
const loadedPosts = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.loadRelationIdAndMap("post.counters.categoryIds", "post.counters.categories")
|
||||
.loadRelationIdAndMap("post.counters.subcounters.watchedUserIds", "post.counters.subcounters.watchedUsers")
|
||||
.loadRelationIdAndMap("post.counters.subcntrs.watchedUserIds", "post.counters.subcntrs.watchedUsers")
|
||||
.orderBy("post.id")
|
||||
.getMany();
|
||||
|
||||
@ -110,7 +110,7 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
{ id: 1, name: "cars"},
|
||||
{ id: 2, name: "BMW"}
|
||||
],
|
||||
subcounters: {
|
||||
subcntrs: {
|
||||
version: 1,
|
||||
watches: 2,
|
||||
watchedUserIds: [
|
||||
@ -134,7 +134,7 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
{ id: 3, name: "airplanes"},
|
||||
{ id: 4, name: "Boeing"}
|
||||
],
|
||||
subcounters: {
|
||||
subcntrs: {
|
||||
version: 1,
|
||||
watches: 1,
|
||||
watchedUserIds: [
|
||||
@ -148,10 +148,10 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
const loadedPost = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.loadRelationIdAndMap("post.counters.categoryIds", "post.counters.categories")
|
||||
.loadRelationIdAndMap("post.counters.subcounters.watchedUserIds", "post.counters.subcounters.watchedUsers")
|
||||
.loadRelationIdAndMap("post.counters.subcntrs.watchedUserIds", "post.counters.subcntrs.watchedUsers")
|
||||
.where("post.id = :id", { id: 1 })
|
||||
.andWhere("post.counters.code = :code", { code: 111 })
|
||||
.andWhere("post.counters.subcounters.version = :version", { version: 1 })
|
||||
.andWhere("post.counters.subcntrs.version = :version", { version: 1 })
|
||||
.getOne();
|
||||
|
||||
expect(loadedPost!.should.be.eql(
|
||||
@ -167,7 +167,7 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
{ id: 1, name: "cars"},
|
||||
{ id: 2, name: "BMW"}
|
||||
],
|
||||
subcounters: {
|
||||
subcntrs: {
|
||||
version: 1,
|
||||
watches: 2,
|
||||
watchedUserIds: [
|
||||
@ -194,9 +194,9 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
post1.counters.likes = 1;
|
||||
post1.counters.comments = 2;
|
||||
post1.counters.favorites = 3;
|
||||
post1.counters.subcounters = new Subcounters();
|
||||
post1.counters.subcounters.version = 1;
|
||||
post1.counters.subcounters.watches = 2;
|
||||
post1.counters.subcntrs = new Subcounters();
|
||||
post1.counters.subcntrs.version = 1;
|
||||
post1.counters.subcntrs.watches = 2;
|
||||
await connection.manager.save(post1);
|
||||
|
||||
const post2 = new Post();
|
||||
@ -207,9 +207,9 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
post2.counters.likes = 3;
|
||||
post2.counters.comments = 4;
|
||||
post2.counters.favorites = 5;
|
||||
post2.counters.subcounters = new Subcounters();
|
||||
post2.counters.subcounters.version = 1;
|
||||
post2.counters.subcounters.watches = 5;
|
||||
post2.counters.subcntrs = new Subcounters();
|
||||
post2.counters.subcntrs.version = 1;
|
||||
post2.counters.subcntrs.watches = 5;
|
||||
await connection.manager.save(post2);
|
||||
|
||||
const post3 = new Post();
|
||||
@ -220,9 +220,9 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
post3.counters.likes = 6;
|
||||
post3.counters.comments = 7;
|
||||
post3.counters.favorites = 8;
|
||||
post3.counters.subcounters = new Subcounters();
|
||||
post3.counters.subcounters.version = 2;
|
||||
post3.counters.subcounters.watches = 10;
|
||||
post3.counters.subcntrs = new Subcounters();
|
||||
post3.counters.subcntrs.version = 2;
|
||||
post3.counters.subcntrs.watches = 10;
|
||||
await connection.manager.save(post3);
|
||||
|
||||
const post4 = new Post();
|
||||
@ -233,9 +233,9 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
post4.counters.likes = 9;
|
||||
post4.counters.comments = 10;
|
||||
post4.counters.favorites = 11;
|
||||
post4.counters.subcounters = new Subcounters();
|
||||
post4.counters.subcounters.version = 3;
|
||||
post4.counters.subcounters.watches = 10;
|
||||
post4.counters.subcntrs = new Subcounters();
|
||||
post4.counters.subcntrs.version = 3;
|
||||
post4.counters.subcntrs.watches = 10;
|
||||
await connection.manager.save(post4);
|
||||
|
||||
const category1 = new Category();
|
||||
@ -270,12 +270,12 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
|
||||
expect(loadedCategories[0].postIds).to.not.be.empty;
|
||||
expect(loadedCategories[0].postIds.length).to.be.equal(2);
|
||||
expect(loadedCategories[0].postIds[0]).to.be.eql({ id: 1, counters: { code: 111, subcounters: { version: 1 }} });
|
||||
expect(loadedCategories[0].postIds[1]).to.be.eql({ id: 2, counters: { code: 222, subcounters: { version: 1 }} });
|
||||
expect(loadedCategories[0].postIds[0]).to.be.eql({ id: 1, counters: { code: 111, subcntrs: { version: 1 }} });
|
||||
expect(loadedCategories[0].postIds[1]).to.be.eql({ id: 2, counters: { code: 222, subcntrs: { version: 1 }} });
|
||||
expect(loadedCategories[1].postIds).to.not.be.empty;
|
||||
expect(loadedCategories[1].postIds.length).to.be.equal(2);
|
||||
expect(loadedCategories[1].postIds[0]).to.be.eql({ id: 3, counters: { code: 333, subcounters: { version: 2 }} });
|
||||
expect(loadedCategories[1].postIds[1]).to.be.eql({ id: 4, counters: { code: 444, subcounters: { version: 3 }} });
|
||||
expect(loadedCategories[1].postIds[0]).to.be.eql({ id: 3, counters: { code: 333, subcntrs: { version: 2 }} });
|
||||
expect(loadedCategories[1].postIds[1]).to.be.eql({ id: 4, counters: { code: 444, subcntrs: { version: 3 }} });
|
||||
|
||||
const loadedCategory = await connection.manager
|
||||
.createQueryBuilder(Category, "category")
|
||||
@ -286,8 +286,8 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
|
||||
expect(loadedCategory!.postIds).to.not.be.empty;
|
||||
expect(loadedCategory!.postIds.length).to.be.equal(2);
|
||||
expect(loadedCategory!.postIds[0]).to.be.eql({ id: 1, counters: { code: 111, subcounters: { version: 1 }} });
|
||||
expect(loadedCategory!.postIds[1]).to.be.eql({ id: 2, counters: { code: 222, subcounters: { version: 1 }} });
|
||||
expect(loadedCategory!.postIds[0]).to.be.eql({ id: 1, counters: { code: 111, subcntrs: { version: 1 }} });
|
||||
expect(loadedCategory!.postIds[1]).to.be.eql({ id: 2, counters: { code: 222, subcntrs: { version: 1 }} });
|
||||
|
||||
const loadedUsers = await connection.manager
|
||||
.createQueryBuilder(User, "user")
|
||||
@ -297,12 +297,12 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
|
||||
expect(loadedUsers[0].postIds).to.not.be.empty;
|
||||
expect(loadedUsers[0].postIds.length).to.be.equal(2);
|
||||
expect(loadedUsers[0].postIds[0]).to.be.eql({ id: 1, counters: { code: 111, subcounters: { version: 1 }} });
|
||||
expect(loadedUsers[0].postIds[1]).to.be.eql({ id: 2, counters: { code: 222, subcounters: { version: 1 }} });
|
||||
expect(loadedUsers[0].postIds[0]).to.be.eql({ id: 1, counters: { code: 111, subcntrs: { version: 1 }} });
|
||||
expect(loadedUsers[0].postIds[1]).to.be.eql({ id: 2, counters: { code: 222, subcntrs: { version: 1 }} });
|
||||
expect(loadedUsers[1].postIds).to.not.be.empty;
|
||||
expect(loadedUsers[1].postIds.length).to.be.equal(2);
|
||||
expect(loadedUsers[1].postIds[0]).to.be.eql({ id: 3, counters: { code: 333, subcounters: { version: 2 }} });
|
||||
expect(loadedUsers[1].postIds[1]).to.be.eql({ id: 4, counters: { code: 444, subcounters: { version: 3 }} });
|
||||
expect(loadedUsers[1].postIds[0]).to.be.eql({ id: 3, counters: { code: 333, subcntrs: { version: 2 }} });
|
||||
expect(loadedUsers[1].postIds[1]).to.be.eql({ id: 4, counters: { code: 444, subcntrs: { version: 3 }} });
|
||||
|
||||
const loadedUser = await connection.manager
|
||||
.createQueryBuilder(User, "user")
|
||||
@ -313,8 +313,8 @@ describe.skip("query builder > relation-id > many-to-many > embedded-with-multip
|
||||
|
||||
expect(loadedUser!.postIds).to.not.be.empty;
|
||||
expect(loadedUser!.postIds.length).to.be.equal(2);
|
||||
expect(loadedUser!.postIds[0]).to.be.eql({ id: 1, counters: { code: 111, subcounters: { version: 1 }} });
|
||||
expect(loadedUser!.postIds[1]).to.be.eql({ id: 2, counters: { code: 222, subcounters: { version: 1 }} });
|
||||
expect(loadedUser!.postIds[0]).to.be.eql({ id: 1, counters: { code: 111, subcntrs: { version: 1 }} });
|
||||
expect(loadedUser!.postIds[1]).to.be.eql({ id: 2, counters: { code: 222, subcntrs: { version: 1 }} });
|
||||
|
||||
})));
|
||||
|
||||
|
||||
@ -20,11 +20,11 @@ export class Counters {
|
||||
favorites: number;
|
||||
|
||||
@ManyToMany(type => Category, category => category.posts)
|
||||
@JoinTable()
|
||||
@JoinTable({ name: "counter_categories" })
|
||||
categories: Category[];
|
||||
|
||||
@Column(() => Subcounters)
|
||||
subcounters: Subcounters;
|
||||
subcntrs: Subcounters;
|
||||
|
||||
categoryIds: number[];
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ import {Counters} from "./Counters";
|
||||
import {PrimaryColumn} from "../../../../../../../src/decorator/columns/PrimaryColumn";
|
||||
|
||||
@Entity()
|
||||
@Index(["id", "counters.code", "counters.subcounters.version"], { unique: true })
|
||||
@Index(["id", "counters.code", "counters.subcntrs.version"], { unique: true })
|
||||
export class Post {
|
||||
|
||||
@PrimaryColumn()
|
||||
|
||||
@ -13,7 +13,7 @@ export class Subcounters {
|
||||
watches: number;
|
||||
|
||||
@ManyToMany(type => User, user => user.posts)
|
||||
@JoinTable()
|
||||
@JoinTable({ name: "subcnt_users" })
|
||||
watchedUsers: User[];
|
||||
|
||||
watchedUserIds: number[];
|
||||
|
||||
@ -14,7 +14,7 @@ export class User {
|
||||
@PrimaryColumn()
|
||||
name: string;
|
||||
|
||||
@ManyToMany(type => Post, post => post.counters.subcounters.watchedUsers)
|
||||
@ManyToMany(type => Post, post => post.counters.subcntrs.watchedUsers)
|
||||
posts: Post[];
|
||||
|
||||
postIds: number[];
|
||||
|
||||
@ -16,10 +16,10 @@ export class Counters {
|
||||
favorites: number;
|
||||
|
||||
@ManyToMany(type => Category, category => category.posts)
|
||||
@JoinTable()
|
||||
@JoinTable({ name: "counter_categories" })
|
||||
categories: Category[];
|
||||
|
||||
@Column(() => Subcounters)
|
||||
@Column(() => Subcounters, { prefix: "subcnt" })
|
||||
subcounters: Subcounters;
|
||||
|
||||
categoryIds: number[];
|
||||
|
||||
@ -8,7 +8,7 @@ export class Post {
|
||||
@Column()
|
||||
title: string;
|
||||
|
||||
@Column(() => Counters)
|
||||
@Column(() => Counters, { prefix: "cnt" })
|
||||
counters: Counters;
|
||||
|
||||
}
|
||||
@ -16,7 +16,7 @@ export class Subcounters {
|
||||
watches: number;
|
||||
|
||||
@ManyToMany(type => User)
|
||||
@JoinTable()
|
||||
@JoinTable({ name: "subcnt_users" })
|
||||
watchedUsers: User[];
|
||||
|
||||
watchedUserIds: number[];
|
||||
|
||||
@ -5,7 +5,7 @@ import {closeTestingConnections, createTestingConnections, reloadTestingDatabase
|
||||
import {expect} from "chai";
|
||||
import {Connection} from "../../../../../src/connection/Connection";
|
||||
|
||||
describe("query builder > relational query builder > add and remove operations > many to many relation", () => {
|
||||
describe("query builder > relational with many > add and remove many to many inverse", () => {
|
||||
|
||||
let connections: Connection[];
|
||||
before(async () => connections = await createTestingConnections({
|
||||
|
||||
@ -5,7 +5,7 @@ import {closeTestingConnections, createTestingConnections, reloadTestingDatabase
|
||||
import {expect} from "chai";
|
||||
import {Connection} from "../../../../../src/connection/Connection";
|
||||
|
||||
describe("query builder > relational query builder > add and remove operations > many to many relation", () => {
|
||||
describe("query builder > relational with many > add and remove many to many", () => {
|
||||
|
||||
let connections: Connection[];
|
||||
before(async () => connections = await createTestingConnections({
|
||||
|
||||
@ -5,7 +5,7 @@ import {closeTestingConnections, createTestingConnections, reloadTestingDatabase
|
||||
import {expect} from "chai";
|
||||
import {Connection} from "../../../../../src/connection/Connection";
|
||||
|
||||
describe("query builder > relational query builder > add and remove operations > many to many relation", () => {
|
||||
describe("query builder > relational with many > load many", () => {
|
||||
|
||||
let connections: Connection[];
|
||||
before(async () => connections = await createTestingConnections({
|
||||
|
||||
@ -159,7 +159,7 @@ describe("query builder > sub-query", () => {
|
||||
|
||||
const posts = await connection
|
||||
.createQueryBuilder()
|
||||
.select("usr.name", "name")
|
||||
.select(`${connection.driver.escape("usr")}.${connection.driver.escape("name")}`, "name")
|
||||
.from("(" + userQb.getQuery() + ")", "usr")
|
||||
.setParameters(userQb.getParameters())
|
||||
.getRawMany();
|
||||
@ -180,7 +180,7 @@ describe("query builder > sub-query", () => {
|
||||
|
||||
const posts = await connection
|
||||
.createQueryBuilder()
|
||||
.select("usr.name", "name")
|
||||
.select(`${connection.driver.escape("usr")}.${connection.driver.escape("name")}`, "name")
|
||||
.from(subQuery => {
|
||||
return subQuery
|
||||
.select("usr.name", "name")
|
||||
@ -206,7 +206,7 @@ describe("query builder > sub-query", () => {
|
||||
|
||||
const posts = await connection
|
||||
.createQueryBuilder()
|
||||
.select("usr.name", "name")
|
||||
.select(`${connection.driver.escape("usr")}.${connection.driver.escape("name")}`, "name")
|
||||
.from(subQuery => {
|
||||
return subQuery
|
||||
.select("usr.name", "name")
|
||||
@ -235,7 +235,7 @@ describe("query builder > sub-query", () => {
|
||||
.from(User, "usr")
|
||||
.where("usr.registered = :registered", { registered: true });
|
||||
}, "usr")
|
||||
.where("post.title = usr.name")
|
||||
.where(`${connection.driver.escape("post")}.${connection.driver.escape("title")} = ${connection.driver.escape("usr")}.${connection.driver.escape("name")}`)
|
||||
.orderBy("post.id")
|
||||
.getMany();
|
||||
|
||||
@ -307,7 +307,7 @@ describe("query builder > sub-query", () => {
|
||||
const posts = await connection
|
||||
.getRepository(Post)
|
||||
.createQueryBuilder("post")
|
||||
.innerJoin("post.categories", "category", `category.name IN (${subQuery})`)
|
||||
.innerJoin("post.categories", "category", `${connection.driver.escape("category")}.${connection.driver.escape("name")} IN (${subQuery})`)
|
||||
.orderBy("post.id")
|
||||
.getMany();
|
||||
|
||||
@ -331,7 +331,7 @@ describe("query builder > sub-query", () => {
|
||||
.createQueryBuilder("post")
|
||||
.innerJoin(subQuery => {
|
||||
return subQuery.select().from("category", "category");
|
||||
}, "category", `category.name IN (${joinConditionSubQuery})`)
|
||||
}, "category", `${connection.driver.escape("category")}.${connection.driver.escape("name")} IN (${joinConditionSubQuery})`)
|
||||
.orderBy("post.id")
|
||||
.getMany();
|
||||
|
||||
@ -360,7 +360,7 @@ describe("query builder > sub-query", () => {
|
||||
const posts = await connection
|
||||
.getRepository(Post)
|
||||
.createQueryBuilder("post")
|
||||
.innerJoin("(" + joinSubQuery + ")", "category", `category.name IN (${joinConditionSubQuery})`)
|
||||
.innerJoin("(" + joinSubQuery + ")", "category", `${connection.driver.escape("category")}.${connection.driver.escape("name")} IN (${joinConditionSubQuery})`)
|
||||
.orderBy("post.id")
|
||||
.getMany();
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ describe("query runner > add column", () => {
|
||||
name: "secondId",
|
||||
type: "int",
|
||||
isPrimary: true,
|
||||
isUnique: true,
|
||||
isNullable: false
|
||||
});
|
||||
|
||||
@ -51,6 +52,7 @@ describe("query runner > add column", () => {
|
||||
column1 = table!.findColumnByName("secondId")!;
|
||||
column1!.should.be.exist;
|
||||
column1!.isPrimary.should.be.true;
|
||||
column1!.isUnique.should.be.true;
|
||||
column1!.isNullable.should.be.false;
|
||||
|
||||
// MySql and Sqlite does not supports autoincrement composite primary keys.
|
||||
|
||||
@ -45,8 +45,8 @@ describe("relations > eager relations > basic", () => {
|
||||
|
||||
const post = new Post();
|
||||
post.title = "about eager relations";
|
||||
post.primaryCategories = [primaryCategory1, primaryCategory2];
|
||||
post.secondaryCategories = [secondaryCategory1, secondaryCategory2];
|
||||
post.categories1 = [primaryCategory1, primaryCategory2];
|
||||
post.categories2 = [secondaryCategory1, secondaryCategory2];
|
||||
post.author = user;
|
||||
await connection.manager.save(post);
|
||||
|
||||
@ -63,14 +63,14 @@ describe("relations > eager relations > basic", () => {
|
||||
loadedPost!.should.be.eql({
|
||||
id: 1,
|
||||
title: "about eager relations",
|
||||
primaryCategories: [{
|
||||
categories1: [{
|
||||
id: 1,
|
||||
name: "primary category #1"
|
||||
}, {
|
||||
id: 2,
|
||||
name: "primary category #2"
|
||||
}],
|
||||
secondaryCategories: [{
|
||||
categories2: [{
|
||||
id: 3,
|
||||
name: "secondary category #1"
|
||||
}, {
|
||||
|
||||
@ -14,8 +14,8 @@ export class Category {
|
||||
@Column()
|
||||
name: string;
|
||||
|
||||
@ManyToMany(type => Post, post => post.secondaryCategories)
|
||||
@ManyToMany(type => Post, post => post.categories2)
|
||||
@JoinTable()
|
||||
secondaryPosts: Post[];
|
||||
posts2: Post[];
|
||||
|
||||
}
|
||||
@ -20,10 +20,10 @@ export class Post {
|
||||
|
||||
@ManyToMany(type => Category, { eager: true })
|
||||
@JoinTable()
|
||||
primaryCategories: Category[];
|
||||
categories1: Category[];
|
||||
|
||||
@ManyToMany(type => Category, category => category.secondaryPosts, { eager: true })
|
||||
secondaryCategories: Category[];
|
||||
@ManyToMany(type => Category, category => category.posts2, { eager: true })
|
||||
categories2: Category[];
|
||||
|
||||
@ManyToOne(type => User, { eager: true })
|
||||
author: User;
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import {Entity} from "../../../../../../src/decorator/entity/Entity";
|
||||
import {PrimaryColumn} from "../../../../../../src/decorator/columns/PrimaryColumn";
|
||||
import {Column} from "../../../../../../src/decorator/columns/Column";
|
||||
import {Index} from "../../../../../../src/decorator/Index";
|
||||
import {Post} from "./Post";
|
||||
import {ManyToMany} from "../../../../../../src/decorator/relations/ManyToMany";
|
||||
import {Tag} from "./Tag";
|
||||
import {Unique} from "../../../../../../src";
|
||||
|
||||
@Entity()
|
||||
@Index(["code", "version", "description"], { unique: true })
|
||||
@Unique(["code", "version", "description"])
|
||||
export class Category {
|
||||
|
||||
@PrimaryColumn()
|
||||
@ -31,8 +31,8 @@ export class Category {
|
||||
@ManyToMany(type => Post, post => post.categoriesWithOptions)
|
||||
postsWithOptions: Post[];
|
||||
|
||||
@ManyToMany(type => Post, post => post.categoriesWithNonPrimaryColumns)
|
||||
postsWithNonPrimaryColumns: Post[];
|
||||
@ManyToMany(type => Post, post => post.categoriesWithNonPKColumns)
|
||||
postsWithNonPKColumns: Post[];
|
||||
|
||||
@ManyToMany(type => Tag, tag => tag.categories)
|
||||
tags: Tag[];
|
||||
@ -40,7 +40,7 @@ export class Category {
|
||||
@ManyToMany(type => Tag, tag => tag.categoriesWithOptions)
|
||||
tagsWithOptions: Tag[];
|
||||
|
||||
@ManyToMany(type => Tag, tag => tag.categoriesWithNonPrimaryColumns)
|
||||
tagsWithNonPrimaryColumns: Tag[];
|
||||
@ManyToMany(type => Tag, tag => tag.categoriesWithNonPKColumns)
|
||||
tagsWithNonPKColumns: Tag[];
|
||||
|
||||
}
|
||||
@ -35,7 +35,7 @@ export class Post {
|
||||
})
|
||||
categoriesWithOptions: Category[];
|
||||
|
||||
@ManyToMany(type => Category, category => category.postsWithNonPrimaryColumns)
|
||||
@ManyToMany(type => Category, category => category.postsWithNonPKColumns)
|
||||
@JoinTable({
|
||||
name: "post_categories_non_primary",
|
||||
joinColumns: [{
|
||||
@ -53,6 +53,6 @@ export class Post {
|
||||
referencedColumnName: "description"
|
||||
}]
|
||||
})
|
||||
categoriesWithNonPrimaryColumns: Category[];
|
||||
categoriesWithNonPKColumns: Category[];
|
||||
|
||||
}
|
||||
@ -41,7 +41,7 @@ export class Tag {
|
||||
})
|
||||
categoriesWithOptions: Category[];
|
||||
|
||||
@ManyToMany(type => Category, category => category.tagsWithNonPrimaryColumns)
|
||||
@ManyToMany(type => Category, category => category.tagsWithNonPKColumns)
|
||||
@JoinTable({
|
||||
name: "tag_categories_non_primary",
|
||||
joinColumns: [{
|
||||
@ -62,6 +62,6 @@ export class Tag {
|
||||
referencedColumnName: "description"
|
||||
}]
|
||||
})
|
||||
categoriesWithNonPrimaryColumns: Category[];
|
||||
categoriesWithNonPKColumns: Category[];
|
||||
|
||||
}
|
||||
@ -167,43 +167,43 @@ describe("relations > multiple-primary-keys > many-to-many", () => {
|
||||
|
||||
const post1 = new Post();
|
||||
post1.title = "About BMW";
|
||||
post1.categoriesWithNonPrimaryColumns = [category1, category2];
|
||||
post1.categoriesWithNonPKColumns = [category1, category2];
|
||||
await connection.manager.save(post1);
|
||||
|
||||
const post2 = new Post();
|
||||
post2.title = "About Boeing";
|
||||
post2.categoriesWithNonPrimaryColumns = [category3];
|
||||
post2.categoriesWithNonPKColumns = [category3];
|
||||
await connection.manager.save(post2);
|
||||
|
||||
const loadedPosts = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.leftJoinAndSelect("post.categoriesWithNonPrimaryColumns", "categories")
|
||||
.leftJoinAndSelect("post.categoriesWithNonPKColumns", "categories")
|
||||
.orderBy("post.id, categories.code")
|
||||
.getMany();
|
||||
|
||||
expect(loadedPosts[0].categoriesWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedPosts[0].categoriesWithNonPrimaryColumns[0].code).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoriesWithNonPrimaryColumns[0].version).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoriesWithNonPrimaryColumns[0].description).to.be.equal("category of cars");
|
||||
expect(loadedPosts[0].categoriesWithNonPrimaryColumns[1].code).to.be.equal(2);
|
||||
expect(loadedPosts[0].categoriesWithNonPrimaryColumns[1].version).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoriesWithNonPrimaryColumns[1].description).to.be.equal("category of BMW");
|
||||
expect(loadedPosts[1].categoriesWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedPosts[1].categoriesWithNonPrimaryColumns[0].code).to.be.equal(3);
|
||||
expect(loadedPosts[1].categoriesWithNonPrimaryColumns[0].version).to.be.equal(1);
|
||||
expect(loadedPosts[1].categoriesWithNonPrimaryColumns[0].description).to.be.equal("category of airplanes");
|
||||
expect(loadedPosts[0].categoriesWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedPosts[0].categoriesWithNonPKColumns[0].code).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoriesWithNonPKColumns[0].version).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoriesWithNonPKColumns[0].description).to.be.equal("category of cars");
|
||||
expect(loadedPosts[0].categoriesWithNonPKColumns[1].code).to.be.equal(2);
|
||||
expect(loadedPosts[0].categoriesWithNonPKColumns[1].version).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoriesWithNonPKColumns[1].description).to.be.equal("category of BMW");
|
||||
expect(loadedPosts[1].categoriesWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedPosts[1].categoriesWithNonPKColumns[0].code).to.be.equal(3);
|
||||
expect(loadedPosts[1].categoriesWithNonPKColumns[0].version).to.be.equal(1);
|
||||
expect(loadedPosts[1].categoriesWithNonPKColumns[0].description).to.be.equal("category of airplanes");
|
||||
|
||||
const loadedPost = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.leftJoinAndSelect("post.categoriesWithNonPrimaryColumns", "categories")
|
||||
.leftJoinAndSelect("post.categoriesWithNonPKColumns", "categories")
|
||||
.orderBy("categories.code")
|
||||
.where("post.id = :id", { id: 1 })
|
||||
.getOne();
|
||||
|
||||
expect(loadedPost!.categoriesWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedPost!.categoriesWithNonPrimaryColumns[0].code).to.be.equal(1);
|
||||
expect(loadedPost!.categoriesWithNonPrimaryColumns[0].version).to.be.equal(1);
|
||||
expect(loadedPost!.categoriesWithNonPrimaryColumns[0].description).to.be.equal("category of cars");
|
||||
expect(loadedPost!.categoriesWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedPost!.categoriesWithNonPKColumns[0].code).to.be.equal(1);
|
||||
expect(loadedPost!.categoriesWithNonPKColumns[0].version).to.be.equal(1);
|
||||
expect(loadedPost!.categoriesWithNonPKColumns[0].description).to.be.equal("category of cars");
|
||||
|
||||
})));
|
||||
|
||||
@ -367,45 +367,45 @@ describe("relations > multiple-primary-keys > many-to-many", () => {
|
||||
tag1.code = 1;
|
||||
tag1.title = "About BMW";
|
||||
tag1.description = "Tag about BMW";
|
||||
tag1.categoriesWithNonPrimaryColumns = [category1, category2];
|
||||
tag1.categoriesWithNonPKColumns = [category1, category2];
|
||||
await connection.manager.save(tag1);
|
||||
|
||||
const tag2 = new Tag();
|
||||
tag2.code = 2;
|
||||
tag2.title = "About Boeing";
|
||||
tag2.description = "Tag about Boeing";
|
||||
tag2.categoriesWithNonPrimaryColumns = [category3];
|
||||
tag2.categoriesWithNonPKColumns = [category3];
|
||||
await connection.manager.save(tag2);
|
||||
|
||||
const loadedTags = await connection.manager
|
||||
.createQueryBuilder(Tag, "tag")
|
||||
.leftJoinAndSelect("tag.categoriesWithNonPrimaryColumns", "categories")
|
||||
.leftJoinAndSelect("tag.categoriesWithNonPKColumns", "categories")
|
||||
.orderBy("tag.code, categories.code")
|
||||
.getMany();
|
||||
|
||||
expect(loadedTags[0].categoriesWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedTags[0].categoriesWithNonPrimaryColumns[0].code).to.be.equal(1);
|
||||
expect(loadedTags[0].categoriesWithNonPrimaryColumns[0].version).to.be.equal(1);
|
||||
expect(loadedTags[0].categoriesWithNonPrimaryColumns[0].description).to.be.equal("category of cars");
|
||||
expect(loadedTags[0].categoriesWithNonPrimaryColumns[1].code).to.be.equal(2);
|
||||
expect(loadedTags[0].categoriesWithNonPrimaryColumns[1].version).to.be.equal(1);
|
||||
expect(loadedTags[0].categoriesWithNonPrimaryColumns[1].description).to.be.equal("category of BMW");
|
||||
expect(loadedTags[1].categoriesWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedTags[1].categoriesWithNonPrimaryColumns[0].code).to.be.equal(3);
|
||||
expect(loadedTags[1].categoriesWithNonPrimaryColumns[0].version).to.be.equal(1);
|
||||
expect(loadedTags[1].categoriesWithNonPrimaryColumns[0].description).to.be.equal("category of airplanes");
|
||||
expect(loadedTags[0].categoriesWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedTags[0].categoriesWithNonPKColumns[0].code).to.be.equal(1);
|
||||
expect(loadedTags[0].categoriesWithNonPKColumns[0].version).to.be.equal(1);
|
||||
expect(loadedTags[0].categoriesWithNonPKColumns[0].description).to.be.equal("category of cars");
|
||||
expect(loadedTags[0].categoriesWithNonPKColumns[1].code).to.be.equal(2);
|
||||
expect(loadedTags[0].categoriesWithNonPKColumns[1].version).to.be.equal(1);
|
||||
expect(loadedTags[0].categoriesWithNonPKColumns[1].description).to.be.equal("category of BMW");
|
||||
expect(loadedTags[1].categoriesWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedTags[1].categoriesWithNonPKColumns[0].code).to.be.equal(3);
|
||||
expect(loadedTags[1].categoriesWithNonPKColumns[0].version).to.be.equal(1);
|
||||
expect(loadedTags[1].categoriesWithNonPKColumns[0].description).to.be.equal("category of airplanes");
|
||||
|
||||
const loadedTag = await connection.manager
|
||||
.createQueryBuilder(Tag, "tag")
|
||||
.leftJoinAndSelect("tag.categoriesWithNonPrimaryColumns", "categories")
|
||||
.leftJoinAndSelect("tag.categoriesWithNonPKColumns", "categories")
|
||||
.orderBy("categories.code")
|
||||
.where("tag.code = :code", { code: 1 })
|
||||
.getOne();
|
||||
|
||||
expect(loadedTag!.categoriesWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedTag!.categoriesWithNonPrimaryColumns[0].code).to.be.equal(1);
|
||||
expect(loadedTag!.categoriesWithNonPrimaryColumns[0].version).to.be.equal(1);
|
||||
expect(loadedTag!.categoriesWithNonPrimaryColumns[0].description).to.be.equal("category of cars");
|
||||
expect(loadedTag!.categoriesWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedTag!.categoriesWithNonPKColumns[0].code).to.be.equal(1);
|
||||
expect(loadedTag!.categoriesWithNonPKColumns[0].version).to.be.equal(1);
|
||||
expect(loadedTag!.categoriesWithNonPKColumns[0].description).to.be.equal("category of cars");
|
||||
|
||||
})));
|
||||
|
||||
@ -543,7 +543,7 @@ describe("relations > multiple-primary-keys > many-to-many", () => {
|
||||
category1.code = 1;
|
||||
category1.version = 1;
|
||||
category1.description = "category of cars";
|
||||
category1.postsWithNonPrimaryColumns = [post1, post2];
|
||||
category1.postsWithNonPKColumns = [post1, post2];
|
||||
await connection.manager.save(category1);
|
||||
|
||||
const category2 = new Category();
|
||||
@ -552,31 +552,31 @@ describe("relations > multiple-primary-keys > many-to-many", () => {
|
||||
category2.code = 2;
|
||||
category2.version = 1;
|
||||
category2.description = "category of airplanes";
|
||||
category2.postsWithNonPrimaryColumns = [post3];
|
||||
category2.postsWithNonPKColumns = [post3];
|
||||
await connection.manager.save(category2);
|
||||
|
||||
const loadedCategories = await connection.manager
|
||||
.createQueryBuilder(Category, "category")
|
||||
.leftJoinAndSelect("category.postsWithNonPrimaryColumns", "posts")
|
||||
.leftJoinAndSelect("category.postsWithNonPKColumns", "posts")
|
||||
.orderBy("category.code, posts.id")
|
||||
.getMany();
|
||||
|
||||
expect(loadedCategories[0].postsWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategories[0].postsWithNonPrimaryColumns[0].id).to.be.equal(1);
|
||||
expect(loadedCategories[0].postsWithNonPrimaryColumns[1].id).to.be.equal(2);
|
||||
expect(loadedCategories[1].postsWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategories[1].postsWithNonPrimaryColumns[0].id).to.be.equal(3);
|
||||
expect(loadedCategories[0].postsWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategories[0].postsWithNonPKColumns[0].id).to.be.equal(1);
|
||||
expect(loadedCategories[0].postsWithNonPKColumns[1].id).to.be.equal(2);
|
||||
expect(loadedCategories[1].postsWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategories[1].postsWithNonPKColumns[0].id).to.be.equal(3);
|
||||
|
||||
const loadedCategory = await connection.manager
|
||||
.createQueryBuilder(Category, "category")
|
||||
.leftJoinAndSelect("category.postsWithNonPrimaryColumns", "posts")
|
||||
.leftJoinAndSelect("category.postsWithNonPKColumns", "posts")
|
||||
.orderBy("posts.id")
|
||||
.where("category.code = :code", { code: 1 })
|
||||
.getOne();
|
||||
|
||||
expect(loadedCategory!.postsWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategory!.postsWithNonPrimaryColumns[0].id).to.be.equal(1);
|
||||
expect(loadedCategory!.postsWithNonPrimaryColumns[1].id).to.be.equal(2);
|
||||
expect(loadedCategory!.postsWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategory!.postsWithNonPKColumns[0].id).to.be.equal(1);
|
||||
expect(loadedCategory!.postsWithNonPKColumns[1].id).to.be.equal(2);
|
||||
|
||||
})));
|
||||
|
||||
@ -734,7 +734,7 @@ describe("relations > multiple-primary-keys > many-to-many", () => {
|
||||
category1.code = 1;
|
||||
category1.version = 1;
|
||||
category1.description = "category of cars";
|
||||
category1.tagsWithNonPrimaryColumns = [tag1, tag2];
|
||||
category1.tagsWithNonPKColumns = [tag1, tag2];
|
||||
await connection.manager.save(category1);
|
||||
|
||||
const category2 = new Category();
|
||||
@ -743,34 +743,34 @@ describe("relations > multiple-primary-keys > many-to-many", () => {
|
||||
category2.code = 2;
|
||||
category2.version = 1;
|
||||
category2.description = "category of airplanes";
|
||||
category2.tagsWithNonPrimaryColumns = [tag3];
|
||||
category2.tagsWithNonPKColumns = [tag3];
|
||||
await connection.manager.save(category2);
|
||||
|
||||
const loadedCategories = await connection.manager
|
||||
.createQueryBuilder(Category, "category")
|
||||
.leftJoinAndSelect("category.tagsWithNonPrimaryColumns", "tags")
|
||||
.leftJoinAndSelect("category.tagsWithNonPKColumns", "tags")
|
||||
.orderBy("category.code, tags.code")
|
||||
.getMany();
|
||||
|
||||
expect(loadedCategories[0].tagsWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategories[0].tagsWithNonPrimaryColumns[0].title).to.be.equal("About BMW");
|
||||
expect(loadedCategories[0].tagsWithNonPrimaryColumns[0].description).to.be.equal("Tag about BMW");
|
||||
expect(loadedCategories[0].tagsWithNonPrimaryColumns[1].title).to.be.equal("About Audi");
|
||||
expect(loadedCategories[0].tagsWithNonPrimaryColumns[1].description).to.be.equal("Tag about Audi");
|
||||
expect(loadedCategories[1].tagsWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategories[1].tagsWithNonPrimaryColumns[0].title).to.be.equal("About Boeing");
|
||||
expect(loadedCategories[1].tagsWithNonPrimaryColumns[0].description).to.be.equal("tag about Boeing");
|
||||
expect(loadedCategories[0].tagsWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategories[0].tagsWithNonPKColumns[0].title).to.be.equal("About BMW");
|
||||
expect(loadedCategories[0].tagsWithNonPKColumns[0].description).to.be.equal("Tag about BMW");
|
||||
expect(loadedCategories[0].tagsWithNonPKColumns[1].title).to.be.equal("About Audi");
|
||||
expect(loadedCategories[0].tagsWithNonPKColumns[1].description).to.be.equal("Tag about Audi");
|
||||
expect(loadedCategories[1].tagsWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategories[1].tagsWithNonPKColumns[0].title).to.be.equal("About Boeing");
|
||||
expect(loadedCategories[1].tagsWithNonPKColumns[0].description).to.be.equal("tag about Boeing");
|
||||
|
||||
const loadedCategory = await connection.manager
|
||||
.createQueryBuilder(Category, "category")
|
||||
.leftJoinAndSelect("category.tagsWithNonPrimaryColumns", "tags")
|
||||
.leftJoinAndSelect("category.tagsWithNonPKColumns", "tags")
|
||||
.orderBy("tags.code")
|
||||
.where("category.code = :code", { code: 1 })
|
||||
.getOne();
|
||||
|
||||
expect(loadedCategory!.tagsWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategory!.tagsWithNonPrimaryColumns[0].title).to.be.equal("About BMW");
|
||||
expect(loadedCategory!.tagsWithNonPrimaryColumns[0].description).to.be.equal("Tag about BMW");
|
||||
expect(loadedCategory!.tagsWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategory!.tagsWithNonPKColumns[0].title).to.be.equal("About BMW");
|
||||
expect(loadedCategory!.tagsWithNonPKColumns[0].description).to.be.equal("Tag about BMW");
|
||||
|
||||
})));
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import {Entity} from "../../../../../../src/decorator/entity/Entity";
|
||||
import {PrimaryColumn} from "../../../../../../src/decorator/columns/PrimaryColumn";
|
||||
import {Column} from "../../../../../../src/decorator/columns/Column";
|
||||
import {Index} from "../../../../../../src/decorator/Index";
|
||||
import {OneToMany} from "../../../../../../src/decorator/relations/OneToMany";
|
||||
import {Post} from "./Post";
|
||||
import {Unique} from "../../../../../../src";
|
||||
|
||||
@Entity()
|
||||
@Index(["code", "version", "description"], { unique: true })
|
||||
@Unique(["code", "version", "description"])
|
||||
export class Category {
|
||||
|
||||
@PrimaryColumn()
|
||||
@ -27,13 +27,13 @@ export class Category {
|
||||
@OneToMany(type => Post, post => post.category)
|
||||
posts: Post[];
|
||||
|
||||
@OneToMany(type => Post, post => post.categoryWithEmptyJoinColumn)
|
||||
postsWithEmptyJoinColumn: Post[];
|
||||
@OneToMany(type => Post, post => post.categoryWithJoinColumn)
|
||||
postsWithJoinColumn: Post[];
|
||||
|
||||
@OneToMany(type => Post, post => post.categoryWithOptions)
|
||||
postsWithOptions: Post[];
|
||||
|
||||
@OneToMany(type => Post, post => post.categoryWithNonPrimaryColumns)
|
||||
postsWithNonPrimaryColumns: Post[];
|
||||
@OneToMany(type => Post, post => post.categoryWithNonPKColumns)
|
||||
postsWithNonPKColumns: Post[];
|
||||
|
||||
}
|
||||
@ -19,7 +19,7 @@ export class Post {
|
||||
|
||||
@ManyToOne(type => Category)
|
||||
@JoinColumn()
|
||||
categoryWithEmptyJoinColumn: Category;
|
||||
categoryWithJoinColumn: Category;
|
||||
|
||||
@ManyToOne(type => Category)
|
||||
@JoinColumn([
|
||||
@ -34,6 +34,6 @@ export class Post {
|
||||
{ name: "category_version", referencedColumnName: "version" },
|
||||
{ name: "category_description", referencedColumnName: "description" }
|
||||
])
|
||||
categoryWithNonPrimaryColumns: Category;
|
||||
categoryWithNonPKColumns: Category;
|
||||
|
||||
}
|
||||
@ -85,36 +85,36 @@ describe("relations > multiple-primary-keys > many-to-one", () => {
|
||||
|
||||
const post1 = new Post();
|
||||
post1.title = "About BMW";
|
||||
post1.categoryWithEmptyJoinColumn = category1;
|
||||
post1.categoryWithJoinColumn = category1;
|
||||
await connection.manager.save(post1);
|
||||
|
||||
const post2 = new Post();
|
||||
post2.title = "About Boeing";
|
||||
post2.categoryWithEmptyJoinColumn = category2;
|
||||
post2.categoryWithJoinColumn = category2;
|
||||
await connection.manager.save(post2);
|
||||
|
||||
const loadedPosts = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.leftJoinAndSelect("post.categoryWithEmptyJoinColumn", "category")
|
||||
.leftJoinAndSelect("post.categoryWithJoinColumn", "category")
|
||||
.orderBy("post.id")
|
||||
.getMany();
|
||||
|
||||
expect(loadedPosts[0].categoryWithEmptyJoinColumn).to.not.be.empty;
|
||||
expect(loadedPosts[0].categoryWithEmptyJoinColumn.name).to.be.equal("cars");
|
||||
expect(loadedPosts[0].categoryWithEmptyJoinColumn.type).to.be.equal("common-category");
|
||||
expect(loadedPosts[1].categoryWithEmptyJoinColumn).to.not.be.empty;
|
||||
expect(loadedPosts[1].categoryWithEmptyJoinColumn.name).to.be.equal("airplanes");
|
||||
expect(loadedPosts[1].categoryWithEmptyJoinColumn.type).to.be.equal("common-category");
|
||||
expect(loadedPosts[0].categoryWithJoinColumn).to.not.be.empty;
|
||||
expect(loadedPosts[0].categoryWithJoinColumn.name).to.be.equal("cars");
|
||||
expect(loadedPosts[0].categoryWithJoinColumn.type).to.be.equal("common-category");
|
||||
expect(loadedPosts[1].categoryWithJoinColumn).to.not.be.empty;
|
||||
expect(loadedPosts[1].categoryWithJoinColumn.name).to.be.equal("airplanes");
|
||||
expect(loadedPosts[1].categoryWithJoinColumn.type).to.be.equal("common-category");
|
||||
|
||||
const loadedPost = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.leftJoinAndSelect("post.categoryWithEmptyJoinColumn", "category")
|
||||
.leftJoinAndSelect("post.categoryWithJoinColumn", "category")
|
||||
.where("post.id = :id", {id: 1})
|
||||
.getOne();
|
||||
|
||||
expect(loadedPost!.categoryWithEmptyJoinColumn).to.not.be.empty;
|
||||
expect(loadedPost!.categoryWithEmptyJoinColumn.name).to.be.equal("cars");
|
||||
expect(loadedPost!.categoryWithEmptyJoinColumn.type).to.be.equal("common-category");
|
||||
expect(loadedPost!.categoryWithJoinColumn).to.not.be.empty;
|
||||
expect(loadedPost!.categoryWithJoinColumn.name).to.be.equal("cars");
|
||||
expect(loadedPost!.categoryWithJoinColumn.type).to.be.equal("common-category");
|
||||
|
||||
})));
|
||||
|
||||
@ -189,38 +189,38 @@ describe("relations > multiple-primary-keys > many-to-one", () => {
|
||||
|
||||
const post1 = new Post();
|
||||
post1.title = "About BMW";
|
||||
post1.categoryWithNonPrimaryColumns = category1;
|
||||
post1.categoryWithNonPKColumns = category1;
|
||||
await connection.manager.save(post1);
|
||||
|
||||
const post2 = new Post();
|
||||
post2.title = "About Boeing";
|
||||
post2.categoryWithNonPrimaryColumns = category2;
|
||||
post2.categoryWithNonPKColumns = category2;
|
||||
await connection.manager.save(post2);
|
||||
|
||||
const loadedPosts = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.leftJoinAndSelect("post.categoryWithNonPrimaryColumns", "category")
|
||||
.leftJoinAndSelect("post.categoryWithNonPKColumns", "category")
|
||||
.orderBy("post.id")
|
||||
.getMany();
|
||||
|
||||
expect(loadedPosts[0].categoryWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedPosts[0].categoryWithNonPrimaryColumns.code).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoryWithNonPrimaryColumns.version).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoryWithNonPrimaryColumns.description).to.be.equal("category about cars");
|
||||
expect(loadedPosts[1].categoryWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedPosts[1].categoryWithNonPrimaryColumns.code).to.be.equal(2);
|
||||
expect(loadedPosts[1].categoryWithNonPrimaryColumns.version).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoryWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedPosts[0].categoryWithNonPKColumns.code).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoryWithNonPKColumns.version).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoryWithNonPKColumns.description).to.be.equal("category about cars");
|
||||
expect(loadedPosts[1].categoryWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedPosts[1].categoryWithNonPKColumns.code).to.be.equal(2);
|
||||
expect(loadedPosts[1].categoryWithNonPKColumns.version).to.be.equal(1);
|
||||
|
||||
const loadedPost = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.leftJoinAndSelect("post.categoryWithNonPrimaryColumns", "category")
|
||||
.leftJoinAndSelect("post.categoryWithNonPKColumns", "category")
|
||||
.where("post.id = :id", {id: 1})
|
||||
.getOne();
|
||||
|
||||
expect(loadedPost!.categoryWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedPost!.categoryWithNonPrimaryColumns.code).to.be.equal(1);
|
||||
expect(loadedPost!.categoryWithNonPrimaryColumns.version).to.be.equal(1);
|
||||
expect(loadedPost!.categoryWithNonPrimaryColumns.description).to.be.equal("category about cars");
|
||||
expect(loadedPost!.categoryWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedPost!.categoryWithNonPKColumns.code).to.be.equal(1);
|
||||
expect(loadedPost!.categoryWithNonPKColumns.version).to.be.equal(1);
|
||||
expect(loadedPost!.categoryWithNonPKColumns.description).to.be.equal("category about cars");
|
||||
|
||||
})));
|
||||
});
|
||||
@ -306,7 +306,7 @@ describe("relations > multiple-primary-keys > many-to-one", () => {
|
||||
category1.type = "common-category";
|
||||
category1.code = 1;
|
||||
category1.version = 1;
|
||||
category1.postsWithEmptyJoinColumn = [post1, post2];
|
||||
category1.postsWithJoinColumn = [post1, post2];
|
||||
await connection.manager.save(category1);
|
||||
|
||||
const category2 = new Category();
|
||||
@ -314,36 +314,36 @@ describe("relations > multiple-primary-keys > many-to-one", () => {
|
||||
category2.type = "common-category";
|
||||
category2.code = 2;
|
||||
category2.version = 1;
|
||||
category2.postsWithEmptyJoinColumn = [post3];
|
||||
category2.postsWithJoinColumn = [post3];
|
||||
await connection.manager.save(category2);
|
||||
|
||||
const loadedCategories = await connection.manager
|
||||
.createQueryBuilder(Category, "category")
|
||||
.leftJoinAndSelect("category.postsWithEmptyJoinColumn", "posts")
|
||||
.leftJoinAndSelect("category.postsWithJoinColumn", "posts")
|
||||
.orderBy("category.code, posts.id")
|
||||
.getMany();
|
||||
|
||||
expect(loadedCategories[0].postsWithEmptyJoinColumn).to.not.be.empty;
|
||||
expect(loadedCategories[0].postsWithEmptyJoinColumn[0].id).to.be.equal(1);
|
||||
expect(loadedCategories[0].postsWithEmptyJoinColumn[0].title).to.be.equal("About BMW");
|
||||
expect(loadedCategories[0].postsWithEmptyJoinColumn[1].id).to.be.equal(2);
|
||||
expect(loadedCategories[0].postsWithEmptyJoinColumn[1].title).to.be.equal("About Audi");
|
||||
expect(loadedCategories[1].postsWithEmptyJoinColumn).to.not.be.empty;
|
||||
expect(loadedCategories[1].postsWithEmptyJoinColumn[0].id).to.be.equal(3);
|
||||
expect(loadedCategories[1].postsWithEmptyJoinColumn[0].title).to.be.equal("About Boeing");
|
||||
expect(loadedCategories[0].postsWithJoinColumn).to.not.be.empty;
|
||||
expect(loadedCategories[0].postsWithJoinColumn[0].id).to.be.equal(1);
|
||||
expect(loadedCategories[0].postsWithJoinColumn[0].title).to.be.equal("About BMW");
|
||||
expect(loadedCategories[0].postsWithJoinColumn[1].id).to.be.equal(2);
|
||||
expect(loadedCategories[0].postsWithJoinColumn[1].title).to.be.equal("About Audi");
|
||||
expect(loadedCategories[1].postsWithJoinColumn).to.not.be.empty;
|
||||
expect(loadedCategories[1].postsWithJoinColumn[0].id).to.be.equal(3);
|
||||
expect(loadedCategories[1].postsWithJoinColumn[0].title).to.be.equal("About Boeing");
|
||||
|
||||
const loadedCategory = await connection.manager
|
||||
.createQueryBuilder(Category, "category")
|
||||
.leftJoinAndSelect("category.postsWithEmptyJoinColumn", "posts")
|
||||
.leftJoinAndSelect("category.postsWithJoinColumn", "posts")
|
||||
.orderBy("posts.id")
|
||||
.where("category.code = :code", {code: 1})
|
||||
.getOne();
|
||||
|
||||
expect(loadedCategory!.postsWithEmptyJoinColumn).to.not.be.empty;
|
||||
expect(loadedCategory!.postsWithEmptyJoinColumn[0].id).to.be.equal(1);
|
||||
expect(loadedCategory!.postsWithEmptyJoinColumn[0].title).to.be.equal("About BMW");
|
||||
expect(loadedCategory!.postsWithEmptyJoinColumn[1].id).to.be.equal(2);
|
||||
expect(loadedCategory!.postsWithEmptyJoinColumn[1].title).to.be.equal("About Audi");
|
||||
expect(loadedCategory!.postsWithJoinColumn).to.not.be.empty;
|
||||
expect(loadedCategory!.postsWithJoinColumn[0].id).to.be.equal(1);
|
||||
expect(loadedCategory!.postsWithJoinColumn[0].title).to.be.equal("About BMW");
|
||||
expect(loadedCategory!.postsWithJoinColumn[1].id).to.be.equal(2);
|
||||
expect(loadedCategory!.postsWithJoinColumn[1].title).to.be.equal("About Audi");
|
||||
|
||||
})));
|
||||
|
||||
@ -427,7 +427,7 @@ describe("relations > multiple-primary-keys > many-to-one", () => {
|
||||
category1.code = 1;
|
||||
category1.version = 1;
|
||||
category1.description = "category of cars";
|
||||
category1.postsWithNonPrimaryColumns = [post1, post2];
|
||||
category1.postsWithNonPKColumns = [post1, post2];
|
||||
await connection.manager.save(category1);
|
||||
|
||||
const category2 = new Category();
|
||||
@ -436,36 +436,36 @@ describe("relations > multiple-primary-keys > many-to-one", () => {
|
||||
category2.code = 2;
|
||||
category2.version = 1;
|
||||
category2.description = "category of airplanes";
|
||||
category2.postsWithNonPrimaryColumns = [post3];
|
||||
category2.postsWithNonPKColumns = [post3];
|
||||
await connection.manager.save(category2);
|
||||
|
||||
const loadedCategories = await connection.manager
|
||||
.createQueryBuilder(Category, "category")
|
||||
.leftJoinAndSelect("category.postsWithNonPrimaryColumns", "posts")
|
||||
.leftJoinAndSelect("category.postsWithNonPKColumns", "posts")
|
||||
.orderBy("category.code, posts.id")
|
||||
.getMany();
|
||||
|
||||
expect(loadedCategories[0].postsWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategories[0].postsWithNonPrimaryColumns[0].id).to.be.equal(1);
|
||||
expect(loadedCategories[0].postsWithNonPrimaryColumns[0].title).to.be.equal("About BMW");
|
||||
expect(loadedCategories[0].postsWithNonPrimaryColumns[1].id).to.be.equal(2);
|
||||
expect(loadedCategories[0].postsWithNonPrimaryColumns[1].title).to.be.equal("About Audi");
|
||||
expect(loadedCategories[1].postsWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategories[1].postsWithNonPrimaryColumns[0].id).to.be.equal(3);
|
||||
expect(loadedCategories[1].postsWithNonPrimaryColumns[0].title).to.be.equal("About Boeing");
|
||||
expect(loadedCategories[0].postsWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategories[0].postsWithNonPKColumns[0].id).to.be.equal(1);
|
||||
expect(loadedCategories[0].postsWithNonPKColumns[0].title).to.be.equal("About BMW");
|
||||
expect(loadedCategories[0].postsWithNonPKColumns[1].id).to.be.equal(2);
|
||||
expect(loadedCategories[0].postsWithNonPKColumns[1].title).to.be.equal("About Audi");
|
||||
expect(loadedCategories[1].postsWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategories[1].postsWithNonPKColumns[0].id).to.be.equal(3);
|
||||
expect(loadedCategories[1].postsWithNonPKColumns[0].title).to.be.equal("About Boeing");
|
||||
|
||||
const loadedCategory = await connection.manager
|
||||
.createQueryBuilder(Category, "category")
|
||||
.leftJoinAndSelect("category.postsWithNonPrimaryColumns", "posts")
|
||||
.leftJoinAndSelect("category.postsWithNonPKColumns", "posts")
|
||||
.orderBy("posts.id")
|
||||
.where("category.code = :code", {code: 1})
|
||||
.getOne();
|
||||
|
||||
expect(loadedCategory!.postsWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategory!.postsWithNonPrimaryColumns[0].id).to.be.equal(1);
|
||||
expect(loadedCategory!.postsWithNonPrimaryColumns[0].title).to.be.equal("About BMW");
|
||||
expect(loadedCategory!.postsWithNonPrimaryColumns[1].id).to.be.equal(2);
|
||||
expect(loadedCategory!.postsWithNonPrimaryColumns[1].title).to.be.equal("About Audi");
|
||||
expect(loadedCategory!.postsWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategory!.postsWithNonPKColumns[0].id).to.be.equal(1);
|
||||
expect(loadedCategory!.postsWithNonPKColumns[0].title).to.be.equal("About BMW");
|
||||
expect(loadedCategory!.postsWithNonPKColumns[1].id).to.be.equal(2);
|
||||
expect(loadedCategory!.postsWithNonPKColumns[1].title).to.be.equal("About Audi");
|
||||
|
||||
})));
|
||||
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import {Entity} from "../../../../../../src/decorator/entity/Entity";
|
||||
import {PrimaryColumn} from "../../../../../../src/decorator/columns/PrimaryColumn";
|
||||
import {Column} from "../../../../../../src/decorator/columns/Column";
|
||||
import {Index} from "../../../../../../src/decorator/Index";
|
||||
import {OneToOne} from "../../../../../../src/decorator/relations/OneToOne";
|
||||
import {Post} from "./Post";
|
||||
import {Tag} from "./Tag";
|
||||
import {Unique} from "../../../../../../src";
|
||||
|
||||
@Entity()
|
||||
@Index(["code", "version", "description"], { unique: true })
|
||||
@Unique(["code", "version", "description"])
|
||||
export class Category {
|
||||
|
||||
@PrimaryColumn()
|
||||
@ -31,8 +31,8 @@ export class Category {
|
||||
@OneToOne(type => Post, post => post.categoryWithOptions)
|
||||
postWithOptions: Post;
|
||||
|
||||
@OneToOne(type => Post, post => post.categoryWithNonPrimaryColumns)
|
||||
postWithNonPrimaryColumns: Post;
|
||||
@OneToOne(type => Post, post => post.categoryWithNonPKColumns)
|
||||
postWithNonPKColumns: Post;
|
||||
|
||||
@OneToOne(type => Tag, tag => tag.category)
|
||||
tag: Tag;
|
||||
@ -40,7 +40,7 @@ export class Category {
|
||||
@OneToOne(type => Tag, tag => tag.categoryWithOptions)
|
||||
tagWithOptions: Tag;
|
||||
|
||||
@OneToOne(type => Tag, tag => tag.categoryWithNonPrimaryColumns)
|
||||
tagWithNonPrimaryColumns: Tag;
|
||||
@OneToOne(type => Tag, tag => tag.categoryWithNonPKColumns)
|
||||
tagWithNonPKColumns: Tag;
|
||||
|
||||
}
|
||||
@ -25,12 +25,12 @@ export class Post {
|
||||
])
|
||||
categoryWithOptions: Category;
|
||||
|
||||
@OneToOne(type => Category, category => category.postWithNonPrimaryColumns)
|
||||
@OneToOne(type => Category, category => category.postWithNonPKColumns)
|
||||
@JoinColumn([
|
||||
{ name: "category_code", referencedColumnName: "code" },
|
||||
{ name: "category_version", referencedColumnName: "version" },
|
||||
{ name: "category_description", referencedColumnName: "description" }
|
||||
])
|
||||
categoryWithNonPrimaryColumns: Category;
|
||||
categoryWithNonPKColumns: Category;
|
||||
|
||||
}
|
||||
@ -28,12 +28,12 @@ export class Tag {
|
||||
])
|
||||
categoryWithOptions: Category;
|
||||
|
||||
@OneToOne(type => Category, category => category.tagWithNonPrimaryColumns)
|
||||
@OneToOne(type => Category, category => category.tagWithNonPKColumns)
|
||||
@JoinColumn([
|
||||
{ name: "category_code", referencedColumnName: "code" },
|
||||
{ name: "category_version", referencedColumnName: "version" },
|
||||
{ name: "category_description", referencedColumnName: "description" }
|
||||
])
|
||||
categoryWithNonPrimaryColumns: Category;
|
||||
categoryWithNonPKColumns: Category;
|
||||
|
||||
}
|
||||
@ -139,38 +139,38 @@ describe("relations > multiple-primary-keys > one-to-one", () => {
|
||||
|
||||
const post1 = new Post();
|
||||
post1.title = "About cars #1";
|
||||
post1.categoryWithNonPrimaryColumns = category1;
|
||||
post1.categoryWithNonPKColumns = category1;
|
||||
await connection.manager.save(post1);
|
||||
|
||||
const post2 = new Post();
|
||||
post2.title = "About cars #2";
|
||||
post2.categoryWithNonPrimaryColumns = category2;
|
||||
post2.categoryWithNonPKColumns = category2;
|
||||
await connection.manager.save(post2);
|
||||
|
||||
const loadedPosts = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.leftJoinAndSelect("post.categoryWithNonPrimaryColumns", "category")
|
||||
.leftJoinAndSelect("post.categoryWithNonPKColumns", "category")
|
||||
.orderBy("post.id")
|
||||
.getMany();
|
||||
|
||||
expect(loadedPosts[0].categoryWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedPosts[0].categoryWithNonPrimaryColumns.code).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoryWithNonPrimaryColumns.version).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoryWithNonPrimaryColumns.description).to.be.equal("category about cars");
|
||||
expect(loadedPosts[1].categoryWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedPosts[1].categoryWithNonPrimaryColumns.code).to.be.equal(2);
|
||||
expect(loadedPosts[1].categoryWithNonPrimaryColumns.version).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoryWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedPosts[0].categoryWithNonPKColumns.code).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoryWithNonPKColumns.version).to.be.equal(1);
|
||||
expect(loadedPosts[0].categoryWithNonPKColumns.description).to.be.equal("category about cars");
|
||||
expect(loadedPosts[1].categoryWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedPosts[1].categoryWithNonPKColumns.code).to.be.equal(2);
|
||||
expect(loadedPosts[1].categoryWithNonPKColumns.version).to.be.equal(1);
|
||||
|
||||
const loadedPost = await connection.manager
|
||||
.createQueryBuilder(Post, "post")
|
||||
.leftJoinAndSelect("post.categoryWithNonPrimaryColumns", "category")
|
||||
.leftJoinAndSelect("post.categoryWithNonPKColumns", "category")
|
||||
.where("post.id = :id", { id: 1 })
|
||||
.getOne();
|
||||
|
||||
expect(loadedPost!.categoryWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedPost!.categoryWithNonPrimaryColumns.code).to.be.equal(1);
|
||||
expect(loadedPost!.categoryWithNonPrimaryColumns.version).to.be.equal(1);
|
||||
expect(loadedPost!.categoryWithNonPrimaryColumns.description).to.be.equal("category about cars");
|
||||
expect(loadedPost!.categoryWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedPost!.categoryWithNonPKColumns.code).to.be.equal(1);
|
||||
expect(loadedPost!.categoryWithNonPKColumns.version).to.be.equal(1);
|
||||
expect(loadedPost!.categoryWithNonPKColumns.description).to.be.equal("category about cars");
|
||||
|
||||
})));
|
||||
|
||||
@ -308,39 +308,39 @@ describe("relations > multiple-primary-keys > one-to-one", () => {
|
||||
tag1.code = 1;
|
||||
tag1.title = "About BMW";
|
||||
tag1.description = "Tag about BMW";
|
||||
tag1.categoryWithNonPrimaryColumns = category1;
|
||||
tag1.categoryWithNonPKColumns = category1;
|
||||
await connection.manager.save(tag1);
|
||||
|
||||
const tag2 = new Tag();
|
||||
tag2.code = 3;
|
||||
tag2.title = "About Boeing";
|
||||
tag2.description = "tag about Boeing";
|
||||
tag2.categoryWithNonPrimaryColumns = category2;
|
||||
tag2.categoryWithNonPKColumns = category2;
|
||||
await connection.manager.save(tag2);
|
||||
|
||||
const loadedTags = await connection.manager
|
||||
.createQueryBuilder(Tag, "tag")
|
||||
.leftJoinAndSelect("tag.categoryWithNonPrimaryColumns", "category")
|
||||
.leftJoinAndSelect("tag.categoryWithNonPKColumns", "category")
|
||||
.orderBy("tag.code, category.code")
|
||||
.getMany();
|
||||
|
||||
expect(loadedTags[0].categoryWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedTags[0].categoryWithNonPrimaryColumns.name).to.be.equal("cars");
|
||||
expect(loadedTags[0].categoryWithNonPrimaryColumns.type).to.be.equal("common-category");
|
||||
expect(loadedTags[1].categoryWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedTags[1].categoryWithNonPrimaryColumns.name).to.be.equal("airplanes");
|
||||
expect(loadedTags[1].categoryWithNonPrimaryColumns.type).to.be.equal("common-category");
|
||||
expect(loadedTags[0].categoryWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedTags[0].categoryWithNonPKColumns.name).to.be.equal("cars");
|
||||
expect(loadedTags[0].categoryWithNonPKColumns.type).to.be.equal("common-category");
|
||||
expect(loadedTags[1].categoryWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedTags[1].categoryWithNonPKColumns.name).to.be.equal("airplanes");
|
||||
expect(loadedTags[1].categoryWithNonPKColumns.type).to.be.equal("common-category");
|
||||
|
||||
const loadedTag = await connection.manager
|
||||
.createQueryBuilder(Tag, "tag")
|
||||
.leftJoinAndSelect("tag.categoryWithNonPrimaryColumns", "category")
|
||||
.leftJoinAndSelect("tag.categoryWithNonPKColumns", "category")
|
||||
.orderBy("category.code")
|
||||
.where("tag.code = :code", { code: 1 })
|
||||
.getOne();
|
||||
|
||||
expect(loadedTag!.categoryWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedTag!.categoryWithNonPrimaryColumns.name).to.be.equal("cars");
|
||||
expect(loadedTag!.categoryWithNonPrimaryColumns.type).to.be.equal("common-category");
|
||||
expect(loadedTag!.categoryWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedTag!.categoryWithNonPKColumns.name).to.be.equal("cars");
|
||||
expect(loadedTag!.categoryWithNonPKColumns.type).to.be.equal("common-category");
|
||||
|
||||
})));
|
||||
|
||||
@ -529,7 +529,7 @@ describe("relations > multiple-primary-keys > one-to-one", () => {
|
||||
category1.code = 1;
|
||||
category1.version = 1;
|
||||
category1.description = "category of cars";
|
||||
category1.tagWithNonPrimaryColumns = tag1;
|
||||
category1.tagWithNonPKColumns = tag1;
|
||||
await connection.manager.save(category1);
|
||||
|
||||
const category2 = new Category();
|
||||
@ -538,32 +538,32 @@ describe("relations > multiple-primary-keys > one-to-one", () => {
|
||||
category2.code = 2;
|
||||
category2.version = 1;
|
||||
category2.description = "category of airplanes";
|
||||
category2.tagWithNonPrimaryColumns = tag2;
|
||||
category2.tagWithNonPKColumns = tag2;
|
||||
await connection.manager.save(category2);
|
||||
|
||||
const loadedCategories = await connection.manager
|
||||
.createQueryBuilder(Category, "category")
|
||||
.leftJoinAndSelect("category.tagWithNonPrimaryColumns", "tag")
|
||||
.leftJoinAndSelect("category.tagWithNonPKColumns", "tag")
|
||||
.orderBy("category.code, tag.code")
|
||||
.getMany();
|
||||
|
||||
expect(loadedCategories[0].tagWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategories[0].tagWithNonPrimaryColumns.title).to.be.equal("About BMW");
|
||||
expect(loadedCategories[0].tagWithNonPrimaryColumns.description).to.be.equal("Tag about BMW");
|
||||
expect(loadedCategories[1].tagWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategories[1].tagWithNonPrimaryColumns.title).to.be.equal("About Boeing");
|
||||
expect(loadedCategories[1].tagWithNonPrimaryColumns.description).to.be.equal("tag about Boeing");
|
||||
expect(loadedCategories[0].tagWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategories[0].tagWithNonPKColumns.title).to.be.equal("About BMW");
|
||||
expect(loadedCategories[0].tagWithNonPKColumns.description).to.be.equal("Tag about BMW");
|
||||
expect(loadedCategories[1].tagWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategories[1].tagWithNonPKColumns.title).to.be.equal("About Boeing");
|
||||
expect(loadedCategories[1].tagWithNonPKColumns.description).to.be.equal("tag about Boeing");
|
||||
|
||||
const loadedCategory = await connection.manager
|
||||
.createQueryBuilder(Category, "category")
|
||||
.leftJoinAndSelect("category.tagWithNonPrimaryColumns", "tag")
|
||||
.leftJoinAndSelect("category.tagWithNonPKColumns", "tag")
|
||||
.orderBy("tag.code")
|
||||
.where("category.code = :code", { code: 1 })
|
||||
.getOne();
|
||||
|
||||
expect(loadedCategory!.tagWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategory!.tagWithNonPrimaryColumns.title).to.be.equal("About BMW");
|
||||
expect(loadedCategory!.tagWithNonPrimaryColumns.description).to.be.equal("Tag about BMW");
|
||||
expect(loadedCategory!.tagWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategory!.tagWithNonPKColumns.title).to.be.equal("About BMW");
|
||||
expect(loadedCategory!.tagWithNonPKColumns.description).to.be.equal("Tag about BMW");
|
||||
|
||||
})));
|
||||
|
||||
@ -643,7 +643,7 @@ describe("relations > multiple-primary-keys > one-to-one", () => {
|
||||
category1.code = 1;
|
||||
category1.version = 1;
|
||||
category1.description = "category of cars";
|
||||
category1.tagWithNonPrimaryColumns = tag1;
|
||||
category1.tagWithNonPKColumns = tag1;
|
||||
await connection.manager.save(category1);
|
||||
|
||||
const category2 = new Category();
|
||||
@ -652,32 +652,32 @@ describe("relations > multiple-primary-keys > one-to-one", () => {
|
||||
category2.code = 2;
|
||||
category2.version = 1;
|
||||
category2.description = "category of airplanes";
|
||||
category2.tagWithNonPrimaryColumns = tag2;
|
||||
category2.tagWithNonPKColumns = tag2;
|
||||
await connection.manager.save(category2);
|
||||
|
||||
const loadedCategories = await connection.manager
|
||||
.createQueryBuilder(Category, "category")
|
||||
.leftJoinAndSelect("category.tagWithNonPrimaryColumns", "tag")
|
||||
.leftJoinAndSelect("category.tagWithNonPKColumns", "tag")
|
||||
.orderBy("category.code, tag.code")
|
||||
.getMany();
|
||||
|
||||
expect(loadedCategories[0].tagWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategories[0].tagWithNonPrimaryColumns.title).to.be.equal("About BMW");
|
||||
expect(loadedCategories[0].tagWithNonPrimaryColumns.description).to.be.equal("Tag about BMW");
|
||||
expect(loadedCategories[1].tagWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategories[1].tagWithNonPrimaryColumns.title).to.be.equal("About Boeing");
|
||||
expect(loadedCategories[1].tagWithNonPrimaryColumns.description).to.be.equal("tag about Boeing");
|
||||
expect(loadedCategories[0].tagWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategories[0].tagWithNonPKColumns.title).to.be.equal("About BMW");
|
||||
expect(loadedCategories[0].tagWithNonPKColumns.description).to.be.equal("Tag about BMW");
|
||||
expect(loadedCategories[1].tagWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategories[1].tagWithNonPKColumns.title).to.be.equal("About Boeing");
|
||||
expect(loadedCategories[1].tagWithNonPKColumns.description).to.be.equal("tag about Boeing");
|
||||
|
||||
const loadedCategory = await connection.manager
|
||||
.createQueryBuilder(Category, "category")
|
||||
.leftJoinAndSelect("category.tagWithNonPrimaryColumns", "tag")
|
||||
.leftJoinAndSelect("category.tagWithNonPKColumns", "tag")
|
||||
.orderBy("tag.code")
|
||||
.where("category.code = :code", { code: 1 })
|
||||
.getOne();
|
||||
|
||||
expect(loadedCategory!.tagWithNonPrimaryColumns).to.not.be.empty;
|
||||
expect(loadedCategory!.tagWithNonPrimaryColumns.title).to.be.equal("About BMW");
|
||||
expect(loadedCategory!.tagWithNonPrimaryColumns.description).to.be.equal("Tag about BMW");
|
||||
expect(loadedCategory!.tagWithNonPKColumns).to.not.be.empty;
|
||||
expect(loadedCategory!.tagWithNonPKColumns.title).to.be.equal("About BMW");
|
||||
expect(loadedCategory!.tagWithNonPKColumns.description).to.be.equal("Tag about BMW");
|
||||
|
||||
})));
|
||||
|
||||
|
||||
@ -376,7 +376,9 @@ describe("repository > basic methods", () => {
|
||||
}
|
||||
await Promise.all(promises);
|
||||
// such simple query should work on all platforms, isn't it? If no - make requests specifically to platforms
|
||||
const result = await repository.query("SELECT MAX(blog.counter) as max from blog blog");
|
||||
const query = `SELECT MAX(${connection.driver.escape("blog")}.${connection.driver.escape("counter")}) as ${connection.driver.escape("max")} ` +
|
||||
` FROM ${connection.driver.escape("blog")} ${connection.driver.escape("blog")}`;
|
||||
const result = await repository.query(query);
|
||||
result[0].should.not.be.empty;
|
||||
result[0].max.should.not.be.empty;
|
||||
})));
|
||||
|
||||
@ -18,13 +18,13 @@ export class Photo {
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column("text")
|
||||
@Column()
|
||||
description: string;
|
||||
|
||||
@Column()
|
||||
filename: string;
|
||||
|
||||
@Column("int")
|
||||
@Column()
|
||||
views: number;
|
||||
|
||||
@Column()
|
||||
|
||||
@ -4,7 +4,7 @@ import {Post} from "./entity/Post";
|
||||
import {Connection} from "../../../src/connection/Connection";
|
||||
import {createTestingConnections} from "../../utils/test-utils";
|
||||
|
||||
describe("sqljs driver > autosave", () => {
|
||||
describe.skip("sqljs driver > autosave", () => {
|
||||
let connections: Connection[];
|
||||
let saves = 0;
|
||||
const callback = (database: Uint8Array) => {
|
||||
|
||||
@ -8,7 +8,7 @@ import {Specialization} from "./Specialization";
|
||||
export class Teacher extends Employee {
|
||||
|
||||
@ManyToMany(type => Specialization, specialization => specialization.teachers)
|
||||
@JoinTable()
|
||||
@JoinTable({ name: "person_specs" })
|
||||
specializations: Specialization[];
|
||||
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ describe("transaction > single query runner", () => {
|
||||
await entityManager.queryRunner!.startTransaction();
|
||||
const loadedPost4 = await entityManager.findOne(Post, { title: "Hello World" });
|
||||
expect(loadedPost4).to.be.eql({ id: 1, title: "Hello World" });
|
||||
await entityManager.query(`DELETE FROM post`);
|
||||
await entityManager.query(`DELETE FROM ${connection.driver.escape("post")}`);
|
||||
const loadedPost5 = await entityManager.findOne(Post, { title: "Hello World" });
|
||||
expect(loadedPost5).to.be.undefined;
|
||||
await entityManager.queryRunner!.rollbackTransaction();
|
||||
|
||||
@ -2,32 +2,27 @@ import "reflect-metadata";
|
||||
import { closeTestingConnections, createTestingConnections, reloadTestingDatabases } from "../../utils/test-utils";
|
||||
import { Connection } from "../../../src/connection/Connection";
|
||||
import { EntityMetadata } from "../../../src/metadata/EntityMetadata";
|
||||
import { Person } from "./entity/person";
|
||||
|
||||
import { Person } from "./entities/person";
|
||||
|
||||
describe.skip("indices > create schema", () => {
|
||||
describe("github issues > #197 Fails to drop indexes when removing fields", () => {
|
||||
|
||||
let connections: Connection[];
|
||||
before(async () => connections = await createTestingConnections({
|
||||
entities: [Person],
|
||||
entities: [__dirname + "/entity/*{.js,.ts}"],
|
||||
schemaCreate: false,
|
||||
}));
|
||||
beforeEach(() => reloadTestingDatabases(connections));
|
||||
after(() => closeTestingConnections(connections));
|
||||
|
||||
describe("build schema", function () {
|
||||
it("it should drop the column and the referenced index", () => Promise.all(connections.map(async connection => {
|
||||
|
||||
it("it should drop the column and the referenced index", () => Promise.all(connections.map(async connection => {
|
||||
let entityMetadata: EntityMetadata = connection.getMetadata(Person);
|
||||
let idx: number = entityMetadata.columns.findIndex(x => x.databaseName === "firstname");
|
||||
entityMetadata.columns.splice(idx, 1);
|
||||
entityMetadata.indices = []; // clear the referenced index from metadata too
|
||||
|
||||
let entityMetadata: EntityMetadata = connection.getMetadata(Person);
|
||||
let idx: number = entityMetadata.columns.findIndex(x => x.databaseName === "firstname");
|
||||
entityMetadata.columns.splice(idx, 1);
|
||||
entityMetadata.indices = []; // clear the referenced index from metadata too
|
||||
|
||||
await connection.synchronize(false);
|
||||
await connection.synchronize(false);
|
||||
})));
|
||||
|
||||
})));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@ -5,7 +5,7 @@ import {Post} from "./entity/Post";
|
||||
import {Category} from "./entity/Category";
|
||||
import {expect} from "chai";
|
||||
|
||||
describe.skip("github issues > OneToOne relation with referencedColumnName does not work", () => {
|
||||
describe("github issues > OneToOne relation with referencedColumnName does not work", () => {
|
||||
|
||||
let connections: Connection[];
|
||||
before(async () => connections = await createTestingConnections({
|
||||
|
||||
@ -5,7 +5,6 @@ import {Index} from "../../../../src/decorator/Index";
|
||||
import {ManyToOne} from "../../../../src/decorator/relations/ManyToOne";
|
||||
import {Tag} from "./Tag";
|
||||
|
||||
@Index(["tag", "c", "b", "a"])
|
||||
@Index(["a", "b", "c", "tag"])
|
||||
@Index(["b", "tag", "c"])
|
||||
@Index(["c", "a"])
|
||||
|
||||
@ -2,11 +2,12 @@ import "reflect-metadata";
|
||||
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../utils/test-utils";
|
||||
import {Connection} from "../../../src/connection/Connection";
|
||||
|
||||
describe.skip("github issues > #587 Ordering of fields in composite indexes defined using Index decorator", () => {
|
||||
describe("github issues > #587 Ordering of fields in composite indexes defined using Index decorator", () => {
|
||||
|
||||
let connections: Connection[];
|
||||
before(async () => connections = await createTestingConnections({
|
||||
entities: [__dirname + "/entity/*{.js,.ts}"],
|
||||
enabledDrivers: ["mysql"]
|
||||
}));
|
||||
beforeEach(() => reloadTestingDatabases(connections));
|
||||
after(() => closeTestingConnections(connections));
|
||||
|
||||
@ -38,7 +38,7 @@ describe.skip("github issues > #838 Time zones for timestamp columns are incorre
|
||||
const testDate = new Date(testDateString);
|
||||
await postgresConnection.manager.save(new Flight(1, testDate));
|
||||
|
||||
const results = await postgresConnection.query(`SELECT date FROM "flight" WHERE id = 1`);
|
||||
const results = await postgresConnection.query(`SELECT "date" FROM "flight" WHERE id = 1`);
|
||||
|
||||
expect(results[0].date.toISOString()).to.equal(testDate.toISOString());
|
||||
|
||||
|
||||
4
test/testSetup.ts
Normal file
4
test/testSetup.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import * as chai from "chai";
|
||||
chai.should();
|
||||
chai.use(require("sinon-chai"));
|
||||
chai.use(require("chai-as-promised"));
|
||||
Loading…
x
Reference in New Issue
Block a user