rake-db 2.2.6 → 2.3.1
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 +21 -0
- package/db.ts +2 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.esm.js +759 -207
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +758 -205
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/ast.ts +3 -3
- package/src/commands/generate.ts +14 -6
- package/src/common.ts +14 -3
- package/src/migration/changeTable.test.ts +10 -15
- package/src/migration/changeTable.ts +90 -77
- package/src/migration/createTable.test.ts +2 -3
- package/src/migration/migrationUtils.ts +28 -22
- package/src/pull/astToMigration.test.ts +115 -0
- package/src/pull/astToMigration.ts +65 -0
- package/src/pull/dbStructure.test.ts +14 -6
- package/src/pull/dbStructure.ts +167 -47
- package/src/pull/pull.test.ts +92 -0
- package/src/pull/pull.ts +18 -0
- package/src/pull/structureToAst.test.ts +268 -35
- package/src/pull/structureToAst.ts +109 -20
- package/src/rakeDb.test.ts +100 -0
- package/src/rakeDb.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# rake-db
|
|
2
2
|
|
|
3
|
+
## 2.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add command for pulling database structure into a migration
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- pqb@0.9.1
|
|
10
|
+
|
|
11
|
+
## 2.3.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- Change index options: column or expression is required, operator renamed to opclass
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- f1cd5db: Handle multiple indexes and foreignKeys of the column
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- Updated dependencies [f1cd5db]
|
|
22
|
+
- pqb@0.9.0
|
|
23
|
+
|
|
3
24
|
## 2.2.6
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/db.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { rakeDb } from './src/rakeDb';
|
|
|
4
4
|
import { AdapterOptions } from 'pqb';
|
|
5
5
|
import { appCodeUpdater } from '../orm/src';
|
|
6
6
|
|
|
7
|
-
config({ path: path.resolve(
|
|
7
|
+
config({ path: path.resolve('.env.local') });
|
|
8
8
|
config();
|
|
9
9
|
|
|
10
10
|
const options: AdapterOptions[] = [];
|
|
@@ -22,7 +22,7 @@ if (databaseURLTest) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
rakeDb(options, {
|
|
25
|
-
migrationsPath:
|
|
25
|
+
migrationsPath: 'migrations',
|
|
26
26
|
appCodeUpdater: appCodeUpdater({
|
|
27
27
|
tablePath: (tableName) => `app/tables/${tableName}.ts`,
|
|
28
28
|
baseTablePath: 'app/lib/baseTable.ts',
|
package/dist/index.d.ts
CHANGED
|
@@ -156,11 +156,11 @@ declare namespace RakeDbAst {
|
|
|
156
156
|
comment?: string | null;
|
|
157
157
|
compression?: string;
|
|
158
158
|
primaryKey?: boolean;
|
|
159
|
-
|
|
159
|
+
foreignKeys?: ({
|
|
160
160
|
table: string;
|
|
161
161
|
columns: string[];
|
|
162
|
-
} & ForeignKeyOptions;
|
|
163
|
-
|
|
162
|
+
} & ForeignKeyOptions)[];
|
|
163
|
+
indexes?: Omit<SingleColumnIndexOptions, 'column' | 'expression'>[];
|
|
164
164
|
};
|
|
165
165
|
type RenameTable = {
|
|
166
166
|
type: 'renameTable';
|
|
@@ -204,6 +204,7 @@ declare const createDb: (arg: MaybeArray<AdapterOptions>, config: RakeDbConfig)
|
|
|
204
204
|
declare const dropDb: (arg: MaybeArray<AdapterOptions>) => Promise<void>;
|
|
205
205
|
declare const resetDb: (arg: MaybeArray<AdapterOptions>, config: RakeDbConfig) => Promise<void>;
|
|
206
206
|
|
|
207
|
+
declare const writeMigrationFile: (config: RakeDbConfig, name: string, content: string) => Promise<void>;
|
|
207
208
|
declare const generate: (config: RakeDbConfig, args: string[]) => Promise<void>;
|
|
208
209
|
|
|
209
210
|
declare const migrate: (options: MaybeArray<AdapterOptions>, config: RakeDbConfig, args?: string[]) => Promise<void>;
|
|
@@ -214,4 +215,4 @@ declare const change: (fn: ChangeCallback) => void;
|
|
|
214
215
|
|
|
215
216
|
declare const rakeDb: (options: MaybeArray<AdapterOptions>, partialConfig?: Partial<RakeDbConfig>, args?: string[]) => Promise<void>;
|
|
216
217
|
|
|
217
|
-
export { AppCodeUpdater, ChangeTableCallback, ChangeTableOptions, ColumnComment, ColumnsShapeCallback, DropMode, ExtensionOptions, JoinTableOptions, Migration, MigrationColumnTypes, RakeDbAst, RakeDbConfig, TableOptions, change, createDb, dropDb, generate, migrate, rakeDb, resetDb, rollback, runCodeUpdater };
|
|
218
|
+
export { AppCodeUpdater, ChangeTableCallback, ChangeTableOptions, ColumnComment, ColumnsShapeCallback, DropMode, ExtensionOptions, JoinTableOptions, Migration, MigrationColumnTypes, RakeDbAst, RakeDbConfig, TableOptions, change, createDb, dropDb, generate, migrate, rakeDb, resetDb, rollback, runCodeUpdater, writeMigrationFile };
|