Skip to content
Open
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
24 changes: 24 additions & 0 deletions src/commands/database/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown>, _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')
Expand Down
11 changes: 11 additions & 0 deletions src/commands/database/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')}`)
}
}
Loading