Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    How to migrate package by command line

    General Discussion
    2
    2
    419
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • _
      _developer_12 last edited by

      I have created migration but not understanding that how to migrate any migration for package.

      I have tried to run "php artisan migrate" command on root folder but my migration file exist on package folder not a root folder.

      Please tell me how can i solve this problem ?

      Thanks ,

      1 Reply Last reply Reply Quote 0
      • A
        aayush.bhatt172 last edited by

        Hi _developer_12.

        It will work. Just follow these simple steps:

        1. Create your migration file inside (yourpackage -> src -> Database -> Migrations)
        2. Now, go to your service provider class (yourpackage -> src -> Providers -> yourpackageServiceprovider.php)
        3. Inside the boot() function add this code:
          $this->loadMigrationsFrom(__DIR __ . '/../Database/Migrations');
          ps. -> (In the above code remove the space beteween DIR and __)
        4. Now run the command (composer dump-autoload).

        After that run php artisan migrate and it will migrate your tables.

        Feel free to revert back in any kind of confusion or query.
        Thanks

        1 Reply Last reply Reply Quote 0
        • First post
          Last post