diff --git a/src/commands/export-sql.generated.d.ts b/src/commands/export-sql.generated.d.ts index b07e15857..9071620dc 100644 --- a/src/commands/export-sql.generated.d.ts +++ b/src/commands/export-sql.generated.d.ts @@ -13,12 +13,14 @@ export type AppBackupAndJobStatusQuery = { environments?: Array< { __typename?: 'AppEnvironment'; id?: number | null; + backupsSqlDumpTool?: string | null; latestBackup?: { __typename?: 'Backup'; id?: number | null; type?: string | null; size?: number | null; filename?: string | null; + sqlDumpTool?: string | null; createdAt?: string | null; } | null; jobs?: Array< diff --git a/src/commands/export-sql.ts b/src/commands/export-sql.ts index f69705736..26f7c2b76 100644 --- a/src/commands/export-sql.ts +++ b/src/commands/export-sql.ts @@ -33,11 +33,13 @@ const BACKUP_AND_JOB_STATUS_QUERY = gql` id environments(id: $envId) { id + backupsSqlDumpTool latestBackup { id type size filename + sqlDumpTool createdAt } jobs(jobTypes: [db_backup_copy]) { @@ -98,6 +100,7 @@ async function fetchLatestBackupAndJobStatusBase( ): Promise< { latestBackup: Backup | undefined; jobs: Job[]; + envSqlDumpTool: string | null | undefined; } > { const api = API(); @@ -108,11 +111,12 @@ async function fetchLatestBackupAndJobStatusBase( } ); const environments = response.data.app?.environments; + const envSqlDumpTool = environments?.[ 0 ]?.backupsSqlDumpTool; const latestBackup: Backup | undefined = environments?.[ 0 ]?.latestBackup as Backup; const jobs: Job[] = ( environments?.[ 0 ]?.jobs || [] ) as Job[]; - return { latestBackup, jobs }; + return { latestBackup, jobs, envSqlDumpTool }; } async function fetchLatestBackupAndJobStatus( @@ -412,7 +416,10 @@ export class ExportSQLCommand { await this.runBackupJob(); } - const { latestBackup } = await fetchLatestBackupAndJobStatus( this.app.id, this.env.id ); + const { latestBackup, envSqlDumpTool } = await fetchLatestBackupAndJobStatus( + this.app.id, + this.env.id + ); if ( ! latestBackup ) { await this.track( 'error', { @@ -436,6 +443,18 @@ export class ExportSQLCommand { ); } + const showMyDumperWarning = ( latestBackup.sqlDumpTool ?? envSqlDumpTool ) === 'mydumper'; + if ( showMyDumperWarning ) { + console.warn( + chalk.yellow.bold( 'WARNING:' ), + chalk.yellow( + 'This is a large or complex database. The backup file for this database is generated with MyDumper. ' + + 'The file can only be loaded with MyLoader. ' + + 'For more information: https://github.com/mydumper/mydumper' + ) + ); + } + if ( await this.getExportJob() ) { console.log( `Attaching to an existing export for the backup with timestamp ${ latestBackup.createdAt }` diff --git a/src/graphqlTypes.d.ts b/src/graphqlTypes.d.ts index 3161da2ea..835d39edb 100644 --- a/src/graphqlTypes.d.ts +++ b/src/graphqlTypes.d.ts @@ -1186,6 +1186,7 @@ export type Backup = { filename?: Maybe< Scalars[ 'String' ][ 'output' ] >; id?: Maybe< Scalars[ 'Float' ][ 'output' ] >; size?: Maybe< Scalars[ 'Float' ][ 'output' ] >; + sqlDumpTool?: Maybe< Scalars[ 'String' ][ 'output' ] >; type?: Maybe< Scalars[ 'String' ][ 'output' ] >; };