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

seed:run command ignores connection option #689

Closed
os-nikita opened this issue May 25, 2022 · 3 comments · Fixed by #690 or #715
Closed

seed:run command ignores connection option #689

os-nikita opened this issue May 25, 2022 · 3 comments · Fixed by #690 or #715
Labels
bug An existing feature is not working as intended

Comments

@os-nikita
Copy link

os-nikita commented May 25, 2022

Describe the bug

The connection option is available on seed:run (and migrate:refresh when used together), but this option is ignored, resulting in the default database connection always being used.

Expected behaviour

No response

Steps to reproduce the bug

No response

Screenshots

No response

OS

macOS

OS version

Monterey 12.3.1

Browser

No response

Masonite Version

4.12.1

Anything else ?

No response

@os-nikita os-nikita added the bug An existing feature is not working as intended label May 25, 2022
@josephmancuso josephmancuso transferred this issue from MasoniteFramework/masonite May 27, 2022
@os-nikita
Copy link
Author

os-nikita commented Jun 6, 2022

@josephmancuso #690 only fixed this on the migrate:refresh command passthrough.

The underlying issue is still that seed:run (SeedRunCommand's) code does not use the connection option at all from what I can tell.

image

Would simply adding Model.on(...) suffice in your opinion?

@josephmancuso josephmancuso reopened this Jun 6, 2022
@josephmancuso
Copy link
Member

I'll update this for the seed:run as well I guess I missed that in the PR

This was referenced Jun 8, 2022
@josephmancuso
Copy link
Member

The best i can do right now is setting the connection on the seeder class so you can do something like this:

class UserTableSeeder(Seeder):

    def run(self):
        """Run the database seeds."""
        factory(User.on(self.connection), 5).create({
            'name': 'Joe',
            'password': 'joe',
        })

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
2 participants