init
This commit is contained in:
28
db/postgres/init.sql
Normal file
28
db/postgres/init.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
-- a single table is used for all events in the cqrs system
|
||||
CREATE TABLE events
|
||||
(
|
||||
aggregate_type text NOT NULL,
|
||||
aggregate_id text NOT NULL,
|
||||
sequence bigint CHECK (sequence >= 0) NOT NULL,
|
||||
payload jsonb NOT NULL,
|
||||
metadata jsonb NOT NULL,
|
||||
timestamp timestamp with time zone DEFAULT (CURRENT_TIMESTAMP),
|
||||
PRIMARY KEY (aggregate_type, aggregate_id, sequence)
|
||||
);
|
||||
|
||||
CREATE
|
||||
USER
|
||||
demo_user
|
||||
WITH
|
||||
NOCREATEDB
|
||||
ENCRYPTED PASSWORD
|
||||
'demo_pass';
|
||||
|
||||
GRANT
|
||||
ALL PRIVILEGES
|
||||
ON TABLE
|
||||
events,
|
||||
snapshots,
|
||||
queries
|
||||
TO
|
||||
demo_user;
|
||||
Reference in New Issue
Block a user