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

Allow users to defer some migrations until after graph loads on load_package #10635

Open
johnatawnclementawn opened this issue Feb 28, 2024 · 3 comments

Comments

@johnatawnclementawn
Copy link
Member

When load_package is run currently, all Django migrations for core Arches, the project, and any installed Arches Applications are run prior to loading graphs. The desire is to be to be able to run migrations, especially migrations in a given Arches Application (say RDM/ADM/Arches Lingo), after graphs are loaded.

The use case in mind is a scenario in which a given migration runs __arches_create_resource_model_views() to initialize the relational views for a given model. The relational views schema will fail to be created if there are no models imported. It'd be nice to be able to indicate that a given migration should be run after graphs have been loaded. We've seen this scenario in the current RDM work as well as work for SF Port Lease Pipeline - Applications app.

The current work around is to revert to a prior migration and then the re-run the migration to create the relational views.

re. recent conversations with @robgaston and @jacobtylerwalls

@jacobtylerwalls
Copy link
Member

jacobtylerwalls commented Feb 29, 2024

Two more alternatives (maybe better?):

  1. create the views in post_sql part of package load
  2. create the graphs in the migration (then importing the graphs as part of package load could still overwrite them, and the views would still work?)

I asked @johnatawnclementawn to raise this proposal, but I'm starting to like 2. a lot more. We probably don't want to encourage the practice of writing migrations that have dependencies on things outside the migration system.

@bferguso
Copy link
Contributor

I had a similar requirement. My work around for it was to add the scripts to the pkg/business_data/resource_views folder. I agree it would be more desirable to have them as part of a migration to be consistent.

@chrabyrd
Copy link
Contributor

While not tenable in the long run, the workaround I've been using is to have the first migration of an Arches Application have a dependency on the last migration of Arches core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

4 participants