sqlmorpheus 0.2.3 → 0.2.4

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/dist/index.js CHANGED
@@ -187,7 +187,7 @@ var TableStructureGenerator = class {
187
187
  } else {
188
188
  const classTable = table;
189
189
  structure = getTableStructure(classTable);
190
- tables[classTable.name] = getTableStructure(classTable);
190
+ tables[classTable.name] = structure;
191
191
  }
192
192
  for (const key in structure.columns) {
193
193
  const entry = structure.columns[key];
@@ -988,12 +988,15 @@ function TableClass(tableName, primaryKey) {
988
988
  foreignKey.toTable = tableName;
989
989
  }
990
990
  }
991
- for (const key in table) {
992
- const value = table[key];
991
+ const obj = new table();
992
+ for (const key in obj) {
993
+ const value = obj[key];
993
994
  const existingEntry = tableStructure.columns[key];
994
995
  const defaultEntry = TableObj.getColumnEntry(key, value);
995
996
  if (!defaultEntry)
996
997
  continue;
998
+ if (key == primaryKey)
999
+ defaultEntry.isPrimaryKey = true;
997
1000
  tableStructure.columns[key] = {
998
1001
  ...defaultEntry,
999
1002
  ...existingEntry
package/dist/index.mjs CHANGED
@@ -153,7 +153,7 @@ var TableStructureGenerator = class {
153
153
  } else {
154
154
  const classTable = table;
155
155
  structure = getTableStructure(classTable);
156
- tables[classTable.name] = getTableStructure(classTable);
156
+ tables[classTable.name] = structure;
157
157
  }
158
158
  for (const key in structure.columns) {
159
159
  const entry = structure.columns[key];
@@ -954,12 +954,15 @@ function TableClass(tableName, primaryKey) {
954
954
  foreignKey.toTable = tableName;
955
955
  }
956
956
  }
957
- for (const key in table) {
958
- const value = table[key];
957
+ const obj = new table();
958
+ for (const key in obj) {
959
+ const value = obj[key];
959
960
  const existingEntry = tableStructure.columns[key];
960
961
  const defaultEntry = TableObj.getColumnEntry(key, value);
961
962
  if (!defaultEntry)
962
963
  continue;
964
+ if (key == primaryKey)
965
+ defaultEntry.isPrimaryKey = true;
963
966
  tableStructure.columns[key] = {
964
967
  ...defaultEntry,
965
968
  ...existingEntry
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sqlmorpheus",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "author": "JodliDev",
5
5
  "keywords": [],
6
6
  "license": "MIT",