@tylix/orm 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tylix/orm",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "test": "node --test src/**/*.test.js"
17
17
  },
18
18
  "dependencies": {
19
- "@tylix/shared": "^0.4.0",
19
+ "@tylix/shared": "^0.5.0",
20
20
  "mongodb": "^6.5.0",
21
21
  "mysql2": "^3.23.1",
22
22
  "pg": "^8.11.0"
@@ -5,6 +5,8 @@ const COLUMN_TYPES = {
5
5
  increments: 'INT AUTO_INCREMENT PRIMARY KEY',
6
6
  string: 'VARCHAR(255)',
7
7
  text: 'TEXT',
8
+ mediumText: 'MEDIUMTEXT',
9
+ longText: 'LONGTEXT',
8
10
  boolean: 'TINYINT(1)',
9
11
  integer: 'INT',
10
12
  date: 'DATE',
@@ -29,10 +31,19 @@ export class MysqlAdapter extends DatabaseAdapter {
29
31
  this.connection = null
30
32
  }
31
33
 
32
- async connect() {
33
- this.connection = await mysql.createConnection(this.config)
34
- return this
35
- }
34
+ async connect() {
35
+ this.connection = mysql.createPool({
36
+ ...this.config,
37
+ waitForConnections: true,
38
+ connectionLimit: 10,
39
+ queueLimit: 0,
40
+ enableKeepAlive: true,
41
+ keepAliveInitialDelay: 10000,
42
+ })
43
+ const conn = await this.connection.getConnection() // fail fast on bad credentials
44
+ conn.release()
45
+ return this
46
+ }
36
47
 
37
48
  async close() {
38
49
  if (this.connection) {
@@ -108,4 +119,4 @@ export class MysqlAdapter extends DatabaseAdapter {
108
119
  }
109
120
  return sql
110
121
  }
111
- }
122
+ }