da_agency/lib/Migration/Version000001Date2021052112...

108 lines
2.9 KiB
PHP

<?php
namespace OCA\Agency\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
class Version000001Date20210521125400 extends SimpleMigrationStep {
/**
* @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();
if (!$schema->hasTable('agencys')) {
$table = $schema->createTable('agencys');
$table->addColumn('id', 'integer', [
'autoincrement' => true,
'notnull' => true,
]);
$table->addColumn('name', 'string', [
'notnull' => false,
'length' => 200
]);
$table->addColumn('inhaber', 'string', [
'notnull' => false,
'length' => 200
]);
$table->addColumn('street', 'string', [
'notnull' => false,
'length' => 200
]);
$table->addColumn('city', 'string', [
'notnull' => false,
'length' => 200
]);
$table->addColumn('plz', 'string', [
'notnull' => false,
'length' => 5
]);
$table->addColumn('agencymail', 'string', [
'notnull' => false,
'length' => 200
]);
$table->addColumn('phone', 'string', [
'notnull' => false,
'length' => 200
]);
$table->addColumn('agencygid', 'string', [
'notnull' => true,
'default' => '',
'length' => 200
]);
$table->addColumn('agencydirid', 'integer', [
'notnull' => true,
'default' => 0,
'length' => 200
]);
$table->addColumn('standarddirid', 'integer', [
'notnull' => true,
'default' => 0,
'length' => 200
]);
$table->setPrimaryKey(['id']);
}
if (!$schema->hasTable('grouppermission')) {
$table = $schema->createTable('grouppermission');
$table->addColumn('id', 'integer', [
'autoincrement' => true,
'notnull' => true,
]);
$table->addColumn('gid', 'string', [
'notnull' => false,
'length' => 500
]);
$table->addColumn('permissions', 'string', [
'notnull' => false,
'length' => 10000
]);
$table->setPrimaryKey(['id']);
}
return $schema;
}
}