@inflector/optima 1.0.8 → 1.0.10
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.d.ts +1 -0
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -312,6 +312,7 @@ declare class OptimaDB<T extends Record<string, OptimaTable>> {
|
|
|
312
312
|
execute(sql: string): Promise<DBRow[]>;
|
|
313
313
|
getTables(): Promise<string[]>;
|
|
314
314
|
getDiskSize(): Promise<unknown>;
|
|
315
|
+
close(): void;
|
|
315
316
|
/**
|
|
316
317
|
* Runs a function within a transaction.
|
|
317
318
|
* Re-throws error after rollback so caller handles logic failure.
|
package/dist/index.js
CHANGED
|
@@ -503,7 +503,6 @@ ${valuesBlock}${isReturning ? "\nRETURNING *" : ""};`;
|
|
|
503
503
|
};
|
|
504
504
|
this.BuildUpdate = (TableName, changes, options) => {
|
|
505
505
|
const { where, returning } = options;
|
|
506
|
-
console.log(changes);
|
|
507
506
|
const setClauses = [];
|
|
508
507
|
for (const [key, value] of Object.entries(changes)) {
|
|
509
508
|
if (value !== void 0) {
|
|
@@ -598,7 +597,6 @@ ${valuesBlock}${isReturning ? "\nRETURNING *" : ""};`;
|
|
|
598
597
|
}
|
|
599
598
|
async InitTable() {
|
|
600
599
|
const SQL = SQLBuilder.BuildTable(this.Name, this.Columns);
|
|
601
|
-
console.log(SQL);
|
|
602
600
|
await this.Connection.run(SQL);
|
|
603
601
|
}
|
|
604
602
|
static async create(name, Columns, Connection) {
|
|
@@ -845,7 +843,6 @@ var OptimaDB = class _OptimaDB {
|
|
|
845
843
|
const cleanSchema = SchemaMigrator.transformSchema(schema);
|
|
846
844
|
const migrationSQL = SchemaMigrator.generateSQL(existingTables, cleanSchema);
|
|
847
845
|
if (migrationSQL.length > 0) {
|
|
848
|
-
console.log(`[OptimaDB] Applying ${migrationSQL.length} migrations...`);
|
|
849
846
|
await connection.run("BEGIN TRANSACTION;");
|
|
850
847
|
try {
|
|
851
848
|
for (const sql of migrationSQL) {
|
|
@@ -882,6 +879,9 @@ var OptimaDB = class _OptimaDB {
|
|
|
882
879
|
const result = await this.execute("PRAGMA database_size;");
|
|
883
880
|
return result[0];
|
|
884
881
|
}
|
|
882
|
+
close() {
|
|
883
|
+
this.connection.closeSync();
|
|
884
|
+
}
|
|
885
885
|
/**
|
|
886
886
|
* Runs a function within a transaction.
|
|
887
887
|
* Re-throws error after rollback so caller handles logic failure.
|