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

[8.x] PostgreSQL, MSSQL & MariaDB builds #39477

Merged
merged 19 commits into from
Nov 4, 2021
Merged

[8.x] PostgreSQL, MSSQL & MariaDB builds #39477

merged 19 commits into from
Nov 4, 2021

Conversation

driesvints
Copy link
Member

Continuation of #39415 for more engines.

@@ -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();
Copy link
Member Author

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);
Copy link
Member Author

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');
Copy link
Member Author

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.

@driesvints driesvints changed the title [8.x] PostgreSQL build [8.x] PostgreSQL, MariaDB & SQL Server builds Nov 4, 2021
@driesvints driesvints changed the title [8.x] PostgreSQL, MariaDB & SQL Server builds [8.x] PostgreSQL, MariaDB & MSSQL builds Nov 4, 2021
@driesvints driesvints changed the title [8.x] PostgreSQL, MariaDB & MSSQL builds [8.x] PostgreSQL & MariaDB builds Nov 4, 2021
@driesvints driesvints changed the title [8.x] PostgreSQL & MariaDB builds [8.x] PostgreSQL, MSSQL & MariaDB builds Nov 4, 2021
@@ -598,6 +600,7 @@ public function testNoTouchingHappensIfNotConfigured()
$this->assertNotSame('2017-10-10 10:10:10', $tag->fresh()->updated_at->toDateTimeString());
}

/** @group SkipMSSQL */
Copy link
Member Author

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');
});
Copy link
Member Author

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.

@driesvints driesvints marked this pull request as ready for review November 4, 2021 16:58
@taylorotwell taylorotwell merged commit 5e837d5 into 8.x Nov 4, 2021
@taylorotwell taylorotwell deleted the db-builds branch November 4, 2021 19:34
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 this pull request may close these issues.

2 participants