Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test helper "migrate" causes failure when use with real applications #254

Open
jayvdb opened this issue Apr 20, 2024 · 0 comments
Open

test helper "migrate" causes failure when use with real applications #254

jayvdb opened this issue Apr 20, 2024 · 0 comments

Comments

@jayvdb
Copy link
Collaborator

jayvdb commented Apr 20, 2024

db_setup creates and migrates a mem migration of None -> "current".

If an application then uses its own migrations, either embedded or from disk, the migration will fail on postgres because the objects already exist in the database.

testall_no_migrate can be used as a workaround, but it is nice for most tests to be using the "auto-migrate" testall so the test can assume it doesnt need to migrate, and it doesnt matter if the application does a migrate, which would be a no-op.

The fix is for db_setup to copy any existing disk migrations into a MemMigrations, and then add another MemMigration for "current" if there are pending changes. This shouldnt slow down the tests here too much, as butane/ tests dont have any disk migrations.

I've got a branch that does this, but then I got distracted with other things and created a few more important PRs which will conflict with this. So this is mostly a reminder to self.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant