bikeshedder / tusker

PostgreSQL migration management tool
The Unlicense
213 stars 17 forks source link

Diff repeatedly creates identical migrations for functions #29

Open kjcsb1 opened 1 year ago

kjcsb1 commented 1 year ago

I have a schema that has been diffed to create a migration. When I run the diff subsequently, the generated migration contains all of the function statements already contained in the original migration. This behaviour occurs repeatedly.

tusker --version
tusker 0.5.1

cat tusker.toml
[schema]
filename = "db/init/raytio_custom_db_entities/*.sql"

[migrations]
filename = "db/migrations/*.sql"

[database]
url = "postgresql://postgres:password@1.2.3.4:5432/postgres"

[migra]
safe = true
privileges = false

Steps to reproduce:

tusker --verbose diff > db/migrations/20230401_0817.sql
tusker --verbose diff > db/migrations/20230401_0818.sql
tusker --verbose diff > db/migrations/20230401_0819.sql

Note that 20230401_0818.sql and 20230401_0819.sql are identical files and contain all of the CREATE OR REPLACE FUNCTION statements already contained in 20230401_0817.sql

Possibly relevant: I get an SQLAlchemy warning when running the diff

RemovedIn20Warning: Deprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. To prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy<2.0". Set environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings.  Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
  result = self.c.execute(*args, **kwargs)
bikeshedder commented 1 year ago

Tusker relies on migra for the actual diffing. Could you please report this issue on the migra issue tracker?

danielnixon commented 1 year ago

https://github.com/djrobstep/migra/issues/222 looks related