Skip to content
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
15 changes: 5 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.4']
php-version: ['8.2', '8.4']
db-type: [mariadb, mysql, pgsql, sqlite]
prefer-lowest: ['']
cake_version: ['']
include:
- php-version: '8.1'
- php-version: '8.2'
db-type: 'sqlite'
prefer-lowest: 'prefer-lowest'
- php-version: '8.3'
Expand Down Expand Up @@ -106,13 +105,9 @@ jobs:
- name: Composer install
run: |
if [[ ${{ matrix.php-version }} == '8.2' || ${{ matrix.php-version }} == '8.3' || ${{ matrix.php-version }} == '8.4' ]]; then
composer install --ignore-platform-req=php
composer install
elif ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
composer update --prefer-lowest --prefer-stable
elif ${{ matrix.cake_version != '' }}; then
composer require --dev "cakephp/cakephp:${{ matrix.cake_version }}"
composer require --dev --with-all-dependencies "cakephp/bake:dev-3.next as 3.1.0"
composer update
else
composer update
fi
Expand Down Expand Up @@ -151,11 +146,11 @@ jobs:

testsuite-windows:
runs-on: windows-2022
name: Windows - PHP 8.1 & SQL Server
name: Windows - PHP 8.2 & SQL Server

env:
EXTENSIONS: mbstring, intl, pdo_sqlsrv
PHP_VERSION: '8.1'
PHP_VERSION: '8.2'

steps:
- uses: actions/checkout@v5
Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@
"source": "https://github.com/cakephp/migrations"
},
"require": {
"php": ">=8.1",
"cakephp/cache": "^5.2",
"cakephp/orm": "^5.2",
"symfony/config": "^6.0 || ^7.0",
"symfony/console": "^6.0 || ^7.0"
"php": ">=8.2",
"cakephp/cache": "dev-5.next as 5.3.0",
"cakephp/orm": "dev-5.next as 5.3.0"
},
"require-dev": {
"cakephp/bake": "^3.3",
"cakephp/cakephp": "^5.2.5",
"cakephp/cakephp": "dev-5.next as 5.3.0",
"cakephp/cakephp-codesniffer": "^5.0",
"phpunit/phpunit": "^10.5.5 || ^11.1.3 || ^12.2.4"
"phpunit/phpunit": "^11.5.3 || ^12.1.3"
},
"suggest": {
"cakephp/bake": "If you want to generate migrations.",
Expand All @@ -51,7 +49,9 @@
"Migrations\\Test\\": "tests/",
"SimpleSnapshot\\": "tests/test_app/Plugin/SimpleSnapshot/src/",
"TestApp\\": "tests/test_app/App/",
"TestBlog\\": "tests/test_app/Plugin/TestBlog/src/"
"TestBlog\\": "tests/test_app/Plugin/TestBlog/src/",
"Blog\\": "tests/test_app/Plugin/Blog/src/",
"Migrator\\": "tests/test_app/Plugin/Migrator/src/"
}
},
"config": {
Expand Down
35 changes: 0 additions & 35 deletions src/Db/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@
use Migrations\Db\Table\Index;
use Migrations\Db\Table\Table as TableMetadata;
use Migrations\MigrationInterface;
use Migrations\Shim\OutputAdapter;
use PDOException;
use RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Base Abstract Database Adapter.
Expand Down Expand Up @@ -300,38 +297,6 @@ protected function verboseLog(string $message): void
$io->out($message);
}

/**
* @inheritDoc
*/
public function setInput(InputInterface $input): AdapterInterface
{
throw new RuntimeException('Using setInput() interface is not supported.');
}

/**
* @inheritDoc
*/
public function getInput(): ?InputInterface
{
throw new RuntimeException('Using getInput() interface is not supported.');
}

/**
* @inheritDoc
*/
public function setOutput(OutputInterface $output): AdapterInterface
{
throw new RuntimeException('Using setInput() method is not supported');
}

/**
* @inheritDoc
*/
public function getOutput(): OutputInterface
{
return new OutputAdapter($this->io);
}

/**
* Gets the schema table name.
*
Expand Down
4 changes: 4 additions & 0 deletions src/Db/Adapter/AdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ interface AdapterInterface
public const PHINX_TYPE_BINARYUUID = TableSchemaInterface::TYPE_BINARY_UUID;
public const PHINX_TYPE_BOOLEAN = TableSchemaInterface::TYPE_BOOLEAN;
public const PHINX_TYPE_JSON = TableSchemaInterface::TYPE_JSON;
/**
* @deprecated 5.0.0 Use TableSchemaInterface::TYPE_JSON instead.
*/
public const PHINX_TYPE_JSONB = 'jsonb';
public const PHINX_TYPE_UUID = TableSchemaInterface::TYPE_UUID;
public const PHINX_TYPE_NATIVEUUID = TableSchemaInterface::TYPE_NATIVE_UUID;

Expand Down
3 changes: 3 additions & 0 deletions src/Db/Adapter/PostgresAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class PostgresAdapter extends AbstractAdapter
*/
protected static array $specificColumnTypes = [
self::PHINX_TYPE_JSON,
self::PHINX_TYPE_JSONB,
self::PHINX_TYPE_CIDR,
self::PHINX_TYPE_INET,
self::PHINX_TYPE_MACADDR,
Expand Down Expand Up @@ -454,6 +455,8 @@ protected function getChangeColumnInstructions(
$columnSql = $dialect->columnDefinitionSql($this->mapColumnData($newColumn->toArray()));
// Remove the column name from $columnSql
$columnType = preg_replace('/^"?(?:[^"]+)"?\s+/', '', $columnSql);
// Remove generated clause
$columnType = preg_replace('/GENERATED (?:ALWAYS|BY DEFAULT) AS IDENTITY/', '', $columnType);

$sql = sprintf(
'ALTER COLUMN %s TYPE %s',
Expand Down
1 change: 1 addition & 0 deletions src/Db/Table/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ public function toArray(): array
'length' => $length,
'null' => $this->getNull(),
'default' => $default,
'generated' => $this->getGenerated(),
'unsigned' => !$this->getSigned(),
'onUpdate' => $this->getUpdate(),
'collate' => $this->getCollation(),
Expand Down
70 changes: 0 additions & 70 deletions src/Migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,13 @@

use Migrations\Migration\BackendInterface;
use Migrations\Migration\BuiltinBackend;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Output\OutputInterface;

/**
* The Migrations class is responsible for handling migrations command
* within a non-shell application.
*/
class Migrations
{
/**
* The OutputInterface.
* Should be a \Symfony\Component\Console\Output\NullOutput instance
*
* @var \Symfony\Component\Console\Output\OutputInterface
*/
protected OutputInterface $output;

/**
* Default options to use
*
Expand All @@ -50,14 +38,6 @@ class Migrations
*/
protected string $command;

/**
* Stub input to feed the manager class since we might not have an input ready when we get the Manager using
* the `getManager()` method
*
* @var \Symfony\Component\Console\Input\ArrayInput
*/
protected ArrayInput $stubInput;

/**
* Constructor
*
Expand All @@ -69,9 +49,6 @@ class Migrations
*/
public function __construct(array $default = [])
{
$this->output = new NullOutput();
$this->stubInput = new ArrayInput([]);

if ($default) {
$this->default = $default;
}
Expand Down Expand Up @@ -195,51 +172,4 @@ public function seed(array $options = []): bool

return $backend->seed($options);
}

/**
* Get the input needed for each commands to be run
*
* TODO(mark) Remove as part of phinx removal
*
* @param string $command Command name for which we need the InputInterface
* @param array<string, mixed> $arguments Simple key/values array representing the command arguments
* to pass to the InputInterface
* @param array<string, mixed> $options Simple key/values array representing the command options
* to pass to the InputInterface
* @return \Symfony\Component\Console\Input\InputInterface InputInterface needed for the
* Manager to properly run
*/
public function getInput(string $command, array $arguments, array $options): InputInterface
{
$className = 'Migrations\Command\\' . $command;
$options = $arguments + $this->prepareOptions($options);
/** @var \Symfony\Component\Console\Command\Command $command */
$command = new $className();
$definition = $command->getDefinition();

return new ArrayInput($options, $definition);
}

/**
* Prepares the option to pass on to the InputInterface
*
* TODO(mark) Remove as part of phinx removal
*
* @param array<string, mixed> $options Simple key-values array to pass to the InputInterface
* @return array<string, mixed> Prepared $options
*/
protected function prepareOptions(array $options = []): array
{
$options += $this->default;
if (!$options) {
return $options;
}

foreach ($options as $name => $value) {
$options['--' . $name] = $value;
unset($options[$name]);
}

return $options;
}
}
Loading
Loading