Skip to content

Commit

Permalink
Bugfixed .insert() not inferring table name... good thing I test in p…
Browse files Browse the repository at this point in the history
…roduction, updated version for release
  • Loading branch information
theianjohnson committed Nov 19, 2023
1 parent cde482b commit 3e5cf72
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class Model {
return __awaiter(this, void 0, void 0, function* () {
const constructor = this.constructor;
if (!this.tableName) {
this.tableName = constructor.tableName;
this.tableName = constructor.tableName || `${constructor.name.toLowerCase()}s`;
}
const now = new Date().toISOString();
const fields = Object.keys(data).filter(key => !this.__private.clauses.withRelations.includes(key) && !['__private', 'casts', 'tableName', 'withTimestamps', 'createdAtColumn', 'updatedAtColumn'].includes(key));
Expand Down
2 changes: 1 addition & 1 deletion dist/Model.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expo-sqlite-eloquent-orm",
"version": "0.9.12",
"version": "0.9.13",
"description": "An Expo SQLite ORM",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class Model {
const constructor = this.constructor as typeof Model;

if (!this.tableName) {
this.tableName = constructor.tableName;
this.tableName = constructor.tableName || `${constructor.name.toLowerCase()}s`;
}

const now = new Date().toISOString();
Expand Down

0 comments on commit 3e5cf72

Please sign in to comment.