diff --git a/.github/workflows/migrations.yaml b/.github/workflows/migrations.yaml index 35a7c6b..26feddd 100644 --- a/.github/workflows/migrations.yaml +++ b/.github/workflows/migrations.yaml @@ -45,7 +45,7 @@ jobs: CHANGED_MIGRATION_FILES: ${{ steps.migration-changes.outputs.all_changed_files }} run: | if [[ -n "$CHANGED_MODEL_FILES" && -z "$CHANGED_MIGRATION_FILES" ]]; then - echo "Model Chages detected, but no corresponding migration changes." + echo "Model Chages detected, but no corresponding migration changes. Create the corresponding migrations." exit 1 fi @@ -55,3 +55,16 @@ jobs: fi echo "Changes look valid." + + prevent-changes: + run: | + EXISTING_MIGRATIONS=$(git ls-tree -r HEAD --name-only | grep "core/alembic/versions/.*\.py") + + for migration in $EXISTING_MIGRATION; do + if git diff --name-only HEAD | grep "$migration"; then + echo "An already existing migration should not be edited!" + exit 1 + fi + done + + diff --git a/core/alembic/versions/11cb4f286ec5_create_user_table.py b/core/alembic/versions/11cb4f286ec5_create_user_table.py index cc7f43b..c727208 100644 --- a/core/alembic/versions/11cb4f286ec5_create_user_table.py +++ b/core/alembic/versions/11cb4f286ec5_create_user_table.py @@ -29,6 +29,7 @@ def upgrade() -> None: sa.PrimaryKeyConstraint("uuid"), sa.UniqueConstraint("email"), ) + print("edit") # ### end Alembic commands ### diff --git a/core/services/test_service/models/test_two.py b/core/services/test_service/models/test_two.py deleted file mode 100644 index b7032a1..0000000 --- a/core/services/test_service/models/test_two.py +++ /dev/null @@ -1,2 +0,0 @@ -test = "hi" -print(test) diff --git a/core/services/user_service/models/test.py b/core/services/user_service/models/test.py deleted file mode 100644 index 8a49ce5..0000000 --- a/core/services/user_service/models/test.py +++ /dev/null @@ -1,2 +0,0 @@ -test = "hallo" -print(test)