unkown commit
This commit is contained in:
24
docker/cassandra/init.cql
Normal file
24
docker/cassandra/init.cql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- Create keyspace
|
||||
CREATE KEYSPACE IF NOT EXISTS event_store
|
||||
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
|
||||
|
||||
USE event_store;
|
||||
|
||||
-- Create events table
|
||||
CREATE TABLE IF NOT EXISTS events (
|
||||
aggregate_id text,
|
||||
version int,
|
||||
event_type text,
|
||||
payload text,
|
||||
created_at timestamp,
|
||||
PRIMARY KEY (aggregate_id, version)
|
||||
) WITH CLUSTERING ORDER BY (version ASC)
|
||||
AND comment = 'Event store for domain events'
|
||||
AND compaction = {'class': 'LeveledCompactionStrategy'}
|
||||
AND gc_grace_seconds = 864000;
|
||||
|
||||
-- Create index on event_type for querying
|
||||
CREATE INDEX IF NOT EXISTS events_event_type_idx ON events (event_type);
|
||||
|
||||
-- Create index on created_at for time-based queries
|
||||
CREATE INDEX IF NOT EXISTS events_created_at_idx ON events (created_at);
|
||||
Reference in New Issue
Block a user