rake-db 2.29.5 → 2.29.6
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 +2 -3
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as pqb from 'pqb';
|
|
2
|
-
import { TableData, ColumnsShape, NoPrimaryKeyOption, MaybeArray, Column, RawSqlBase, RecordString, EnumColumn, EmptyObject, AdapterBase, DbResult, DefaultColumnTypes, DefaultSchemaConfig, QueryLogObject, TableDataFn, TableDataItem, DbDomainArg, ColumnSchemaConfig, raw, Db, MaybePromise, QueryLogOptions, QuerySchema,
|
|
2
|
+
import { TableData, ColumnsShape, NoPrimaryKeyOption, MaybeArray, Column, RawSqlBase, RecordString, EnumColumn, EmptyObject, AdapterBase, DbResult, DefaultColumnTypes, DefaultSchemaConfig, QueryLogObject, TableDataFn, TableDataItem, DbDomainArg, ColumnSchemaConfig, raw, Db, MaybePromise, QueryLogOptions, QuerySchema, SearchWeight, ColumnsByType, DbStructureDomainsMap } from 'pqb';
|
|
3
3
|
|
|
4
4
|
type RakeDbAst = RakeDbAst.Table | RakeDbAst.ChangeTable | RakeDbAst.RenameType | RakeDbAst.Schema | RakeDbAst.RenameSchema | RakeDbAst.Extension | RakeDbAst.Enum | RakeDbAst.EnumValues | RakeDbAst.RenameEnumValues | RakeDbAst.ChangeEnumValues | RakeDbAst.Domain | RakeDbAst.Collation | RakeDbAst.Constraint | RakeDbAst.RenameTableItem | RakeDbAst.View;
|
|
5
5
|
declare namespace RakeDbAst {
|
|
@@ -1514,8 +1514,7 @@ declare const promptSelect: ({ message, options, active, inactive, }: {
|
|
|
1514
1514
|
declare const saveMigratedVersion: (db: SilentQueries, version: string, name: string, config: Pick<RakeDbConfig, 'migrationsTable'>) => Promise<void>;
|
|
1515
1515
|
|
|
1516
1516
|
interface OrmParam {
|
|
1517
|
-
$
|
|
1518
|
-
$adapter: AdapterBase;
|
|
1517
|
+
$getAdapter(): AdapterBase;
|
|
1519
1518
|
}
|
|
1520
1519
|
type DbParam = OrmParam | AdapterBase;
|
|
1521
1520
|
|
package/dist/index.js
CHANGED
|
@@ -180,8 +180,7 @@ const promptText = ({
|
|
|
180
180
|
});
|
|
181
181
|
};
|
|
182
182
|
|
|
183
|
-
const
|
|
184
|
-
const getMaybeTransactionAdapter = (db) => "$qb" in db ? db.$qb.internal.transactionStorage.getStore()?.adapter || db.$adapter : db;
|
|
183
|
+
const getMaybeTransactionAdapter = (db) => "$getAdapter" in db ? db.$getAdapter() : db;
|
|
185
184
|
const ensureTransaction = (db, fn) => {
|
|
186
185
|
const adapter = getMaybeTransactionAdapter(db);
|
|
187
186
|
return adapter.isInTransaction() ? fn(adapter) : adapter.transaction(void 0, fn);
|
|
@@ -225,7 +224,7 @@ const dropDatabase = async (db, { database }) => {
|
|
|
225
224
|
};
|
|
226
225
|
const createOrDrop = async (db, sql) => {
|
|
227
226
|
try {
|
|
228
|
-
const adapter =
|
|
227
|
+
const adapter = getMaybeTransactionAdapter(db);
|
|
229
228
|
await adapter.query(sql);
|
|
230
229
|
return "done";
|
|
231
230
|
} catch (error) {
|