Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: tenant migrations should honor module attributes#643

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
rgraff wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromfix/tenant-migrations-should-honor-module-attributes

Conversation

@rgraff
Copy link
Contributor

@rgraffrgraff commentedOct 20, 2025
edited
Loading

such as @disable_ddl_transaction and @disable_migration_lock

Fixes#610

I was not able to get a failing test for this bug. Ecto would not error, but would give a warning. I have two tests and one generates a warning and the other does not. Since they both pass (even with warnings), it's not a reliable regression test.

Contributor checklist

Leave anything that you believe does not apply unchecked.

  • I accept theAI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

@rgraffrgraffforce-pushed thefix/tenant-migrations-should-honor-module-attributes branch from71577c9 to3073ca0CompareOctober 20, 2025 23:22
such as @disable_ddl_transaction and @disable_migration_lock
@rgraffrgraffforce-pushed thefix/tenant-migrations-should-honor-module-attributes branch from3073ca0 to89c913bCompareOctober 20, 2025 23:26
@rgraffrgraff closed thisOct 20, 2025
@rgraffrgraff reopened thisOct 20, 2025
@rgraff
Copy link
ContributorAuthor

While this fix may work--I'm not 100% certain given the difficulty in testing.

And there's another complication. You still can't do do schema migrations that use theconcurrently: true option in test suites, since sandboxes are always in a transaction.

Maybe the migration generator needs to do something like this

createindex(:posts,[:title],concurrently:Mix.env()!=:test)

@zachdaniel
Copy link
Contributor

Yeah, that makes sense 🤔 We probably will need to figure some other kind of thing out here because you could also be running this in an action that is in a transaction. I'm not sure what the right answer is? Maybe some kind of error if you are in a transaction currently, that can be silenced in test?

@rgraff
Copy link
ContributorAuthor

rgraff commentedOct 21, 2025 via email

Yeah, it will error in a transaction so at least you’ll know it failed. What about changing the generated migration to include some helpers?For example you only need it to be concurrent if there are existing records. So a new tenant doesn’t need to concurrency on for the initial migrations.
On Oct 20, 2025 at 6:13 PM -0700, Zach Daniel ***@***.***>, wrote: zachdaniel left a comment (ash-project/ash_postgres#643) Yeah, that makes sense 🤔 We probably will need to figure some other kind of thing out here because you could also be running this in an action that is in a transaction. I'm not sure what the right answer is? Maybe some kind of error if you are in a transaction currently, that can be silenced in test? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: ***@***.***>

@zachdaniel
Copy link
Contributor

That is a good point. Then future migrations are applied "out of band" out of a transaction. Smart 👍

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Creating indexes concurrently fails for schema-driven multi-tenancy

3 participants

@rgraff@zachdaniel

[8]ページ先頭

©2009-2025 Movatter.jp