@zuzjs/orm 0.1.8 → 0.1.9

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.
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.MySqlDriver = exports.MySQLErrorMap = exports.parseConnectionString = void 0;
7
- const promise_1 = __importDefault(require("mysql2/promise"));
8
7
  const fs_1 = __importDefault(require("fs"));
8
+ const promise_1 = __importDefault(require("mysql2/promise"));
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const picocolors_1 = __importDefault(require("picocolors"));
11
11
  const index_js_1 = require("../../core/index.js");
@@ -152,7 +152,6 @@ class MySqlDriver {
152
152
  const imports = [];
153
153
  const _imports = [`Entity`, `BaseEntity`];
154
154
  // Get table structure
155
- // const [columns]: [any[], any] = await self.pool!.execute(`DESCRIBE ${tableName}`);
156
155
  const [columns] = await this.pool.execute(`SELECT COLUMN_NAME as \`Field\`, COLUMN_TYPE as \`Type\`, COLUMN_KEY as \`Key\`, IS_NULLABLE as \`Null\`, COLUMN_DEFAULT as \`Default\`, EXTRA as \`Extra\`, COLUMN_COMMENT as \`Comment\`
157
156
  FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ? ORDER BY ORDINAL_POSITION ASC`, [this.conn.database, tableName]);
158
157
  const entityCode = [];
@@ -187,7 +186,7 @@ class MySqlDriver {
187
186
  if (Comment && Comment.length > 0) {
188
187
  entityCode.push(`\t/** @comment ${Comment} */`);
189
188
  }
190
- entityCode.push(`\t${Field}!: ${tsType};\n`);
189
+ entityCode.push(`\t${Field}!: ${Key == `PRI` && [`int`, `bigint`].includes(Type) ? `number` : tsType};\n`);
191
190
  }
192
191
  // Add foreign key relationships
193
192
  if (foreignKeys[tableName]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuzjs/orm",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "keywords": [
5
5
  "orm",
6
6
  "zuz",