Added script to check outcome of the hibernate-tutorials
[hibernate4-maven-plugin] / src / it / tutorials / schema-envers.sql
diff --git a/src/it/tutorials/schema-envers.sql b/src/it/tutorials/schema-envers.sql
new file mode 100644 (file)
index 0000000..44643fa
--- /dev/null
@@ -0,0 +1,33 @@
+
+    drop table EVENTS if exists;
+
+    drop table EVENTS_AUD if exists;
+
+    drop table REVINFO if exists;
+
+    create table EVENTS (
+        id bigint not null,
+        EVENT_DATE timestamp,
+        title varchar(255),
+        primary key (id)
+    );
+
+    create table EVENTS_AUD (
+        id bigint not null,
+        REV integer not null,
+        REVTYPE tinyint,
+        EVENT_DATE timestamp,
+        title varchar(255),
+        primary key (id, REV)
+    );
+
+    create table REVINFO (
+        REV integer generated by default as identity,
+        REVTSTMP bigint,
+        primary key (REV)
+    );
+
+    alter table EVENTS_AUD 
+        add constraint FK_3hegaqrrpmx0jj0c8qacjtira 
+        foreign key (REV) 
+        references REVINFO;