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

[11.x] Add MSSQL 2017 and PGSQL 10 builds #52631

Merged
merged 4 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 97 additions & 2 deletions .github/workflows/databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
env:
DB_CONNECTION: mariadb

pgsql:
pgsql_14:
runs-on: ubuntu-24.04

services:
Expand Down Expand Up @@ -192,7 +192,55 @@ jobs:
DB_USERNAME: forge
DB_PASSWORD: password

mssql:
pgsql_10:
runs-on: ubuntu-24.04

services:
postgresql:
image: postgres:10
env:
POSTGRES_DB: laravel
POSTGRES_USER: forge
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: true

name: PostgreSQL 10

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, :php-psr
tools: composer:v2
coverage: none

- name: Set Framework version
run: composer config version "11.x-dev"

- name: Install dependencies
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: vendor/bin/phpunit tests/Integration/Database
env:
DB_CONNECTION: pgsql
DB_USERNAME: forge
DB_PASSWORD: password

mssql_2019:
runs-on: ubuntu-22.04

services:
Expand Down Expand Up @@ -239,6 +287,53 @@ jobs:
DB_USERNAME: SA
DB_PASSWORD: Forge123

mssql_2017:
runs-on: ubuntu-22.04

services:
sqlsrv:
image: mcr.microsoft.com/mssql/server:2017-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: Forge123
ports:
- 1433:1433

strategy:
fail-fast: true

name: SQL Server 2017

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlsrv, pdo, pdo_sqlsrv, odbc, pdo_odbc, :php-psr
tools: composer:v2
coverage: none

- name: Set Framework version
run: composer config version "11.x-dev"

- name: Install dependencies
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: vendor/bin/phpunit tests/Integration/Database
env:
DB_CONNECTION: sqlsrv
DB_DATABASE: master
DB_USERNAME: SA
DB_PASSWORD: Forge123

sqlite:
runs-on: ubuntu-24.04

Expand Down
4 changes: 4 additions & 0 deletions tests/Integration/Database/Postgres/FulltextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public function testWhereFulltext()

public function testWhereFulltextWithWebsearch()
{
if (version_compare($this->getConnection()->getServerVersion(), '11.0', '<')) {
$this->markTestSkipped('Test requires a PostgreSQL connection >= 11.0');
}

$articles = DB::table('articles')->whereFulltext(['title', 'body'], '+PostgreSQL -YourSQL', ['mode' => 'websearch'])->get();

$this->assertCount(5, $articles);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ public function testGetViews()

public function testDropPartitionedTables()
{
if (version_compare($this->getConnection()->getServerVersion(), '11.0', '<')) {
$this->markTestSkipped('Test requires a PostgreSQL connection >= 11.0');
}

DB::statement('create table groups (id bigserial, tenant_id bigint, name varchar, primary key (id, tenant_id)) partition by hash (tenant_id)');
DB::statement('create table groups_1 partition of groups for values with (modulus 2, remainder 0)');
DB::statement('create table groups_2 partition of groups for values with (modulus 2, remainder 1)');
Expand Down
11 changes: 10 additions & 1 deletion tests/Integration/Database/SchemaBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,12 @@ public function testGetAndDropTypes()

$types = Schema::getTypes();

$this->assertCount(13, $types);
if (version_compare($this->getConnection()->getServerVersion(), '14.0', '<')) {
$this->assertCount(10, $types);
} else {
$this->assertCount(13, $types);
}

$this->assertTrue(collect($types)->contains(fn ($type) => $type['name'] === 'pseudo_foo' && $type['type'] === 'pseudo' && ! $type['implicit']));
$this->assertTrue(collect($types)->contains(fn ($type) => $type['name'] === 'comp_foo' && $type['type'] === 'composite' && ! $type['implicit']));
$this->assertTrue(collect($types)->contains(fn ($type) => $type['name'] === 'enum_foo' && $type['type'] === 'enum' && ! $type['implicit']));
Expand Down Expand Up @@ -669,6 +674,10 @@ public function testModifyingStoredColumnOnSqlite()

public function testGettingGeneratedColumns()
{
if ($this->driver === 'pgsql' && version_compare($this->getConnection()->getServerVersion(), '12.0', '<')) {
$this->markTestSkipped('Test requires a PostgreSQL connection >= 12.0');
}

Schema::create('test', function (Blueprint $table) {
$table->integer('price');

Expand Down