From 6d0c140e8e859c208379fa4aab188702e4ea814b Mon Sep 17 00:00:00 2001
From: Eike Kettner <eike.kettner@posteo.de>
Date: Sun, 12 Jan 2020 01:17:49 +0100
Subject: [PATCH] Add mariadb database migration

---
 .../migration/mariadb/V1.1.0__useremail.sql   | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 modules/store/src/main/resources/db/migration/mariadb/V1.1.0__useremail.sql

diff --git a/modules/store/src/main/resources/db/migration/mariadb/V1.1.0__useremail.sql b/modules/store/src/main/resources/db/migration/mariadb/V1.1.0__useremail.sql
new file mode 100644
index 00000000..e1b4df83
--- /dev/null
+++ b/modules/store/src/main/resources/db/migration/mariadb/V1.1.0__useremail.sql
@@ -0,0 +1,39 @@
+CREATE TABLE `useremail` (
+  `id` varchar(254) not null primary key,
+  `uid` varchar(254) not null,
+  `name` varchar(254) not null,
+  `smtp_host` varchar(254) not null,
+  `smtp_port` int,
+  `smtp_user` varchar(254),
+  `smtp_password` varchar(254),
+  `smtp_ssl` varchar(254) not null,
+  `smtp_certcheck` boolean not null,
+  `mail_from` varchar(254) not null,
+  `mail_replyto` varchar(254),
+  `created` timestamp not null,
+  unique (`uid`, `name`),
+  foreign key (`uid`) references `user_`(`uid`)
+);
+
+CREATE TABLE `sentmail` (
+  `id` varchar(254) not null primary key,
+  `uid` varchar(254) not null,
+  `message_id` varchar(254) not null,
+  `sender` varchar(254) not null,
+  `conn_name` varchar(254) not null,
+  `subject` varchar(254) not null,
+  `recipients` varchar(254) not null,
+  `body` text not null,
+  `created` timestamp not null,
+  foreign key(`uid`) references `user_`(`uid`)
+);
+
+CREATE TABLE `sentmailitem` (
+  `id` varchar(254) not null primary key,
+  `item_id` varchar(254) not null,
+  `sentmail_id` varchar(254) not null,
+  `created` timestamp not null,
+  unique (`item_id`, `sentmail_id`),
+  foreign key(`item_id`) references `item`(`itemid`),
+  foreign key(`sentmail_id`) references `sentmail`(`id`)
+);