-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[8.x] PostgreSQL, MSSQL & MariaDB builds #39477
Conversation
@@ -48,7 +48,8 @@ protected function setUp(): void | |||
|
|||
Schema::create('posts_tags', function (Blueprint $table) { | |||
$table->integer('post_id'); | |||
$table->string('tag_id'); | |||
$table->integer('tag_id')->default(0); | |||
$table->string('tag_name')->default('')->nullable(); |
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.
Using an integer for the related custom key leads to errors in PostgreSQL. Since the purpose for the related test is a custom related string key we should also make sure the pivot column has the correct type. There for we need to add one explicitly.
@@ -402,8 +403,8 @@ public function testFindOrNewMethod() | |||
|
|||
$this->assertEquals($tag->id, $post->tags()->findOrNew($tag->id)->id); | |||
|
|||
$this->assertNull($post->tags()->findOrNew('asd')->id); | |||
$this->assertInstanceOf(Tag::class, $post->tags()->findOrNew('asd')); | |||
$this->assertNull($post->tags()->findOrNew(666)->id); |
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.
PostgreSQL specifically fails here if you provide an incorrect type. Since the purpose is just to provide an invalid error, we can simply provide an invalid integer ID.
@@ -59,6 +59,7 @@ public function testItSyncsOriginalOnRefresh() | |||
public function testAsPivot() | |||
{ | |||
Schema::create('post_posts', function (Blueprint $table) { | |||
$table->increments('id'); |
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.
PostgreSQL requires an incrementing ID for this table.
@@ -598,6 +600,7 @@ public function testNoTouchingHappensIfNotConfigured() | |||
$this->assertNotSame('2017-10-10 10:10:10', $tag->fresh()->updated_at->toDateTimeString()); | |||
} | |||
|
|||
/** @group SkipMSSQL */ |
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.
We're explicitly skipping some tests on MSSQL because of the following issue: #27778
At a later point we should refactor these maybe to not insert incremental identifiers.
@@ -135,6 +135,10 @@ public function testWhereHasMorphWithOwnerKey() | |||
$table->string('slug')->nullable(); | |||
}); | |||
|
|||
Schema::table('comments', function (Blueprint $table) { | |||
$table->dropIndex('comments_commentable_type_commentable_id_index'); | |||
}); |
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.
MSSQL was nagging about the index when changing the related column so let's drop it explicitly.
Continuation of #39415 for more engines.