-
Notifications
You must be signed in to change notification settings - Fork 449
feat: restructure db command files #8175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
src/commands/database/constants.ts → src/commands/database/legacy/constants.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| export const NEON_DATABASE_EXTENSION_SLUG = process.env.NEON_DATABASE_EXTENSION_SLUG ?? 'neon' | ||
| export const JIGSAW_URL = process.env.JIGSAW_URL ?? 'https://jigsaw.services-prod.nsvcs.net' | ||
| export const NETLIFY_NEON_PACKAGE_NAME = '@netlify/neon' | ||
| export const MIGRATIONS_SCHEMA = 'netlify' | ||
| export const MIGRATIONS_TABLE = `${MIGRATIONS_SCHEMA}.migrations` |
6 changes: 3 additions & 3 deletions
6
src/commands/database/init.ts → src/commands/database/legacy/db-init.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
src/commands/database/status.ts → src/commands/database/legacy/db-status.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/commands/database/drizzle.ts → src/commands/database/legacy/drizzle.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| export type Extension = { | ||
| id: string | ||
| name: string | ||
| slug: string | ||
| hostSiteUrl: string | ||
| installedOnTeam: boolean | ||
| } | ||
|
|
||
| export type SiteInfo = { | ||
| id: string | ||
| name: string | ||
| account_id: string | ||
| admin_url: string | ||
| url: string | ||
| ssl_url: string | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export const MIGRATIONS_SCHEMA = 'netlify' | ||
| export const MIGRATIONS_TABLE = `${MIGRATIONS_SCHEMA}.migrations` |
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { join } from 'path' | ||
|
|
||
| import BaseCommand from '../../base-command.js' | ||
|
|
||
| // Default on-disk location for migration files, relative to the project root. | ||
| // Can be overridden by setting `db.migrations.path` in `netlify.toml`. | ||
| export const DEFAULT_MIGRATIONS_PATH = 'netlify/database/migrations' | ||
|
|
||
| // Resolves the absolute path of the project's migrations directory. Prefers | ||
| // the `db.migrations.path` override from `netlify.toml` when present; falls | ||
| // back to `<project-root>/netlify/database/migrations`. | ||
| export const resolveMigrationsDirectory = (command: BaseCommand): string => { | ||
| const configuredPath = command.netlify.config.db?.migrations?.path | ||
| if (configuredPath) { | ||
| return configuredPath | ||
| } | ||
|
|
||
| const projectRoot = command.netlify.site.root ?? command.project.root ?? command.project.baseDirectory | ||
| if (!projectRoot) { | ||
| throw new Error('Could not determine the project root directory.') | ||
| } | ||
|
|
||
| return join(projectRoot, DEFAULT_MIGRATIONS_PATH) | ||
| } |
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default-path guidance is misleading without actual fallback resolution.
At Line 20, the command only reads
db.migrations.pathfrom config, but Line 23 tells users to create${DEFAULT_MIGRATIONS_PATH}. A project with only the default folder (and no config key) still errors here.Suggested fix
🤖 Prompt for AI Agents