forked from syntaxbullet/AuroraBot-discord
feat: Enhance update requirements check to include database migrations and rename related interfaces and methods.
This commit is contained in:
@@ -19,8 +19,9 @@ export interface RestartContext {
|
||||
installDependencies: boolean;
|
||||
}
|
||||
|
||||
export interface DependencyCheckResult {
|
||||
export interface UpdateCheckResult {
|
||||
needsInstall: boolean;
|
||||
needsMigrations: boolean;
|
||||
error?: Error;
|
||||
}
|
||||
|
||||
@@ -45,14 +46,18 @@ export class UpdateService {
|
||||
await execAsync(`git reset --hard origin/${branch}`);
|
||||
}
|
||||
|
||||
static async checkDependencies(branch: string): Promise<DependencyCheckResult> {
|
||||
static async checkUpdateRequirements(branch: string): Promise<UpdateCheckResult> {
|
||||
try {
|
||||
const { stdout } = await execAsync(`git diff HEAD..origin/${branch} --name-only`);
|
||||
return { needsInstall: stdout.includes("package.json") };
|
||||
return {
|
||||
needsInstall: stdout.includes("package.json"),
|
||||
needsMigrations: stdout.includes("schema.ts") || stdout.includes("drizzle/")
|
||||
};
|
||||
} catch (e) {
|
||||
console.error("Failed to check dependencies:", e);
|
||||
console.error("Failed to check update requirements:", e);
|
||||
return {
|
||||
needsInstall: false,
|
||||
needsMigrations: false,
|
||||
error: e instanceof Error ? e : new Error(String(e))
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user