-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Conversation
It seems like generated columns only exist as of PostegreSQL 12: This Documentation (5.3 Generated Columns) does not exist on v11 or v10: Edit: Seems to be confirmed by the v12 release notes: https://www.postgresql.org/docs/release/12.0/ |
|
Primary key and foreign key on partitioned tables only exists as of PostgreSQL v11: |
Thanks @Jubeki. We should be able to skip these tests then somehow. |
version_compare(Schema::getConnection()->getServerVersion(), '12.0', '<') This should probably work, as it is also used here:
|
Was thinking more like a Phpunit annotation but I guess Phpunit doesn't uses those anymore? 🤔 |
There is already a check for the used type of database, so I don't think there is an Attribute for that: framework/tests/Integration/Database/SchemaBuilderTest.php Lines 342 to 344 in 13d2886
|
Maybe @crynobone has an idea about the Attributes. |
You need to write one to hook with Testbench, something like: <?php
namespace Illuminate\Tests\Testbench\Attributes;
use Attribute;
use Closure;
use Illuminate\Support\Facades\DB;
use Orchestra\Testbench\Contracts\Attributes\Actionable as ActionableContract;
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
class RequiresDatabase implements ActionableContract
{
/**
* Construct a new attribute.
*
* @param string $driver
* @param string $versionRequirement
*/
public function __construct(public string $driver, public string $versionRequirement)
{
//
}
/**
* Handle the attribute.
*
* @param \Illuminate\Foundation\Application $app
* @param \Closure(string, array<int, mixed>):void $action
* @return void
*/
public function handle($app, Closure $action): void
{
$connection = DB::connection($this->driver);
if (
preg_match('/(?P<operator>[<>=!]{0,2})\s*(?P<version>[\d\.-]+(dev|(RC|alpha|beta)[\d\.])?)[ \t]*\r?$/m', $this->versionRequirement, $matches)
) {
if (empty($matches['operator'])) {
$matches['operator'] = '>=';
}
if (! version_compare($connection->getServerVersion(), $matches['version'], $matches['operator'])) {
call_user_func($action, 'markTestSkipped', [sprintf("Requires %s:%s", $connection->getName(), $this->versionRequirement)]);
}
}
}
} |
It's okay. Fine to leave the current skips. Just need to fix the postgres types failure and then this one is ready to go. |
* Find out which types are not counted * dump types * Bypass count check for pgsql 10
Nice, thanks @Jubeki |
Test the low end supported databases.
Would love to get help getting the tests to pass.