php artisan migrate: Class Schema not found











up vote
4
down vote

favorite












When doing a migration, in the Windows console I execute the command:



php artisan migrate


When I run the command, it shows me the following error:



[SymfonyComponentDebugExceptionFatalErrorException]
Class 'MarketProvidersSchema' not found


I would be very grateful if anyone can help me.










share|improve this question




























    up vote
    4
    down vote

    favorite












    When doing a migration, in the Windows console I execute the command:



    php artisan migrate


    When I run the command, it shows me the following error:



    [SymfonyComponentDebugExceptionFatalErrorException]
    Class 'MarketProvidersSchema' not found


    I would be very grateful if anyone can help me.










    share|improve this question


























      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      When doing a migration, in the Windows console I execute the command:



      php artisan migrate


      When I run the command, it shows me the following error:



      [SymfonyComponentDebugExceptionFatalErrorException]
      Class 'MarketProvidersSchema' not found


      I would be very grateful if anyone can help me.










      share|improve this question















      When doing a migration, in the Windows console I execute the command:



      php artisan migrate


      When I run the command, it shows me the following error:



      [SymfonyComponentDebugExceptionFatalErrorException]
      Class 'MarketProvidersSchema' not found


      I would be very grateful if anyone can help me.







      php database laravel web-applications artisan-migrate






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 5 '17 at 13:51









      jedrzej.kurylo

      25.1k54664




      25.1k54664










      asked May 5 '17 at 13:34









      FranMoronR

      2112




      2112
























          3 Answers
          3






          active

          oldest

          votes

















          up vote
          10
          down vote













          add following line on the top of that page (AppServiceProvider.php under providers directory)



          use IlluminateSupportFacadesSchema;





          share|improve this answer




























            up vote
            4
            down vote













            It looks like you have fixed another problems with the message "Laravel 5.4: Specified key was too long error" using this article where you were recommended to add following code



            use IlluminateSupportFacadesSchema;

            public function boot()
            {
            Schema::defaultStringLength(191);
            }


            to the file named




            AppServiceProvider.php




            and you actually only chaned the boot method and forget to update the use section. Am I right?



            The Article says:




            Laravel 5.4 made a change to the default database character set, and
            it’s now utf8mb4 which includes support for storing emojis. This only
            affects new applications and as long as you are running MySQL v5.7.7
            and higher you do not need to do anything.



            For those running MariaDB or older versions of MySQL you may hit this
            error when trying to run migrations:



            [IlluminateDatabaseQueryException] SQLSTATE[42000]: Syntax error or
            access violation: 1071 Specified key was too long; max key length is
            767 bytes (SQL: alter table users add unique
            users_email_unique(email))

            [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071
            Specified key was too long; max key length is 767 bytes






            share|improve this answer






























              up vote
              2
              down vote













              It seems your migration code is in a namespace and that's where PHP is looking for Schema class. Add the following at the top of your file:



              use Schema;


              or refer to the Schema class using fully qualified namespace:



              Schema::table(...);





              share|improve this answer





















                Your Answer






                StackExchange.ifUsing("editor", function () {
                StackExchange.using("externalEditor", function () {
                StackExchange.using("snippets", function () {
                StackExchange.snippets.init();
                });
                });
                }, "code-snippets");

                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "1"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43806387%2fphp-artisan-migrate-class-schema-not-found%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                10
                down vote













                add following line on the top of that page (AppServiceProvider.php under providers directory)



                use IlluminateSupportFacadesSchema;





                share|improve this answer

























                  up vote
                  10
                  down vote













                  add following line on the top of that page (AppServiceProvider.php under providers directory)



                  use IlluminateSupportFacadesSchema;





                  share|improve this answer























                    up vote
                    10
                    down vote










                    up vote
                    10
                    down vote









                    add following line on the top of that page (AppServiceProvider.php under providers directory)



                    use IlluminateSupportFacadesSchema;





                    share|improve this answer












                    add following line on the top of that page (AppServiceProvider.php under providers directory)



                    use IlluminateSupportFacadesSchema;






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Sep 17 '17 at 13:43









                    Sabyasachi Ghosh

                    458313




                    458313
























                        up vote
                        4
                        down vote













                        It looks like you have fixed another problems with the message "Laravel 5.4: Specified key was too long error" using this article where you were recommended to add following code



                        use IlluminateSupportFacadesSchema;

                        public function boot()
                        {
                        Schema::defaultStringLength(191);
                        }


                        to the file named




                        AppServiceProvider.php




                        and you actually only chaned the boot method and forget to update the use section. Am I right?



                        The Article says:




                        Laravel 5.4 made a change to the default database character set, and
                        it’s now utf8mb4 which includes support for storing emojis. This only
                        affects new applications and as long as you are running MySQL v5.7.7
                        and higher you do not need to do anything.



                        For those running MariaDB or older versions of MySQL you may hit this
                        error when trying to run migrations:



                        [IlluminateDatabaseQueryException] SQLSTATE[42000]: Syntax error or
                        access violation: 1071 Specified key was too long; max key length is
                        767 bytes (SQL: alter table users add unique
                        users_email_unique(email))

                        [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071
                        Specified key was too long; max key length is 767 bytes






                        share|improve this answer



























                          up vote
                          4
                          down vote













                          It looks like you have fixed another problems with the message "Laravel 5.4: Specified key was too long error" using this article where you were recommended to add following code



                          use IlluminateSupportFacadesSchema;

                          public function boot()
                          {
                          Schema::defaultStringLength(191);
                          }


                          to the file named




                          AppServiceProvider.php




                          and you actually only chaned the boot method and forget to update the use section. Am I right?



                          The Article says:




                          Laravel 5.4 made a change to the default database character set, and
                          it’s now utf8mb4 which includes support for storing emojis. This only
                          affects new applications and as long as you are running MySQL v5.7.7
                          and higher you do not need to do anything.



                          For those running MariaDB or older versions of MySQL you may hit this
                          error when trying to run migrations:



                          [IlluminateDatabaseQueryException] SQLSTATE[42000]: Syntax error or
                          access violation: 1071 Specified key was too long; max key length is
                          767 bytes (SQL: alter table users add unique
                          users_email_unique(email))

                          [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071
                          Specified key was too long; max key length is 767 bytes






                          share|improve this answer

























                            up vote
                            4
                            down vote










                            up vote
                            4
                            down vote









                            It looks like you have fixed another problems with the message "Laravel 5.4: Specified key was too long error" using this article where you were recommended to add following code



                            use IlluminateSupportFacadesSchema;

                            public function boot()
                            {
                            Schema::defaultStringLength(191);
                            }


                            to the file named




                            AppServiceProvider.php




                            and you actually only chaned the boot method and forget to update the use section. Am I right?



                            The Article says:




                            Laravel 5.4 made a change to the default database character set, and
                            it’s now utf8mb4 which includes support for storing emojis. This only
                            affects new applications and as long as you are running MySQL v5.7.7
                            and higher you do not need to do anything.



                            For those running MariaDB or older versions of MySQL you may hit this
                            error when trying to run migrations:



                            [IlluminateDatabaseQueryException] SQLSTATE[42000]: Syntax error or
                            access violation: 1071 Specified key was too long; max key length is
                            767 bytes (SQL: alter table users add unique
                            users_email_unique(email))

                            [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071
                            Specified key was too long; max key length is 767 bytes






                            share|improve this answer














                            It looks like you have fixed another problems with the message "Laravel 5.4: Specified key was too long error" using this article where you were recommended to add following code



                            use IlluminateSupportFacadesSchema;

                            public function boot()
                            {
                            Schema::defaultStringLength(191);
                            }


                            to the file named




                            AppServiceProvider.php




                            and you actually only chaned the boot method and forget to update the use section. Am I right?



                            The Article says:




                            Laravel 5.4 made a change to the default database character set, and
                            it’s now utf8mb4 which includes support for storing emojis. This only
                            affects new applications and as long as you are running MySQL v5.7.7
                            and higher you do not need to do anything.



                            For those running MariaDB or older versions of MySQL you may hit this
                            error when trying to run migrations:



                            [IlluminateDatabaseQueryException] SQLSTATE[42000]: Syntax error or
                            access violation: 1071 Specified key was too long; max key length is
                            767 bytes (SQL: alter table users add unique
                            users_email_unique(email))

                            [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071
                            Specified key was too long; max key length is 767 bytes







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Nov 8 at 6:15

























                            answered Aug 27 '17 at 8:38









                            Yevgeniy Afanasyev

                            7,59344264




                            7,59344264






















                                up vote
                                2
                                down vote













                                It seems your migration code is in a namespace and that's where PHP is looking for Schema class. Add the following at the top of your file:



                                use Schema;


                                or refer to the Schema class using fully qualified namespace:



                                Schema::table(...);





                                share|improve this answer

























                                  up vote
                                  2
                                  down vote













                                  It seems your migration code is in a namespace and that's where PHP is looking for Schema class. Add the following at the top of your file:



                                  use Schema;


                                  or refer to the Schema class using fully qualified namespace:



                                  Schema::table(...);





                                  share|improve this answer























                                    up vote
                                    2
                                    down vote










                                    up vote
                                    2
                                    down vote









                                    It seems your migration code is in a namespace and that's where PHP is looking for Schema class. Add the following at the top of your file:



                                    use Schema;


                                    or refer to the Schema class using fully qualified namespace:



                                    Schema::table(...);





                                    share|improve this answer












                                    It seems your migration code is in a namespace and that's where PHP is looking for Schema class. Add the following at the top of your file:



                                    use Schema;


                                    or refer to the Schema class using fully qualified namespace:



                                    Schema::table(...);






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered May 5 '17 at 13:51









                                    jedrzej.kurylo

                                    25.1k54664




                                    25.1k54664






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Stack Overflow!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.





                                        Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                        Please pay close attention to the following guidance:


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43806387%2fphp-artisan-migrate-class-schema-not-found%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        這個網誌中的熱門文章

                                        Academy of Television Arts & Sciences

                                        L'Équipe

                                        1995 France bombings