laravel-countries
laravel-countries copied to clipboard
Migration not work on PostgreSQL
Got this error when using PostgreSQL
syntax error at or near "MODIFY" LINE 1: ALTER TABLE countries MODIFY country_code CHAR(3) NOT NULL D... ^ (SQL: ALTER TABLE
I have a branch ready with a fix for the Laravel 5 version (the Laravel 4 version doesn't support changing columns, but since the migrations are generated you are free to adjust the migration to support the database of your choice), however there is a bug in Laravel prohibiting me from releasing it: https://github.com/laravel/framework/issues/9636
Do we need CharifyCountriesTable migration?
No.. For lookups it can also use the included JSON file.
@azulkipli for new projects: technically no, since all it does is ammend the first migration. However we want to be able to add migrations in the future and we want to be able to let users who are already using this package to be able to alter there existing setup rather than having them rollback the migrations and having to reinstall the whole thing...
If technically not needed please make it to support exlcude CharifyCountriesTable when doing
php artisan countries:migration
thank you :)
I fixed the query
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " ALTER COLUMN country_code TYPE CHAR(3)");
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " ALTER COLUMN iso_3166_2 TYPE CHAR(2)");
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " ALTER COLUMN iso_3166_3 TYPE CHAR(3) ");
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " ALTER COLUMN region_code TYPE CHAR(3)");
DB::statement("ALTER TABLE " . DB::getTablePrefix() . \Config::get('countries.table_name') . " ALTER COLUMN sub_region_code TYPE CHAR(3)");