feat(plugin-tools): add more properties to the MigrationMetadata type
This commit is contained in:
parent
1799b6e399
commit
62bd5a45e5
2 changed files with 37 additions and 1 deletions
5
.changeset/small-snakes-explode.md
Normal file
5
.changeset/small-snakes-explode.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@emigrate/plugin-tools': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Add more properties to the MigrationMetadata type to ease writing "loader" plugins
|
||||||
|
|
@ -90,8 +90,39 @@ export type GenerateMigrationFunction = GeneratorPlugin['generateMigration'];
|
||||||
export type MigrationFunction = () => Promise<void>;
|
export type MigrationFunction = () => Promise<void>;
|
||||||
|
|
||||||
export type MigrationMetadata = {
|
export type MigrationMetadata = {
|
||||||
|
/**
|
||||||
|
* The name of the migration file
|
||||||
|
*
|
||||||
|
* @example 20210901123456000_create_users_table.js
|
||||||
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
filename: string;
|
/**
|
||||||
|
* The directory where the migration file is located, relative to the current working directory
|
||||||
|
*
|
||||||
|
* @example migrations
|
||||||
|
*/
|
||||||
|
directory: string;
|
||||||
|
/**
|
||||||
|
* The full absolute path to the migration file
|
||||||
|
*
|
||||||
|
* @example /home/user/project/migrations/20210901123456000_create_users_table.js
|
||||||
|
*/
|
||||||
|
filePath: string;
|
||||||
|
/**
|
||||||
|
* The relative path to the migration file, relative to the current working directory
|
||||||
|
*
|
||||||
|
* @example migrations/20210901123456000_create_users_table.js
|
||||||
|
*/
|
||||||
|
relativeFilePath: string;
|
||||||
|
/**
|
||||||
|
* The current working directory (the same as process.cwd())
|
||||||
|
*/
|
||||||
|
cwd: string;
|
||||||
|
/**
|
||||||
|
* The extension of the migration file
|
||||||
|
*
|
||||||
|
* @example js
|
||||||
|
*/
|
||||||
extension: string;
|
extension: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue