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

Migration hierarchy not working #626

Closed
yubarajshrestha opened this issue Apr 14, 2022 · 6 comments
Closed

Migration hierarchy not working #626

yubarajshrestha opened this issue Apr 14, 2022 · 6 comments
Labels
bug An existing feature is not working as intended

Comments

@yubarajshrestha
Copy link
Contributor

Describe the bug
If you have multiple migrations in package development then we need a way to maintain the hierarchy of migrations.

To Reproduce
Steps to reproduce the behavior:

  1. Start basic package development
  2. Add few migration files with relations in it
  3. Try to migrate and see the order of migrations created

Expected behavior
Should be able to maintain the order of migrations registered.

@yubarajshrestha yubarajshrestha added the bug An existing feature is not working as intended label Apr 14, 2022
@girardinsamuel
Copy link
Contributor

girardinsamuel commented Apr 18, 2022

Summarizing the specs to fix this issue here (from Discord):

👉 The proposed solution was to add an index in the migration filename: {timestamp}_{index}_{name}.py.
This index would be computed based on the list of existing migrations in the migrations folder.

@josephmancuso is that correct ?

@girardinsamuel
Copy link
Contributor

@yubarajshrestha Are you okay with the specs above ?

@yubarajshrestha
Copy link
Contributor Author

yubarajshrestha commented Apr 25, 2022

@yubarajshrestha Are you okay with the specs above ?

Yes, you're right. You should order those migrations based_on order of migrations added in migrations.

.migrations(
                "migrations/first_table.py",
                "migrations/secon_table.py",
                "migrations/third_table.py",
            )

@girardinsamuel
Copy link
Contributor

Yes, you're right. You should order those migrations based_on order of migrations added in migrations.

☝️ Yes you're right. But that become a Masonite issue then. I will transfer this issue to the Masonite repo.

@josephmancuso
Copy link
Member

@yubarajshrestha
Copy link
Contributor Author

I think this is solve https://github.com/MasoniteFramework/masonite/blob/4.0/src/masonite/packages/providers/PackageProvider.py#L150

@josephmancuso if you try to migrate the migration with above solution that will give you error if you try migrating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An existing feature is not working as intended
Projects
None yet
Development

No branches or pull requests

3 participants