rake-db 2.3.12 → 2.3.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/CHANGELOG.md +8 -0
- package/dist/index.d.ts +104 -6
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/commands/migrateOrRollback.ts +3 -3
- package/src/common.ts +2 -2
- package/src/migration/migration.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rake-db",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.13",
|
|
4
4
|
"description": "Migrations tool for Postgresql DB",
|
|
5
5
|
"homepage": "https://orchid-orm.netlify.app/guide/migration-setup-and-overview.html",
|
|
6
6
|
"repository": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"enquirer": "^2.3.6",
|
|
44
44
|
"pluralize": "^8.0.0",
|
|
45
|
-
"pqb": "0.9.
|
|
45
|
+
"pqb": "0.9.8"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@swc/core": "^1.2.210",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Adapter,
|
|
3
3
|
AdapterOptions,
|
|
4
|
-
columnTypes,
|
|
5
4
|
createDb,
|
|
6
5
|
DbResult,
|
|
6
|
+
DefaultColumnTypes,
|
|
7
7
|
MaybeArray,
|
|
8
8
|
toArray,
|
|
9
9
|
} from 'pqb';
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from '../migration/change';
|
|
25
25
|
import { createMigrationInterface } from '../migration/migration';
|
|
26
26
|
|
|
27
|
-
const getDb = (adapter: Adapter) => createDb({ adapter
|
|
27
|
+
const getDb = (adapter: Adapter) => createDb({ adapter });
|
|
28
28
|
|
|
29
29
|
const migrateOrRollback = async (
|
|
30
30
|
options: MaybeArray<AdapterOptions>,
|
|
@@ -54,7 +54,7 @@ const migrateOrRollback = async (
|
|
|
54
54
|
|
|
55
55
|
for (const opts of toArray(options)) {
|
|
56
56
|
const adapter = new Adapter(opts);
|
|
57
|
-
let db: DbResult<
|
|
57
|
+
let db: DbResult<DefaultColumnTypes> | undefined;
|
|
58
58
|
|
|
59
59
|
if (up) {
|
|
60
60
|
await config.beforeMigrate?.((db ??= getDb(adapter)));
|
package/src/common.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Adapter,
|
|
3
3
|
AdapterOptions,
|
|
4
|
-
columnTypes,
|
|
5
4
|
DbResult,
|
|
5
|
+
DefaultColumnTypes,
|
|
6
6
|
NoPrimaryKeyOption,
|
|
7
7
|
QueryLogOptions,
|
|
8
8
|
singleQuote,
|
|
@@ -12,7 +12,7 @@ import path from 'path';
|
|
|
12
12
|
import { readdir } from 'fs/promises';
|
|
13
13
|
import { RakeDbAst } from './ast';
|
|
14
14
|
|
|
15
|
-
type Db = DbResult<
|
|
15
|
+
type Db = DbResult<DefaultColumnTypes>;
|
|
16
16
|
|
|
17
17
|
export type RakeDbConfig = {
|
|
18
18
|
migrationsPath: string;
|
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
TextColumn,
|
|
16
16
|
AdapterOptions,
|
|
17
17
|
createDb,
|
|
18
|
-
columnTypes,
|
|
19
18
|
DbResult,
|
|
19
|
+
DefaultColumnTypes,
|
|
20
20
|
} from 'pqb';
|
|
21
21
|
import { createTable } from './createTable';
|
|
22
22
|
import { changeTable, TableChangeData, TableChanger } from './changeTable';
|
|
@@ -63,7 +63,7 @@ export type ExtensionOptions = {
|
|
|
63
63
|
cascade?: boolean;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
export type Migration = DbResult<
|
|
66
|
+
export type Migration = DbResult<DefaultColumnTypes> & MigrationBase;
|
|
67
67
|
|
|
68
68
|
export const createMigrationInterface = (
|
|
69
69
|
tx: TransactionAdapter,
|
|
@@ -84,7 +84,7 @@ export const createMigrationInterface = (
|
|
|
84
84
|
return wrapWithLog(log, q, () => arrays.call(adapter, q, types));
|
|
85
85
|
}) as typeof adapter.arrays;
|
|
86
86
|
|
|
87
|
-
const db = createDb({ adapter
|
|
87
|
+
const db = createDb({ adapter }) as unknown as Migration;
|
|
88
88
|
|
|
89
89
|
const { prototype: proto } = MigrationBase;
|
|
90
90
|
for (const key of Object.getOwnPropertyNames(proto)) {
|