diff --git a/pkg/sql/drop_database.go b/pkg/sql/drop_database.go index 0234444ad267..c2a8d6c73fbc 100644 --- a/pkg/sql/drop_database.go +++ b/pkg/sql/drop_database.go @@ -172,10 +172,10 @@ func (n *dropDatabaseNode) startExec(params runParams) error { int32(n.dbDesc.ID), int32(params.extendedEvalCtx.NodeID), struct { - DatabaseName string - Statement string - User string - DroppedTablesAndViews []string + DatabaseName string + Statement string + User string + DroppedSchemaObjects []string }{n.n.Name.String(), n.n.String(), p.SessionData().User, tbNameStrings}, ) } diff --git a/pkg/sql/logictest/testdata/logic_test/event_log b/pkg/sql/logictest/testdata/logic_test/event_log index 6aa65b9a8478..22a037445c34 100644 --- a/pkg/sql/logictest/testdata/logic_test/event_log +++ b/pkg/sql/logictest/testdata/logic_test/event_log @@ -292,7 +292,7 @@ DROP DATABASE IF EXISTS othereventlogtest CASCADE # verify event is there, and cascading table drops are logged. query IIT -SELECT "targetID", "reportingID", info::JSONB->>'DroppedTablesAndViews' +SELECT "targetID", "reportingID", info::JSONB->>'DroppedSchemaObjects' FROM system.eventlog WHERE "eventType" = 'drop_database' AND info::JSONB->>'Statement' LIKE 'DROP DATABASE eventlogtest%' @@ -300,7 +300,7 @@ WHERE "eventType" = 'drop_database' 53 1 ["eventlogtest.public.anothertesttable", "eventlogtest.public.testtable"] query IIT -SELECT "targetID", "reportingID", info::JSONB->>'DroppedTablesAndViews' +SELECT "targetID", "reportingID", info::JSONB->>'DroppedSchemaObjects' FROM system.eventlog WHERE "eventType" = 'drop_database' AND info::JSONB->>'Statement' LIKE 'DROP DATABASE IF EXISTS othereventlogtest%' diff --git a/pkg/ui/src/util/events.ts b/pkg/ui/src/util/events.ts index c6fae2c5e57c..6d8676d5b156 100644 --- a/pkg/ui/src/util/events.ts +++ b/pkg/ui/src/util/events.ts @@ -11,7 +11,7 @@ type Event$Properties = protos.cockroach.server.serverpb.EventsResponse.Event$Pr export function getEventDescription(e: Event$Properties): string { const info: { DatabaseName: string, - DroppedTables: string[], + DroppedSchemaObjects: string[], IndexName: string, MutationID: string, TableName: string, @@ -27,14 +27,15 @@ export function getEventDescription(e: Event$Properties): string { case eventTypes.CREATE_DATABASE: return `Database Created: User ${info.User} created database ${info.DatabaseName}`; case eventTypes.DROP_DATABASE: - info.DroppedTables = info.DroppedTables || []; - let tableDropText: string = `${info.DroppedTables.length} tables were dropped: ${info.DroppedTables.join(", ")}`; - if (info.DroppedTables.length === 0) { - tableDropText = "No tables were dropped."; - } else if (info.DroppedTables.length === 1) { - tableDropText = `1 table was dropped: ${info.DroppedTables[0]}`; + info.DroppedSchemaObjects = info.DroppedSchemaObjects || []; + let tableDropText = `${info.DroppedSchemaObjects.length} schema objects ` + + `were dropped: ${info.DroppedSchemaObjects.join(", ")}`; + if (info.DroppedSchemaObjects.length === 0) { + tableDropText = "No schema objects were dropped."; + } else if (info.DroppedSchemaObjects.length === 1) { + tableDropText = `1 schema objects was dropped: ${info.DroppedSchemaObjects[0]}`; } - return `Database Dropped: User ${info.User} dropped database ${info.DatabaseName}.${tableDropText}`; + return `Database Dropped: User ${info.User} dropped database ${info.DatabaseName}. ${tableDropText}`; case eventTypes.CREATE_TABLE: return `Table Created: User ${info.User} created table ${info.TableName}`; case eventTypes.DROP_TABLE: