From fc54bc883895abbed413979f05ff7750230d56a1 Mon Sep 17 00:00:00 2001
From: Yuriy Bakhtin <yurybakh@gmail.com>
Date: Fri, 20 Oct 2023 17:54:05 +0200
Subject: [PATCH] Add migrations uninstall

---
 docs/CHANGELOG.md        |  4 ++++
 migrations/uninstall.php | 24 ++++++++++++++++++++++++
 module.json              |  2 +-
 3 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 migrations/uninstall.php

diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 67b95f1..96aa406 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -1,6 +1,10 @@
 Changelog
 =========
 
+1.0.5 (Unreleased)
+--------------------------
+- Fix #18: Add migrations uninstall
+
 1.0.4 (September 22, 2023)
 --------------------------
 - Enh #17: Tests for `next` version
diff --git a/migrations/uninstall.php b/migrations/uninstall.php
new file mode 100644
index 0000000..26218b4
--- /dev/null
+++ b/migrations/uninstall.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * @link https://www.humhub.org/
+ * @copyright Copyright (c) HumHub GmbH & Co. KG
+ * @license https://www.humhub.com/licences
+ */
+
+use humhub\components\Migration;
+
+class uninstall extends Migration
+{
+    public function up()
+    {
+        $this->safeDropTable('question_answer_vote');
+        $this->safeDropTable('question_answer');
+        $this->safeDropTable('question');
+    }
+
+    public function down()
+    {
+        echo "uninstall does not support migration down.\n";
+        return false;
+    }
+}
diff --git a/module.json b/module.json
index ee9a2f3..d0ce6a0 100644
--- a/module.json
+++ b/module.json
@@ -3,7 +3,7 @@
     "name": "Q&A",
     "description": "Elevate your knowledge sharing experience by enabling users to ask questions and upvote the most helpful answers.",
     "keywords": ["Q&A", "questions answers"],
-    "version": "1.0.4",
+    "version": "1.0.5",
     "humhub": {
         "minVersion": "1.14"
     },