From: Dessalines <dessalines@users.noreply.github.com>
Date: Fri, 21 Jul 2023 09:46:10 +0000 (-0400)
Subject: Adding diesel migration check. Fixes #3676 (#3677)
X-Git-Url: http://these/git/%22%7Bauthor_url%7D/readmes/%22%7B%7D/%22?a=commitdiff_plain;h=417c4d2311cf9a496c24db64962ff648b6c37a39;p=lemmy.git

Adding diesel migration check. Fixes #3676 (#3677)

* Adding diesel migration check. Fixes #3676

* Fixing prettier.
---

diff --git a/.woodpecker.yml b/.woodpecker.yml
index fe581ab4..58ab2f0f 100644
--- a/.woodpecker.yml
+++ b/.woodpecker.yml
@@ -68,31 +68,6 @@ pipeline:
     # when:
     #   platform: linux/amd64
 
-  cargo_clippy:
-    image: *muslrust_image
-    environment:
-      CARGO_HOME: .cargo
-    commands:
-      # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
-      - rustup component add clippy
-      - cargo clippy --workspace --tests --all-targets --features console --
-        -D warnings -D deprecated -D clippy::perf -D clippy::complexity
-        -D clippy::style -D clippy::correctness -D clippy::suspicious
-        -D clippy::dbg_macro -D clippy::inefficient_to_string
-        -D clippy::items-after-statements -D clippy::implicit_clone
-        -D clippy::cast_lossless -D clippy::manual_string_new
-        -D clippy::redundant_closure_for_method_calls
-        -D clippy::unused_self
-        -A clippy::uninlined_format_args
-        -D clippy::get_first
-        -D clippy::explicit_into_iter_loop
-        -D clippy::explicit_iter_loop
-        -D clippy::needless_collect
-        -D clippy::unwrap_used
-        -D clippy::indexing_slicing
-    # when:
-    #   platform: linux/amd64
-
   # make sure api builds with default features (used by other crates relying on lemmy api)
   check_api_common_default_features:
     image: *muslrust_image
@@ -141,6 +116,40 @@ pipeline:
       - diesel print-schema --config-file=diesel.toml > tmp.schema
       - diff tmp.schema crates/db_schema/src/schema.rs
 
+  check_diesel_migration_revertable:
+    image: willsquire/diesel-cli
+    environment:
+      CARGO_HOME: .cargo
+      DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
+    commands:
+      - diesel migration run
+      - diesel migration redo
+
+  cargo_clippy:
+    image: *muslrust_image
+    environment:
+      CARGO_HOME: .cargo
+    commands:
+      # when adding new clippy lints, make sure to also add them in scripts/fix-clippy.sh
+      - rustup component add clippy
+      - cargo clippy --workspace --tests --all-targets --features console --
+        -D warnings -D deprecated -D clippy::perf -D clippy::complexity
+        -D clippy::style -D clippy::correctness -D clippy::suspicious
+        -D clippy::dbg_macro -D clippy::inefficient_to_string
+        -D clippy::items-after-statements -D clippy::implicit_clone
+        -D clippy::cast_lossless -D clippy::manual_string_new
+        -D clippy::redundant_closure_for_method_calls
+        -D clippy::unused_self
+        -A clippy::uninlined_format_args
+        -D clippy::get_first
+        -D clippy::explicit_into_iter_loop
+        -D clippy::explicit_iter_loop
+        -D clippy::needless_collect
+        -D clippy::unwrap_used
+        -D clippy::indexing_slicing
+    # when:
+    #   platform: linux/amd64
+
   cargo_test:
     image: *muslrust_image
     environment: