THANASOFT-HFC/gestion/lib/Migration/Version8Date20250904141530.php

71 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace OCA\Gestion\Migration;
use Closure;
use OCP\IDBConnection;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
/**
* Auto-generated migration step: Ajout du champ lieu_deces à la table defunt
*/
class Version8Date20250904141530 extends SimpleMigrationStep
{
private IDbConnection $db;
public function __construct(IDbConnection $db)
{
$this->db = $db;
}
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*/
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void
{
}
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options)
{
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
$tableprefix = "gestion_";
/** DEFUNT - Ajout du champ lieu_deces **/
if ($schema->hasTable($tableprefix.'defunt')) {
$table = $schema->getTable($tableprefix.'defunt');
if (!$table->hasColumn('lieu_deces')) {
$table->addColumn('lieu_deces', 'string', [
'length' => 255,
'notnull' => false,
'default' => null
]);
}
}
return $schema;
}
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void
{
}
}