@jungvonmatt/sb-migrate
Version:
CLI tool for managing Storyblok schema and content migrations
27 lines (26 loc) • 1.51 kB
TypeScript
import { IPendingDataSourceEntry } from "../../types/IDataSource";
import { DatasourceMigration } from "../../types/migration";
import { RunMigrationOptions } from "../../utils/migration";
/**
* Handles the update of an existing datasource based on the provided migration schema.
* This function performs the following operations:
* 1. Checks if the operation is a dry run
* 2. Verifies that either datasource updates or entries are provided
* 3. Retrieves the existing datasource
* 4. Updates datasource properties if provided
* 5. Updates datasource entries if provided
* 6. Creates a rollback file for the changes
*
* @param {Object} migration - The migration object containing the datasource updates
* @param {number | string} migration.id - The ID of the datasource to update
* @param {Partial<DatasourceMigration>} [migration.datasource] - Optional updates to the datasource properties
* @param {Omit<IPendingDataSourceEntry, "datasource_id">[]} [migration.entries] - Optional entries to update in the datasource
* @param {RunMigrationOptions} options - Configuration options for the migration
* @param {boolean} [options.isDryrun] - Whether to perform a dry run without making actual changes
* @throws {Error} If the datasource update fails
*/
export declare const handleUpdateDatasource: (migration: {
id: number | string;
datasource?: Partial<DatasourceMigration>;
entries?: Omit<IPendingDataSourceEntry, "datasource_id">[];
}, options: RunMigrationOptions) => Promise<void>;