Skip to content

[IDEA] Add priority for seed files (Discussion wanted) #107

@halvardssm

Description

@halvardssm

Is your feature request related to a problem? Please describe.

The seed files are currently run without any set order (if any it is alphabetical). We should add a property to the migration files which tells Nessie in which order the files should be run and if there are any dependencies/priorities.

As far as my imagination goes, we could do it the following ways, but feel free to chime in if you have another idea (not ordered, but numbered for easy reference):

  1. Have a property in the abstract seed class to set priority
    • Seed files with higher priority (larger number) are done first.
    • When two files have the same priority, the order doesn't matter and it will default to alphabetical.
    • Might be slower (and heavier) if the seed files are large as it requires each seed file to be imported before sorting.
    • My preference, but I am not too fond of the cons
  2. Have the priority in the file name
    • Will be faster as sorting can be done prior to module import.
    • I think this will be ugly and I would prefer not to go for this option (my opinionated opinion).
  3. Use a comment on the first line of the file which can be read before importing
    • Will probably be faster 1, but slower than 2
    • Could be an antipattern
  4. Have a separate priority const export similar to 1, but for the file instead of the class
    • Not sure if this is also an antipattern
    • Could be as slow as 1

Update:
I will leave this open until I get some feedback or I figure out a solid way of doing this. It will not be included in the v2 release, but might be a part of a v2 minor release further down the line

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionLet's discuss this and get some feedbackenhancementNew or improved feature or requestgood first issueGood for newcomersideaNew idea for the projectup for grabsIf you have an implementation in mind, feel free to help us out by making a PR

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions