Closed JGuiher closed 5 years ago
Hello @JGuiher, could you post the full stacktrace? Thanks
I have no idea what a full stacktrace is. I did a search and maybe it is the full error thrown? If this doesn't help just tell me what I have to run to get what you need. Thanks.
Could you provide your db driver name and version too? Thanks
Is this it?
Server type: MySQL Server version: 5.6.39-cll-lve - MySQL Community Server (GPL) Protocol version: 10
Server charset: UTF-8 Unicode (utf8)
Database client version: libmysql - 5.1.73 PHP extension: mysqliDocumentation curlDocumentation mbstringDocumentation PHP version: 5.6.30
I've detected the possible issue. Will test it out tonight and push a fix, stay tuned. Thanks for reporting @JGuiher
I updated all 6 of those files, still get the same exact error on the taxes table. Removed it and the rest of the migration ran perfect.
I will need to run some tests then with your environment that you are using and get back to you. Sadly I'm cursed with really bad internet connection until Sunday so I will give my best to spin up some Docker containers and check it out, I'll get back to you soon then @JGuiher
Yes, sorry for the issue. I much appreciate the fast help.
I just tried an experiment, and it migrates properly if I give name and type a set length.
I used 50.
I searched some and I think maybe it is that combining those as unique they are too long without a set max length?
Can you check if your engine
attribute inside config/database.php
, mysql
connection is null
?
Yes it is.
Do you want me to change it to InnoDB?
It is in an answer I found here which made me try the length experiment.
You can change it and use it as a temporary solution until probably tomorrow, because at this time the connection gets really bad and i can't be of much help. Also, changing the length of all keys that make an index to 191
will do the trick, but since that will affect all users, I will need to find a better solution to include that rule only when really needed.
@JGuiher Can you give me your environment info so I can replicate the issue? I will need your php version, correct laravel version (again) and mysql version (also again)
Apache Version | 2.4.33 |
---|---|
PHP Version | 5.6.36 - actually no idea why it says this, I am on PHP 7.2 and that is what it shows in cpanel |
MySQL Version | 5.6.39-cll-lve |
Architecture | x86_64 |
Operating System | linux |
Laravel is 5.7.27
The library is installable for php > 7.0.0
only. I've just tested against the same environment you have and the migrations passed successfully when I added bellow line to AppServiceProvider:boot
method:
...
public function boot()
{
Schema::defaultStringLength(191);
}
...
Laravel doesn't do this for you automatically because it can't assume which DB driver you are using and even less which version of it. Tested this against a fresh installment of laravel 5.7.27 and it works after adding the above line in the AppServiceProvider:boot
method. I don't think this is a library issue, but I feel free to comment further here until we resolve your issue.
I have the schema 191 line already added, but I possibly have a typo I don't see.
Sorry to have had these issues, but I got it working now with the previous workaround.
PS, your help was incredible. Thanks.
You probably did make a typo, I would advise you keep that change and also try to insert that line of code into AppServiceProvider
, but without typos. :) Feel free to reopen the issue if you need further help with this issue.
I am very new to this kind of stuff, so sorry if I ask dumb questions.
I am following your tutorial on medium.com
I got to where I do the database migration, and it created some tables, but I got a 1071 specified key is too long error for the nikolag_taxes table.
It created the table in my database, but not the appropriate migration entry.
I have customers, customer_user, taxes and transactions for tables. Are there more missing?
I am on Laravel 5.7.27 so I have the default string length variable set at 191.
Thanks.