From 1bde506c2cf915554a552f7ddeefb8c575080c44 Mon Sep 17 00:00:00 2001 From: kathmbeck Date: Wed, 8 Apr 2026 16:58:23 -0400 Subject: [PATCH 1/4] feat: add deprecation messaging for legacy Netlify DB extension --- src/commands/database/database.ts | 22 ++++++++++++++++++++++ src/commands/database/legacy/db-status.ts | 11 +++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/commands/database/database.ts b/src/commands/database/database.ts index 8e41dc809ca..5d62dea3b5c 100644 --- a/src/commands/database/database.ts +++ b/src/commands/database/database.ts @@ -104,6 +104,28 @@ export const createDatabaseCommand = (program: BaseCommand) => { 'netlify database status --branch my-feature-branch', ]) + dbCommand + .command('init') + .description('Initialize a new database for the current site') + .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/legacy/db-status.ts b/src/commands/database/legacy/db-status.ts index a2d2118f288..b334e4ee2e5 100644 --- a/src/commands/database/legacy/db-status.ts +++ b/src/commands/database/legacy/db-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')}`) + } } From 28bd588b1635821d2c78032f37e081a2a7a7f439 Mon Sep 17 00:00:00 2001 From: kathmbeck Date: Thu, 9 Apr 2026 13:45:00 -0400 Subject: [PATCH 2/4] format --- src/commands/database/database.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/database/database.ts b/src/commands/database/database.ts index 5d62dea3b5c..41b20a1045e 100644 --- a/src/commands/database/database.ts +++ b/src/commands/database/database.ts @@ -107,7 +107,7 @@ export const createDatabaseCommand = (program: BaseCommand) => { dbCommand .command('init') .description('Initialize a new database for the current site') - .action(async (_options: Record, command: BaseCommand) => { + .action(async (_options: Record, _command: BaseCommand) => { const { log, chalk } = await import('../../utils/command-helpers.js') log() @@ -121,7 +121,9 @@ export const createDatabaseCommand = (program: BaseCommand) => { 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.`, + `If you have an existing database from the Netlify DB extension, visit ${chalk.cyan( + 'https://ntl.fyi/db-migration', + )} for migration instructions.`, ) log() }) From 5303f59a197a9578d81a1c657e4efc479e6db7c3 Mon Sep 17 00:00:00 2001 From: Katherine Beck <49894658+kathmbeck@users.noreply.github.com> Date: Fri, 10 Apr 2026 11:21:10 -0400 Subject: [PATCH 3/4] Update src/commands/database/database.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- src/commands/database/database.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/database/database.ts b/src/commands/database/database.ts index 41b20a1045e..85d384cfcd3 100644 --- a/src/commands/database/database.ts +++ b/src/commands/database/database.ts @@ -106,7 +106,7 @@ export const createDatabaseCommand = (program: BaseCommand) => { dbCommand .command('init') - .description('Initialize a new database for the current site') + .description('Deprecated: databases are auto-provisioned via `@netlify/db`') .action(async (_options: Record, _command: BaseCommand) => { const { log, chalk } = await import('../../utils/command-helpers.js') From 704a7b68d224d6a846cce73c3698fdae22d4eaa7 Mon Sep 17 00:00:00 2001 From: Katherine Beck Date: Wed, 22 Apr 2026 12:16:06 -0400 Subject: [PATCH 4/4] fix after rebase --- src/commands/database/database.ts | 6 +++--- src/commands/database/legacy/db-status.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/database/database.ts b/src/commands/database/database.ts index 85d384cfcd3..67ef3961e4f 100644 --- a/src/commands/database/database.ts +++ b/src/commands/database/database.ts @@ -106,19 +106,19 @@ export const createDatabaseCommand = (program: BaseCommand) => { dbCommand .command('init') - .description('Deprecated: databases are auto-provisioned via `@netlify/db`') + .description('Deprecated: databases are auto-provisioned via `@netlify/database`') .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.', + '`netlify db init` is no longer available. Databases are now provisioned automatically when @netlify/database is detected in your project.', ), ) log() log('To get started, run:') - log(` ${chalk.cyan('npm install @netlify/db')}`) + log(` ${chalk.cyan('npm install @netlify/database')}`) log() log( `If you have an existing database from the Netlify DB extension, visit ${chalk.cyan( diff --git a/src/commands/database/legacy/db-status.ts b/src/commands/database/legacy/db-status.ts index b334e4ee2e5..12f4d0e0f9d 100644 --- a/src/commands/database/legacy/db-status.ts +++ b/src/commands/database/legacy/db-status.ts @@ -78,11 +78,11 @@ export const status = async (_options: OptionValues, command: BaseCommand) => { ) // Show deprecation warning if a legacy extension DB is detected - if (databaseUrlEnv?.key === 'NETLIFY_DATABASE_URL') { + if (process.env.EXPERIMENTAL_NETLIFY_DB_ENABLED === '1' && 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.', + 'Warning: This site has a database from the legacy Netlify DB extension, which has been deprecated. Netlify Database is now available as a built-in feature.', ), ) log(`For migration instructions, visit ${chalk.cyan('https://ntl.fyi/db-migration')}`)