EventFlow icon indicating copy to clipboard operation
EventFlow copied to clipboard

Specific column "EventName"

Open frankebersoll opened this issue 6 years ago • 4 comments

All SQL implementations use serialized metadata to store the event name. While this is certainly enough to replay events, during development, I often need to look into the database to figure out what happened and it would be so much nicer if I was able to distinguish events by name.

  • Benefits / performance impact / additional size?
  • Could we add this "on demand", so people don't have to migrate existing data?

frankebersoll avatar Jun 12 '18 20:06 frankebersoll

We have the same in the event source system that doesn't use EventFlow (created before EventFlow) and is indeed convenient.

As its merely a "display" field for when viewing, we could just add a default null column.

rasmus avatar Jun 14 '18 18:06 rasmus

For MSSQL, I have a workaround where I use JSON_VALUE in a View - no need for duplicated data.

frankebersoll avatar Jun 18 '18 07:06 frankebersoll

@frankebersoll this would be the most efficient way and would actually be a handy implementation to have on the existing schema structure with alternate database tech supplying their own view logic...eg MySQL would use JSON_EXTRACT.

ArieJones avatar Jun 26 '18 01:06 ArieJones

The script for MSSQL could look like this:

IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_schema = N'dbo' AND table_name = N'EventFlowView')
BEGIN
	EXECUTE('CREATE VIEW [dbo].[EventFlowView]
		AS SELECT
			GlobalSequenceNumber,
			AggregateName,
			AggregateId,
			AggregateSequenceNumber,
			JSON_VALUE(Metadata, ''$.event_name'') as EventName,
			JSON_VALUE(Metadata, ''$.timestamp'') as Timestamp,
			Data
		FROM EventFlow')
END

@rasmus Could we make this optional in EventFlowEventStoresMsSql.MigrateDatabase?

frankebersoll avatar Aug 29 '18 20:08 frankebersoll

Hello there!

We hope you are doing well. We noticed that this issue has not seen any activity in the past 90 days. We consider this issue to be stale and will be closing it within the next seven days.

If you still require assistance with this issue, please feel free to reopen it or create a new issue.

Thank you for your understanding and cooperation.

Best regards, EventFlow

github-actions[bot] avatar Apr 08 '23 13:04 github-actions[bot]

Hello there!

This issue has been closed due to inactivity for seven days. If you believe this issue still needs attention, please feel free to open a new issue or comment on this one to request its reopening.

Thank you for your contribution to this repository.

Best regards, EventFlow

github-actions[bot] avatar Apr 16 '23 09:04 github-actions[bot]