diff --git a/src/commands/database/database.ts b/src/commands/database/database.ts index 583289c79dc..b8f7c054f78 100644 --- a/src/commands/database/database.ts +++ b/src/commands/database/database.ts @@ -91,6 +91,30 @@ export const createDatabaseCommand = (program: BaseCommand) => { }) if (process.env.EXPERIMENTAL_NETLIFY_DB_ENABLED === '1') { + dbCommand + .command('init') + .description('Deprecated: databases are auto-provisioned via `@netlify/db`') + .action(async (_options: Record, _command: BaseCommand) => { + const { log, chalk } = await import('../../utils/command-helpers.js') + + log() + log( + chalk.yellow( + '`netlify db init` is no longer available. Databases are now provisioned automatically when @netlify/db is detected in your project.', + ), + ) + log() + log('To get started, run:') + log(` ${chalk.cyan('npm install @netlify/db')}`) + log() + log( + `If you have an existing database from the Netlify DB extension, visit ${chalk.cyan( + 'https://ntl.fyi/db-migration', + )} for migration instructions.`, + ) + log() + }) + dbCommand .command('connect') .description('Connect to the database') diff --git a/src/commands/database/status.ts b/src/commands/database/status.ts index 723cff0b66e..51da63bfba6 100644 --- a/src/commands/database/status.ts +++ b/src/commands/database/status.ts @@ -76,4 +76,15 @@ export const status = async (_options: OptionValues, command: BaseCommand) => { unpooledDatabaseUrlEnv?.key === 'NETLIFY_DATABASE_URL_UNPOOLED' ? 'saved' : chalk.red('not set'), }), ) + + // Show deprecation warning if a legacy extension DB is detected + if (databaseUrlEnv?.key === 'NETLIFY_DATABASE_URL') { + log() + log( + chalk.yellow( + 'Warning: This site has a database from the legacy Netlify DB extension, which has been deprecated. Netlify DB is now available as a built-in feature.', + ), + ) + log(`For migration instructions, visit ${chalk.cyan('https://ntl.fyi/db-migration')}`) + } }