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

Feature: Flag a migration as tenant based. #39

Open
BenMorganIO opened this issue Mar 8, 2017 · 6 comments
Open

Feature: Flag a migration as tenant based. #39

BenMorganIO opened this issue Mar 8, 2017 · 6 comments

Comments

@BenMorganIO
Copy link
Contributor

When importing migrations from a package, it would be great if I could be able to flag a migration as supposing to run for tenants, rather than for the public schema.

This way, when I'm developing a package, I can Add a flag as a configuration to my package. That way when a user goes to add the latest migrations from a version update, they don't have to worry about C&P'ing them into the tenant_migrations folder.

@Dania02525
Copy link
Owner

Do you mean keeping them in the same /migrations folder, but respecting some @tag or something inside of the file?

The difficulty there is that Ecto parses that folder and runs all files in it against the public schema. I think doing that would require a PR to Ecto itself. Is that what you mean?

@BenMorganIO
Copy link
Contributor Author

@Dania02525 yep. I think letting the Ecto guys know would be helpful. I wonder if there's a way though that we could change it up from that use Ecto.Migration and switch it to something like Apartmentex.Migration and try and add the flag on Apartmentex's end.

@Dania02525
Copy link
Owner

@BenMorganIO actually, the original implementation of apartmentex looked like that use Apartmentex.Migration which was a light wrapper around Ecto.migration. I would have to dig a little bit into the new code managing the migrations in Ecto to see if it could ignore modules in the same folder

@brandonparsons
Copy link

FYI - I got this commit into Ecto, which may get you somewhere on this issue.

I don't think it's in the Hex version yet.

@BenMorganIO
Copy link
Contributor Author

Thankyou @brandonparsons. This helps :)

@BenMorganIO
Copy link
Contributor Author

@Dania02525 here's an example of an implementation I've been working on: ryal/ryal#3

I'm thinking I'll just add a flag to Ryal to be able to do the mix ryal.install into a different migration folder.

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

3 participants