@type32/tauri-sqlite-orm 0.1.12 → 0.1.13

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
@@ -1066,7 +1066,9 @@ var TauriORM = class {
1066
1066
  return String(dv);
1067
1067
  }
1068
1068
  generateCreateTableSql(table) {
1069
- const tableName = table._tableName;
1069
+ const tableName = getTableName(table);
1070
+ if (!tableName)
1071
+ throw new Error("Invalid table passed to DDL: missing table name");
1070
1072
  const columns = Object.values(table._schema);
1071
1073
  const columnDefs = columns.map((col) => {
1072
1074
  let def = `${col.name} ${col.type}`;
@@ -1222,7 +1224,7 @@ var TauriORM = class {
1222
1224
  if (!this._tables) throw new Error("No tables configured.");
1223
1225
  const dbi = await this.getDb();
1224
1226
  const configuredNames = Object.values(this._tables).map(
1225
- (t) => t._tableName
1227
+ (t) => getTableName(t)
1226
1228
  );
1227
1229
  const existing = await dbi.select(
1228
1230
  `SELECT name FROM sqlite_master WHERE type='table'`
@@ -1236,7 +1238,7 @@ var TauriORM = class {
1236
1238
  );
1237
1239
  const tables = {};
1238
1240
  for (const tbl of Object.values(this._tables)) {
1239
- const tableName = tbl._tableName;
1241
+ const tableName = getTableName(tbl);
1240
1242
  if (!existingNames.includes(tableName)) {
1241
1243
  tables[tableName] = {
1242
1244
  missingColumns: Object.keys(tbl._schema),
@@ -1407,7 +1409,7 @@ var TauriORM = class {
1407
1409
  const dbi = await this.getDb();
1408
1410
  const preserve = options?.preserveData !== false;
1409
1411
  for (const tbl of tables) {
1410
- const tableName = tbl._tableName;
1412
+ const tableName = getTableName(tbl);
1411
1413
  const exists2 = await this.tableExists(tableName);
1412
1414
  if (!exists2) {
1413
1415
  await this.run(this.buildCreateTableSQL(tbl));
package/dist/index.mjs CHANGED
@@ -988,7 +988,9 @@ var TauriORM = class {
988
988
  return String(dv);
989
989
  }
990
990
  generateCreateTableSql(table) {
991
- const tableName = table._tableName;
991
+ const tableName = getTableName(table);
992
+ if (!tableName)
993
+ throw new Error("Invalid table passed to DDL: missing table name");
992
994
  const columns = Object.values(table._schema);
993
995
  const columnDefs = columns.map((col) => {
994
996
  let def = `${col.name} ${col.type}`;
@@ -1144,7 +1146,7 @@ var TauriORM = class {
1144
1146
  if (!this._tables) throw new Error("No tables configured.");
1145
1147
  const dbi = await this.getDb();
1146
1148
  const configuredNames = Object.values(this._tables).map(
1147
- (t) => t._tableName
1149
+ (t) => getTableName(t)
1148
1150
  );
1149
1151
  const existing = await dbi.select(
1150
1152
  `SELECT name FROM sqlite_master WHERE type='table'`
@@ -1158,7 +1160,7 @@ var TauriORM = class {
1158
1160
  );
1159
1161
  const tables = {};
1160
1162
  for (const tbl of Object.values(this._tables)) {
1161
- const tableName = tbl._tableName;
1163
+ const tableName = getTableName(tbl);
1162
1164
  if (!existingNames.includes(tableName)) {
1163
1165
  tables[tableName] = {
1164
1166
  missingColumns: Object.keys(tbl._schema),
@@ -1329,7 +1331,7 @@ var TauriORM = class {
1329
1331
  const dbi = await this.getDb();
1330
1332
  const preserve = options?.preserveData !== false;
1331
1333
  for (const tbl of tables) {
1332
- const tableName = tbl._tableName;
1334
+ const tableName = getTableName(tbl);
1333
1335
  const exists2 = await this.tableExists(tableName);
1334
1336
  if (!exists2) {
1335
1337
  await this.run(this.buildCreateTableSQL(tbl));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@type32/tauri-sqlite-orm",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "A Drizzle-like ORM for Tauri v2's SQL JS API plugin.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",