add more db inits
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1,3 @@
|
||||
/target
|
||||
Cargo.lock
|
||||
*.log
|
||||
|
||||
27
db/mariadb/init.sql
Normal file
27
db/mariadb/init.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
CREATE DATABASE demo;
|
||||
USE demo;
|
||||
|
||||
-- a single table is used for all events in the cqrs system
|
||||
CREATE TABLE events
|
||||
(
|
||||
aggregate_type VARCHAR(256) NOT NULL,
|
||||
aggregate_id VARCHAR(256) NOT NULL,
|
||||
sequence bigint CHECK (sequence >= 0) ,
|
||||
payload TEXT ,
|
||||
metadata TEXT ,
|
||||
timestamp timestamp DEFAULT (CURRENT_TIMESTAMP),
|
||||
PRIMARY KEY (aggregate_type, aggregate_id, sequence)
|
||||
);
|
||||
|
||||
CREATE
|
||||
USER
|
||||
'demo_user'@'localhost'
|
||||
IDENTIFIED BY
|
||||
'password';
|
||||
|
||||
GRANT
|
||||
ALL
|
||||
ON
|
||||
demo.*
|
||||
TO
|
||||
'demo_user'@'localhost';
|
||||
27
db/mysql/init.sql
Normal file
27
db/mysql/init.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
CREATE DATABASE demo;
|
||||
USE demo;
|
||||
|
||||
-- a single table is used for all events in the cqrs system
|
||||
CREATE TABLE events
|
||||
(
|
||||
aggregate_type VARCHAR(256) NOT NULL,
|
||||
aggregate_id VARCHAR(256) NOT NULL,
|
||||
sequence bigint CHECK (sequence >= 0) NOT NULL,
|
||||
payload TEXT NOT NULL,
|
||||
metadata TEXT NOT NULL,
|
||||
timestamp timestamp DEFAULT (CURRENT_TIMESTAMP),
|
||||
PRIMARY KEY (aggregate_type, aggregate_id, sequence)
|
||||
);
|
||||
|
||||
CREATE
|
||||
USER
|
||||
'demo_user'@'localhost'
|
||||
IDENTIFIED BY
|
||||
'password';
|
||||
|
||||
GRANT
|
||||
ALL
|
||||
ON
|
||||
demo.*
|
||||
TO
|
||||
'demo_user'@'localhost';
|
||||
@@ -1,3 +1,6 @@
|
||||
CREATE DATABASE demo;
|
||||
\c demo;
|
||||
|
||||
-- a single table is used for all events in the cqrs system
|
||||
CREATE TABLE events
|
||||
(
|
||||
@@ -21,8 +24,6 @@ ENCRYPTED PASSWORD
|
||||
GRANT
|
||||
ALL PRIVILEGES
|
||||
ON TABLE
|
||||
events,
|
||||
snapshots,
|
||||
queries
|
||||
events
|
||||
TO
|
||||
demo_user;
|
||||
|
||||
@@ -1,16 +1,41 @@
|
||||
version: "3.4"
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres
|
||||
maria-db:
|
||||
image: mariadb
|
||||
volumes:
|
||||
- "./db:/docker-entrypoint-initdb.d"
|
||||
- "./db/mariadb:/docker-entrypoint-initdb.d"
|
||||
networks:
|
||||
- default
|
||||
ports:
|
||||
- "5433:5432"
|
||||
- "8084:3306"
|
||||
environment:
|
||||
#- "MARIADB_USER=root"
|
||||
- "MARIADB_ROOT_PASSWORD=admin_pass"
|
||||
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
||||
|
||||
mysql-db:
|
||||
image: mysql
|
||||
volumes:
|
||||
- "./db/mysql:/docker-entrypoint-initdb.d"
|
||||
networks:
|
||||
- default
|
||||
ports:
|
||||
- "8086:3306"
|
||||
environment:
|
||||
#- "MYSQL_USER=root"
|
||||
- "MYSQL_ROOT_PASSWORD=admin_pass"
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
|
||||
postgres-db:
|
||||
image: postgres
|
||||
volumes:
|
||||
- "./db/postgres:/docker-entrypoint-initdb.d"
|
||||
networks:
|
||||
- default
|
||||
ports:
|
||||
- "8087:5432"
|
||||
environment:
|
||||
- "POSTGRES_DB=demo"
|
||||
- "POSTGRES_USER=admin"
|
||||
- "POSTGRES_PASSWORD=admin_pass"
|
||||
|
||||
@@ -20,6 +45,7 @@ services:
|
||||
networks:
|
||||
- default
|
||||
ports:
|
||||
- "8081:8080"
|
||||
- "8083:8080"
|
||||
depends_on:
|
||||
- db
|
||||
- mysql-db
|
||||
- postgres-db
|
||||
|
||||
Reference in New Issue
Block a user