From 71b799954da47fe620bbe762cd96ed29379c28ed Mon Sep 17 00:00:00 2001
From: Bjarke Madsen <bjarke@nordu.net>
Date: Mon, 26 Dec 2022 08:07:05 +0100
Subject: [PATCH] Use MySQL instead of postgres and add compose file

---
 config-example.json |  2 +-
 docker-compose.yml  | 17 +++++++++++++++++
 requirements.txt    |  9 ++++-----
 setup.py            |  7 +++----
 4 files changed, 25 insertions(+), 10 deletions(-)
 create mode 100644 docker-compose.yml

diff --git a/config-example.json b/config-example.json
index 5a9ddebf..d168df44 100644
--- a/config-example.json
+++ b/config-example.json
@@ -1,3 +1,3 @@
 {
-  "SQLALCHEMY_DATABASE_URI": "postgresql://compendium_v2:password@localhost/compendium_v2"
+  "SQLALCHEMY_DATABASE_URI": "mysql+pymysql://compendium:compendium321@localhost/compendium"
 }
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 00000000..de0a388a
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,17 @@
+services:
+  mysql:
+    restart: unless-stopped
+    container_name: mysql-compendium
+    environment:
+      MYSQL_ALLOW_EMPTY_PASSWORD: "no"
+      MYSQL_DATABASE: compendium
+      MYSQL_PASSWORD: compendium321
+      MYSQL_ROOT_PASSWORD: compendium321
+      MYSQL_USER: compendium
+    volumes:
+      - ./build/mysql_logs:/var/log/
+      - ./build/mysql_data:/var/lib/mysql/
+    image: mysql:8
+    command: mysqld --general-log=1 --general-log-file=/var/log/mysql.log
+    ports:
+      - 3306:3306
diff --git a/requirements.txt b/requirements.txt
index ddfa46ce..378dff7a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,12 +2,12 @@ alembic
 jsonschema
 flask
 flask-cors
-flask-SQLAlchemy
-flask-Migrate
-psycopg2-binary
+PyMySQL
+cryptography
 SQLAlchemy
 pytest
 pytest-mock
+python-dotenv
 
 sphinx
 sphinx-rtd-theme
@@ -18,5 +18,4 @@ types-docutils
 types-jsonschema
 types-Flask-Cors
 types-setuptools
-types-sqlalchemy
-types-flask_migrate
\ No newline at end of file
+types-sqlalchemy
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 3637236a..d8ca4882 100644
--- a/setup.py
+++ b/setup.py
@@ -13,11 +13,10 @@ setup(
         'jsonschema',
         'flask',
         'flask-cors',
-        'flask',
-        'Flask-Migrate',
-        'psycopg2-binary',
         'SQLAlchemy',
-        'Flask-SQLAlchemy'
+        'alembic',
+        'PyMySQL',
+        'cryptography',
     ],
     include_package_data=True,
 )
-- 
GitLab