-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent importing db core from db runtime (#10568)
* Prevent importing db core from db runtime * Move runtime errors into runtime * Add changeset
- Loading branch information
Showing
6 changed files
with
58 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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,5 @@ | ||
--- | ||
"@astrojs/db": patch | ||
--- | ||
|
||
Prevent runtime from importing core code |
This file contains 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 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 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,33 @@ | ||
import { bold, red } from 'kleur/colors'; | ||
|
||
export const FOREIGN_KEY_DNE_ERROR = (tableName: string) => { | ||
return `Table ${bold( | ||
tableName | ||
)} references a table that does not exist. Did you apply the referenced table to the \`tables\` object in your db config?`; | ||
}; | ||
|
||
export const FOREIGN_KEY_REFERENCES_LENGTH_ERROR = (tableName: string) => { | ||
return `Foreign key on ${bold( | ||
tableName | ||
)} is misconfigured. \`columns\` and \`references\` must be the same length.`; | ||
}; | ||
|
||
export const FOREIGN_KEY_REFERENCES_EMPTY_ERROR = (tableName: string) => { | ||
return `Foreign key on ${bold( | ||
tableName | ||
)} is misconfigured. \`references\` array cannot be empty.`; | ||
}; | ||
|
||
export const REFERENCE_DNE_ERROR = (columnName: string) => { | ||
return `Column ${bold( | ||
columnName | ||
)} references a table that does not exist. Did you apply the referenced table to the \`tables\` object in your db config?`; | ||
}; | ||
|
||
export const SEED_ERROR = (error: string) => { | ||
return `${red(`Error while seeding database:`)}\n\n${error}`; | ||
}; | ||
|
||
export const SEED_DEFAULT_EXPORT_ERROR = (fileName: string) => { | ||
return SEED_ERROR(`Missing default function export in ${bold(fileName)}`); | ||
}; |
This file contains 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 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