Skip to content

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

Remove creatorId from InstanceNew and instead hard code the caller id for now

天舟5576c7c99475
diff --git a/frontend/src/components/InstanceForm.vue b/frontend/src/components/InstanceForm.vue
index 32c75be4f6..474c23f31d 100644
--- a/frontend/src/components/InstanceForm.vue
+++ b/frontend/src/components/InstanceForm.vue
@@ -314,7 +314,6 @@ export default {
instance: props.instance
? cloneDeep(props.instance)
: {
- creatorId: currentUser.value.id,
environmentId: UNKNOWN_ID,
name: "New Instance",
host: "127.0.0.1",
diff --git a/frontend/src/miragejs/routes/instance.js b/frontend/src/miragejs/routes/instance.js
index 6ad71e8823..96fe2a6da5 100644
--- a/frontend/src/miragejs/routes/instance.js
+++ b/frontend/src/miragejs/routes/instance.js
@@ -21,6 +21,8 @@ export default function configurInstance(route) {
});
route.post("/instance", function (schema, request) {
+ // NOTE, in actual implementation, we need to fetch the user from the auth context.
+ const callerId = OWNER_ID;
const newInstance = {
...this.normalizedRequestAttrs("instance-new"),
workspaceId: WORKSPACE_ID,
@@ -28,8 +30,8 @@ export default function configurInstance(route) {
const ts = Date.now();
const createdInstance = schema.instances.create({
environmentId: newInstance.environmentId,
- creatorId: newInstance.creatorId,
- updaterId: newInstance.creatorId,
+ creatorId: callerId,
+ updaterId: callerId,
createdTs: ts,
lastUpdatedTs: ts,
name: newInstance.name,
@@ -44,13 +46,13 @@ export default function configurInstance(route) {
lastUpdatedTs: ts,
type: "bb.msg.instance.create",
status: "DELIVERED",
- creatorId: newInstance.creatorId,
+ creatorId: callerId,
workspaceId: WORKSPACE_ID,
payload: {
instanceName: createdInstance.name,
},
};
- postMessageToOwnerAndDBA(schema, newInstance.creatorId, messageTemplate);
+ postMessageToOwnerAndDBA(schema, callerId, messageTemplate);
return createdInstance;
});
diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.ts
index 51ad0956c9..f2fd409fb5 100644
--- a/frontend/src/types/bytebase.ts
+++ b/frontend/src/types/bytebase.ts
@@ -593,7 +593,6 @@ export type Instance = {
};
export type InstanceNew = {
- creatorId: PrincipalId;
environmentId: EnvironmentId;
name: string;
externalLink?: string;