Files
lemmy/scripts/sql_format_check.sh
dullbananas df4a79f4b6 Allow running all migrations with minimal dependencies (#5841)
* move schema_setup to separate crate

* remove lemmy_utils dependency

* add db_schema_setup/src/main.rs

* fix diesel.toml

* run diesel print-schema

* fix replaceable_schema paths

* remove unneeded dependencies

* taplo format

* fix duplicated cfg(test) attribute

* move replaceable_schema to crates/db_schema_setup/replaceable_schema

* warn if lemmy_db_schema_setup can be used instead of lemmy_server
2025-07-11 09:36:42 +02:00

21 lines
557 B
Bash
Executable File

#!/usr/bin/env bash
set -e
# This check is only used for CI.
CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
cd "$CWD/../"
# Copy the files to a temp dir
TMP_DIR=$(mktemp -d)
cp -a migrations/. $TMP_DIR/migrations
cp -a crates/db_schema_setup/replaceable_schema/. $TMP_DIR/replaceable_schema
# Format the new files
find $TMP_DIR -type f -name '*.sql' -print0 | xargs -0 -P 10 -L 10 pg_format -i
# Diff the directories
diff -r migrations $TMP_DIR/migrations
diff -r crates/db_schema_setup/replaceable_schema $TMP_DIR/replaceable_schema