Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Allow return * database because we still need it to config the admin data source

天舟287b29348067
diff --git a/frontend/src/miragejs/routes/database.js b/frontend/src/miragejs/routes/database.js
index 50595b796e..637bdac7ae 100644
--- a/frontend/src/miragejs/routes/database.js
+++ b/frontend/src/miragejs/routes/database.js
@@ -11,7 +11,7 @@ export default function configureDatabase(route) {
return new Response(
404,
{},
- { errors: "Database " + request.params.id + " not found" }
+ { errors: "Database " + request.params.id + " not found." }
);
});
@@ -38,10 +38,6 @@ export default function configureDatabase(route) {
return schema.databases
.where((database) => {
- if (database.name == ALL_DATABASE_NAME) {
- return false;
- }
-
if (instanceIdList && !instanceIdList.includes(database.instanceId)) {
return false;
}
@@ -75,12 +71,18 @@ export default function configureDatabase(route) {
"database"
);
- if (attrs.name == ALL_DATABASE_NAME) {
+ if (
+ schema.databases.findBy({
+ name: attrs.name,
+ instanceId: attrs.instanceId,
+ workspaceId: WORKSPACE_ID,
+ })
+ ) {
return new Response(
- 400,
+ 409,
{},
{
- errors: `Cannot specify * as the database name`,
+ errors: `Database name ${attrs.name} already exists.`,
}
);
}
@@ -116,7 +118,7 @@ export default function configureDatabase(route) {
return new Response(
404,
{},
- { errors: "Database " + request.params.databaseId + " not found" }
+ { errors: "Database " + request.params.databaseId + " not found." }
);
}
@@ -125,7 +127,7 @@ export default function configureDatabase(route) {
400,
{},
{
- errors: `Cannot specify * as the database name`,
+ errors: `Cannot specify * as the database name.`,
}
);
}