-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Schema changes for tags and using Akka Serialization for payloads (#467)
- Loading branch information
Showing
87 changed files
with
1,956 additions
and
659 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
core/src/main/resources/schema/h2/h2-create-schema-legacy.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CREATE TABLE IF NOT EXISTS PUBLIC."journal" ( | ||
"ordering" BIGINT AUTO_INCREMENT, | ||
"persistence_id" VARCHAR(255) NOT NULL, | ||
"sequence_number" BIGINT NOT NULL, | ||
"deleted" BOOLEAN DEFAULT FALSE NOT NULL, | ||
"tags" VARCHAR(255) DEFAULT NULL, | ||
"message" BYTEA NOT NULL, | ||
PRIMARY KEY("persistence_id", "sequence_number") | ||
); | ||
CREATE UNIQUE INDEX IF NOT EXISTS "journal_ordering_idx" ON PUBLIC."journal"("ordering"); | ||
|
||
CREATE TABLE IF NOT EXISTS PUBLIC."snapshot" ( | ||
"persistence_id" VARCHAR(255) NOT NULL, | ||
"sequence_number" BIGINT NOT NULL, | ||
"created" BIGINT NOT NULL, | ||
"snapshot" BYTEA NOT NULL, | ||
PRIMARY KEY("persistence_id", "sequence_number") | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,41 @@ | ||
CREATE TABLE IF NOT EXISTS PUBLIC."journal" ( | ||
"ordering" BIGINT AUTO_INCREMENT, | ||
"persistence_id" VARCHAR(255) NOT NULL, | ||
"sequence_number" BIGINT NOT NULL, | ||
"deleted" BOOLEAN DEFAULT FALSE NOT NULL, | ||
"tags" VARCHAR(255) DEFAULT NULL, | ||
"message" BYTEA NOT NULL, | ||
PRIMARY KEY("persistence_id", "sequence_number") | ||
); | ||
CREATE UNIQUE INDEX IF NOT EXISTS "journal_ordering_idx" ON PUBLIC."journal"("ordering"); | ||
CREATE TABLE IF NOT EXISTS "event_journal" ( | ||
"ordering" BIGINT NOT NULL AUTO_INCREMENT, | ||
"deleted" BOOLEAN DEFAULT false NOT NULL, | ||
"persistence_id" VARCHAR(255) NOT NULL, | ||
"sequence_number" BIGINT NOT NULL, | ||
"writer" VARCHAR NOT NULL, | ||
"write_timestamp" BIGINT NOT NULL, | ||
"adapter_manifest" VARCHAR NOT NULL, | ||
"event_payload" BLOB NOT NULL, | ||
"event_ser_id" INTEGER NOT NULL, | ||
"event_ser_manifest" VARCHAR NOT NULL, | ||
"meta_payload" BLOB, | ||
"meta_ser_id" INTEGER, | ||
"meta_ser_manifest" VARCHAR, | ||
PRIMARY KEY("persistence_id","sequence_number") | ||
); | ||
|
||
CREATE UNIQUE INDEX "event_journal_ordering_idx" on "event_journal" ("ordering"); | ||
|
||
CREATE TABLE IF NOT EXISTS PUBLIC."snapshot" ( | ||
"persistence_id" VARCHAR(255) NOT NULL, | ||
"sequence_number" BIGINT NOT NULL, | ||
"created" BIGINT NOT NULL, | ||
"snapshot" BYTEA NOT NULL, | ||
PRIMARY KEY("persistence_id", "sequence_number") | ||
CREATE TABLE IF NOT EXISTS "event_tag" ( | ||
"event_id" BIGINT NOT NULL, | ||
"tag" VARCHAR NOT NULL, | ||
PRIMARY KEY("event_id", "tag"), | ||
CONSTRAINT fk_event_journal | ||
FOREIGN KEY("event_id") | ||
REFERENCES "event_journal"("ordering") | ||
ON DELETE CASCADE | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS "snapshot" ( | ||
"persistence_id" VARCHAR(255) NOT NULL, | ||
"sequence_number" BIGINT NOT NULL, | ||
"created" BIGINT NOT NULL,"snapshot_ser_id" INTEGER NOT NULL, | ||
"snapshot_ser_manifest" VARCHAR NOT NULL, | ||
"snapshot_payload" BLOB NOT NULL, | ||
"meta_ser_id" INTEGER, | ||
"meta_ser_manifest" VARCHAR, | ||
"meta_payload" BLOB, | ||
PRIMARY KEY("persistence_id","sequence_number") | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP TABLE IF EXISTS PUBLIC."journal"; | ||
DROP TABLE IF EXISTS PUBLIC."snapshot"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
DROP TABLE IF EXISTS PUBLIC."journal"; | ||
DROP TABLE IF EXISTS PUBLIC."event_tag"; | ||
DROP TABLE IF EXISTS PUBLIC."event_journal"; | ||
DROP TABLE IF EXISTS PUBLIC."snapshot"; |
18 changes: 18 additions & 0 deletions
18
core/src/main/resources/schema/mysql/mysql-create-schema-legacy.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CREATE TABLE IF NOT EXISTS journal ( | ||
ordering SERIAL, | ||
persistence_id VARCHAR(255) NOT NULL, | ||
sequence_number BIGINT NOT NULL, | ||
deleted BOOLEAN DEFAULT FALSE NOT NULL, | ||
tags VARCHAR(255) DEFAULT NULL, | ||
message BLOB NOT NULL, | ||
PRIMARY KEY(persistence_id, sequence_number) | ||
); | ||
CREATE UNIQUE INDEX journal_ordering_idx ON journal(ordering); | ||
|
||
CREATE TABLE IF NOT EXISTS snapshot ( | ||
persistence_id VARCHAR(255) NOT NULL, | ||
sequence_number BIGINT NOT NULL, | ||
created BIGINT NOT NULL, | ||
snapshot BLOB NOT NULL, | ||
PRIMARY KEY (persistence_id, sequence_number) | ||
); |
50 changes: 35 additions & 15 deletions
50
core/src/main/resources/schema/mysql/mysql-create-schema.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,38 @@ | ||
CREATE TABLE IF NOT EXISTS journal ( | ||
ordering SERIAL, | ||
persistence_id VARCHAR(255) NOT NULL, | ||
sequence_number BIGINT NOT NULL, | ||
deleted BOOLEAN DEFAULT FALSE NOT NULL, | ||
tags VARCHAR(255) DEFAULT NULL, | ||
message BLOB NOT NULL, | ||
PRIMARY KEY(persistence_id, sequence_number) | ||
CREATE TABLE IF NOT EXISTS event_journal( | ||
ordering SERIAL, | ||
deleted BOOLEAN DEFAULT false NOT NULL, | ||
persistence_id VARCHAR(255) NOT NULL, | ||
sequence_number BIGINT NOT NULL, | ||
writer TEXT NOT NULL, | ||
write_timestamp BIGINT NOT NULL, | ||
adapter_manifest TEXT NOT NULL, | ||
event_payload BLOB NOT NULL, | ||
event_ser_id INTEGER NOT NULL, | ||
event_ser_manifest TEXT NOT NULL, | ||
meta_payload BLOB, | ||
meta_ser_id INTEGER,meta_ser_manifest TEXT, | ||
PRIMARY KEY(persistence_id,sequence_number) | ||
); | ||
CREATE UNIQUE INDEX journal_ordering_idx ON journal(ordering); | ||
|
||
CREATE UNIQUE INDEX event_journal_ordering_idx ON event_journal(ordering); | ||
|
||
CREATE TABLE IF NOT EXISTS event_tag ( | ||
event_id BIGINT UNSIGNED NOT NULL, | ||
tag VARCHAR(255) NOT NULL, | ||
PRIMARY KEY(event_id, tag), | ||
FOREIGN KEY (event_id) | ||
REFERENCES event_journal(ordering) | ||
ON DELETE CASCADE | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS snapshot ( | ||
persistence_id VARCHAR(255) NOT NULL, | ||
sequence_number BIGINT NOT NULL, | ||
created BIGINT NOT NULL, | ||
snapshot BLOB NOT NULL, | ||
PRIMARY KEY (persistence_id, sequence_number) | ||
); | ||
persistence_id VARCHAR(255) NOT NULL, | ||
sequence_number BIGINT NOT NULL, | ||
created BIGINT NOT NULL, | ||
snapshot_ser_id INTEGER NOT NULL, | ||
snapshot_ser_manifest TEXT NOT NULL, | ||
snapshot_payload BLOB NOT NULL, | ||
meta_ser_id INTEGER, | ||
meta_ser_manifest TEXT, | ||
meta_payload BLOB, | ||
PRIMARY KEY (persistence_id, sequence_number)); |
2 changes: 2 additions & 0 deletions
2
core/src/main/resources/schema/mysql/mysql-drop-schema-legacy.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP TABLE IF EXISTS journal; | ||
DROP TABLE IF EXISTS snapshot; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
DROP TABLE IF EXISTS journal; | ||
DROP TABLE IF EXISTS event_tag; | ||
DROP TABLE IF EXISTS event_journal; | ||
DROP TABLE IF EXISTS snapshot; |
44 changes: 44 additions & 0 deletions
44
core/src/main/resources/schema/oracle/oracle-create-schema-legacy.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
CREATE SEQUENCE "ordering_seq" START WITH 1 INCREMENT BY 1 NOMAXVALUE | ||
/ | ||
|
||
CREATE TABLE "journal" ( | ||
"ordering" NUMERIC, | ||
"deleted" char check ("deleted" in (0,1)) NOT NULL, | ||
"persistence_id" VARCHAR(255) NOT NULL, | ||
"sequence_number" NUMERIC NOT NULL, | ||
"tags" VARCHAR(255) DEFAULT NULL, | ||
"message" BLOB NOT NULL, | ||
PRIMARY KEY("persistence_id", "sequence_number") | ||
) | ||
/ | ||
|
||
CREATE UNIQUE INDEX "journal_ordering_idx" ON "journal"("ordering") | ||
/ | ||
|
||
CREATE OR REPLACE TRIGGER "ordering_seq_trigger" | ||
BEFORE INSERT ON "journal" | ||
FOR EACH ROW | ||
BEGIN | ||
SELECT "ordering_seq".NEXTVAL INTO :NEW."ordering" FROM DUAL; | ||
END; | ||
/ | ||
|
||
CREATE OR REPLACE PROCEDURE "reset_sequence" | ||
IS | ||
l_value NUMBER; | ||
BEGIN | ||
EXECUTE IMMEDIATE 'SELECT "ordering_seq".nextval FROM dual' INTO l_value; | ||
EXECUTE IMMEDIATE 'ALTER SEQUENCE "ordering_seq" INCREMENT BY -' || l_value || ' MINVALUE 0'; | ||
EXECUTE IMMEDIATE 'SELECT "ordering_seq".nextval FROM dual' INTO l_value; | ||
EXECUTE IMMEDIATE 'ALTER SEQUENCE "ordering_seq" INCREMENT BY 1 MINVALUE 0'; | ||
END; | ||
/ | ||
|
||
CREATE TABLE "snapshot" ( | ||
"persistence_id" VARCHAR(255) NOT NULL, | ||
"sequence_number" NUMERIC NOT NULL, | ||
"created" NUMERIC NOT NULL, | ||
"snapshot" BLOB NOT NULL, | ||
PRIMARY KEY ("persistence_id", "sequence_number") | ||
) | ||
/ |
Oops, something went wrong.