db = $db; } /** * @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): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); $tableprefix = "gestion_"; // Vérifier si la table existe if ($schema->hasTable($tableprefix.'client')) { $table = $schema->getTable($tableprefix.'client'); // Ajouter le champ is_tva s'il n'existe pas déjà if (!$table->hasColumn('is_tva')) { $table->addColumn('is_tva', 'smallint', [ 'notnull' => true, 'default' => 1, 'comment' => 'Indique si le client est assujetti à la TVA (1=oui, 0=non)', 'unsigned' => true, 'length' => 1 ]); $output->info('Champ is_tva ajouté à la table gestion_client'); return $schema; } } return null; } }