Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/core/src/migrate/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ export class LaunchQLMigrate {
}
}

/**
* Resolve toChange parameter, handling tag resolution if needed
*/
private resolveToChange(toChange: string | undefined, planPath: string, project: string): string | undefined {
return toChange && toChange.includes('@') ? resolveTagToChangeName(planPath, toChange, project) : toChange;
}

/**
* Deploy changes according to plan file
*/
Expand All @@ -118,7 +125,7 @@ export class LaunchQLMigrate {
const { modulePath, toChange, useTransaction = true, debug = false, logOnly = false } = options;
const planPath = join(modulePath, 'launchql.plan');
const plan = parsePlanFileSimple(planPath);
const resolvedToChange = toChange && toChange.includes('@') ? resolveTagToChangeName(planPath, toChange, plan.project) : toChange;
const resolvedToChange = this.resolveToChange(toChange, planPath, plan.project);
const changes = getChangesInOrder(planPath);

const fullPlanResult = parsePlanFile(planPath);
Expand Down Expand Up @@ -266,7 +273,7 @@ export class LaunchQLMigrate {
const { modulePath, toChange, useTransaction = true } = options;
const planPath = join(modulePath, 'launchql.plan');
const plan = parsePlanFileSimple(planPath);
const resolvedToChange = toChange && toChange.includes('@') ? resolveTagToChangeName(planPath, toChange, plan.project) : toChange;
const resolvedToChange = this.resolveToChange(toChange, planPath, plan.project);
const changes = getChangesInOrder(planPath, true); // Reverse order for revert

const reverted: string[] = [];
Expand Down Expand Up @@ -341,7 +348,7 @@ export class LaunchQLMigrate {
const { modulePath, toChange } = options;
const planPath = join(modulePath, 'launchql.plan');
const plan = parsePlanFileSimple(planPath);
const resolvedToChange = toChange && toChange.includes('@') ? resolveTagToChangeName(planPath, toChange, plan.project) : toChange;
const resolvedToChange = this.resolveToChange(toChange, planPath, plan.project);
const changes = getChangesInOrder(planPath);

const verified: string[] = [];
Expand Down
12 changes: 12 additions & 0 deletions packages/core/src/migrate/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export interface MigratePlanFile {

export interface DeployOptions {
modulePath: string;
/**
* Target change name or tag (e.g., "changeName" or "@tagName").
* Note: Project name is already resolved upstream by LaunchQLProject.
*/
toChange?: string;
useTransaction?: boolean;
// Add debug mode for enhanced error reporting
Expand All @@ -25,6 +29,10 @@ export interface DeployOptions {

export interface RevertOptions {
modulePath: string;
/**
* Target change name or tag (e.g., "changeName" or "@tagName").
* Note: Project name is already resolved upstream by LaunchQLProject.
*/
toChange?: string;
useTransaction?: boolean;
// Add debug mode for enhanced error reporting
Expand All @@ -33,6 +41,10 @@ export interface RevertOptions {

export interface VerifyOptions {
modulePath: string;
/**
* Target change name or tag (e.g., "changeName" or "@tagName").
* Note: Project name is already resolved upstream by LaunchQLProject.
*/
toChange?: string;
}

Expand Down