Comments (7)
/cc @hafezdivandari
from framework.
Hi @adiachenko,
Did you log and compare the Schema::create()
queries between Laravel 10 and 11?
from framework.
I went through our migrations one by one and managed to distill some sort of example to replicate the issue.
Assume we have the following SQL schema dump file:
CREATE TABLE partners (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
support_priority INTEGER DEFAULT 0 NOT NULL,
);
Then we have the following 2 migrations to run on top of that file:
Schema::table('partners', function (Blueprint $table) {
$table->unsignedSmallInteger('partner_type')->nullable();
});
Schema::table('partners', function (Blueprint $table) {
$table->unsignedSmallInteger('partner_type')->default(0)->change();
});
When running the second alter table statement Laravel 11 will execute the following queries:
create table "__temp__partners" (
"id" integer primary key autoincrement not null,
"support_priority" integer not null,
"partner_type" integer not null default '0'
);
drop table "partners";
alter table
"__temp__partners" rename to "partners";
Note how support_priority is now just not null
somehow without any default.
After I manually replaced default 0 with default '0' in schema dump it generated a correct query.
create table "__temp__partners" (
"id" integer primary key autoincrement not null,
"support_priority" integer not null default '0',
"partner_type" integer not null default '0'
)
However, I do not like this "fix", because it will be overridden each time I recreate SQL dump meaning I will need to manually change all of these again.
from framework.
@staudenmeir thank you for mentioning me.
The issue seems to be on the following line, causes default 0
to be null
:
I'm on vacation until Friday, and can't send a PR till then.
from framework.
Thank you for reporting this issue!
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Thank you!
from framework.
A possible workaround is to manually update the schema dump to use DEFAULT '0' instead of DEFAULT 0. However, this isn't ideal as it requires manual intervention each time the schema dump is recreated.
I suggest opening a pull request to address this issue in SQLiteGrammar.php.
from framework.
You may check PR #51803
from framework.
Related Issues (20)
- SQLite queries generated by Eloquent with non existing columns in WHERE clause should generate an error/exception but don't HOT 1
- Laravel 10 mailer failover inline image crackd. when the first mail send fail HOT 3
- `Bus::chain` Skipping jobs with readonly non-scalar properties HOT 3
- RequiredIf validator with multiple values fails validating HOT 1
- Incorrect Sorting with UUID Data Type in MariaDB HOT 2
- orWhere ignore the first condition (where)
- Web and API non existing route files usage does not trigger an error when loaded from bootstrap/app file HOT 1
- `view()` is rendered when passed as component attribute HOT 1
- 2006 MySQL server has gone away in queue:work scenario HOT 1
- Closure in job chain is not called if preceded by job batch HOT 2
- Error with AJAX request HOT 1
- Custom cast class overrides the related column HOT 6
- Any form validation request class has strange behaviour with annotations
- sebastian/comparator should be an explicit dependency HOT 1
- current transaction is aborted, commands ignored until end of transaction block on listener when implement ShoudlQueue HOT 1
- Change password failed.
- attempts() method does not exist on FakeJob HOT 1
- Issue with MS SQL for compileForeignKeys HOT 1
- Passing value to class castable attribute HOT 4
- Incorrect responses in Str `after` methods.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from framework.