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

Can not `php artisan world:init' #3

Closed
jamesriady opened this issue Nov 22, 2017 · 7 comments · Fixed by #7
Closed

Can not `php artisan world:init' #3

jamesriady opened this issue Nov 22, 2017 · 7 comments · Fixed by #7

Comments

@jamesriady
Copy link

jamesriady commented Nov 22, 2017

I have followed the step, but it occurs an error when I did php artisan world:init.
I got this error Duplicate table: 7 ERROR: relation unique_locale has already exist
I don't know why and I have checked all my table and I does not have the unique_locale

@jamesriady jamesriady changed the title Can not `php artisan migrate:rollback' Can not `php artisan world:init' Nov 22, 2017
@wildan-m
Copy link

wildan-m commented Dec 5, 2017

I've got this error

`Migration table not found.
Migration table created successfully.

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table world_cities add index uniq_ci ty(country_id, division_id, name))

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

@khsing
Copy link
Owner

khsing commented Dec 5, 2017

Might hit migration bugs, string can't be 256 long. I will take a look.

@kotakorange
Copy link

I have this error when do world:init
SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xF
0\x9F\x87\xB2\xF0\x9F...' for column 'emoji' at row 3

@Deparagon
Copy link

PDOException::("SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x8 7\xA8\xF0\x9F...' for column 'emoji' at row 1")
Same error message ...
I temporarily changed the column datatype to blob in the world_countries table... so that the seed can complete...

@khsing
Copy link
Owner

khsing commented Jul 28, 2018

Hi @Deparagon @kotakorange, you have to use utf8mb4 for your database charset, otherwise you can't using emoji.

@khsing
Copy link
Owner

khsing commented Jul 28, 2018

@wildanmuhlis2 you can add following lines in app/Providers/AppServiceProvider.php to avoid this error.

use Illuminate\Support\Facades\Schema;
...
    public function boot()
    {
        Schema::defaultStringLength(191);
    }
...

@stephenlake
Copy link

stephenlake commented Sep 10, 2018

Why was this issue was closed? Users hijacked the issue with unrelated issues to the original poster and the issue is still present for postgres users.

There's a syntax issue in 3 migration files. A duplicate index name is generated for multiple columns:

CreateWorldContinentsLocaleTable.php:
$table->unique(['continent_id','locale'], 'uniq_locale');

CreateWorldCountriesLocaleTable:
$table->unique(['country_id','locale'], 'uniq_locale');

CreateWorldDivisionsTable.php:
$table->unique(['country_id','name'], 'uniq_division');

You're giving multiple indexes the same name which breaks when using postgres.
Index reference: https://laravel.com/docs/5.7/migrations#indexes

Again, I don't understand why this issue was closed when the following was never attended to:

I have followed the step, but it occurs an error when I did php artisan world:init.
I got this error Duplicate table: 7 ERROR: relation unique_locale has already exist
I don't know why and I have checked all my table and I does not have the unique_locale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants