-
Notifications
You must be signed in to change notification settings - Fork 33
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
Migrations fixes #117
Migrations fixes #117
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combining two dropColumn into one is ok.
However deleting the
$table->dropForeign('fk_expense_expense_category');
in migration file
database/migrations/2023_01_04_164114_update_webpage_content_table.php
gives error while migrating in MySql. It seems that this line is needed. Please check by trying to run the migrations in MySql.
Also,
$table->text('title')->after('position')->nullable()->change();
$table->text('body')->after('title')->nullable()->change();
$table->string('image_path')->after('body')->nullable()->change();
in thses lines ->change() is needed because these columns are created in
database/migrations/2022_04_10_132549_create_webpage_content_table.php
migrations file. If you remove the ->change() part then migrations fail in MySql. Please check by running migrations in MySql.
I changed the commits. this solves migrations problems for both mysql and sqlite. on the other hand this requires Laravel migration to v11 because of 51373 For Laravel v11 migration: "laravel/framework": "^11.0",
"nunomaduro/collision": "^8.0",
"phpunit/phpunit": "^11.0" and |
Thanks for the update. As this involves switching from Laravel 10 to Laravel 11 will need some time to test it. Maybe will update in next 4-5 hours. Thanks for patience. |
Thanks, take your time to make sure the system works fines after upgrading to Laravel 11. what about PHP version upgrade to 8.3 or 8.4 ? |
MySql migrations are running fine after the pull request. However SqLite migration is failing when I am trying. Migration file
is failing. With below error:
Are you sure migrations are running fine in SqLite ? I am getting the above error. If SqLite migrations are running fine in your machine, then maybe I should check again? |
I did below steps:
and tried again. However I am still getting the same error.
Not sure what the issue is. Is there anything I am missing while trying to delete all caches in storage/ & bootstrap/cache/ ? Also not sure if the versions we are same: php 8.2.26 Please confirm. |
run migrations for sqlite & mysql with success
|
I'm creating a new branch to refactor tests. The goal is to create a single dummy test that runs migrations, then check if this test passes on Github Action. |
I added github actions to run just one test, and the test that runs the migrations on sqlite works. check it out https://github.com/ismaail/samarium/actions also check the branch tests to see commits to make github actions runs. |
Oddly, I am still getting the same error. I tried with below versions as well:
Just to rule out if this was happening because of different versions are php and sqlite. However even after updating to php8.3 and Sqlite to 3.45 I am getting the same error while running migrations in SQLite. Not sure about clear the cache part. Is running |
Try all of this php artisan clear
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan config:clear If the problem persist, for now make sure migrations works fine with MySQL. |
also can you share your |
Yes this works in MySql. So going to merge now. Maybe we can resolve Sqlite issue later. Perhaps we can track that issue in a new issue. Thanks for your update. |
ok. Open an issue for with full details (including |
to reproduce this errosr:.env
file changeDB_CONNECTION=sqlite
database/database.sqlite
php artisan migration:fresh
. WARNING: this destroys the entire database.Error:SQLite doesn't support multiple calls to dropColumn / renameColumn in a single modification.
files:
database/migrations/2022_08_08_100418_update_expense_table_drop_old_columns.php
database/migrations/2023_01_04_164114_update_webpage_content_table.php
Error:SQLite doesn't support dropping foreign keys (you would need to re-create the table).
file:
database/migrations/2022_08_08_100418_update_expense_table_drop_old_columns.php
Error:There is no column with name "title", "body", "image_path" on table "webpage_content".
->change()
is for chaning an existing column not for creating a new one.file: `database/migrations/2023_02_13_181000_update_webpage_content_table_make_nullable.php~~