diff --git a/Makefile b/Makefile index acb562b47b2..151327b2445 100644 --- a/Makefile +++ b/Makefile @@ -95,6 +95,8 @@ endif yarn lint:css @echo "--- README.md ---" make lint_readme + @echo "--- lint migrations ---" + make lint_migrations lint_erb: ## Lints ERB files bundle exec erblint app/views app/components @@ -105,6 +107,9 @@ lint_yaml: normalize_yaml ## Lints YAML files lint_yarn_workspaces: ## Lints Yarn workspace packages scripts/validate-workspaces.js +lint_migrations: + scripts/migration_check + lint_gemfile_lock: Gemfile Gemfile.lock ## Lints the Gemfile and its lockfile @bundle check @git diff-index --quiet HEAD Gemfile.lock || (echo "Error: There are uncommitted changes after running 'bundle install'"; exit 1) diff --git a/scripts/migration_check b/scripts/migration_check new file mode 100755 index 00000000000..f7ef4c873d4 --- /dev/null +++ b/scripts/migration_check @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -d './db/migrate' ] +then + echo "The ./db/migrate folder should not be used for generating migrations" + echo "Use the --database option to specify the database to be used. Example:" + echo "> rails g migration add_my_database_table --database primary" + echo "Then, remove db/migrate" + exit 1 +fi