This repository has been archived by the owner on Nov 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from conrad784/nextcloud-22
fix: executed occ migrations:generate-from-schema
- Loading branch information
Showing
2 changed files
with
67 additions
and
75 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OCA\UserISPConfig\Migration; | ||
|
||
use Closure; | ||
use OCP\DB\ISchemaWrapper; | ||
use OCP\Migration\IOutput; | ||
use OCP\Migration\SimpleMigrationStep; | ||
|
||
/** | ||
* Auto-generated migration step: Please modify to your needs! | ||
*/ | ||
class Version0049Date20211023151735 extends SimpleMigrationStep { | ||
|
||
/** | ||
* @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): ?ISchemaWrapper { | ||
/** @var ISchemaWrapper $schema */ | ||
$schema = $schemaClosure(); | ||
|
||
if (!$schema->hasTable('users_ispconfig')) { | ||
$table = $schema->createTable('users_ispconfig'); | ||
$table->addColumn('uid', 'string', [ | ||
'notnull' => true, | ||
'length' => 64, | ||
'default' => '', | ||
]); | ||
$table->addColumn('displayname', 'string', [ | ||
'notnull' => false, | ||
'length' => 64, | ||
]); | ||
$table->addColumn('mailbox', 'string', [ | ||
'notnull' => false, | ||
'length' => 64, | ||
]); | ||
$table->addColumn('domain', 'string', [ | ||
'notnull' => false, | ||
'length' => 64, | ||
]); | ||
$table->setPrimaryKey(['uid']); | ||
$table->addUniqueIndex(['mailbox', 'domain'], 'mailaddress_unique'); | ||
} | ||
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 { | ||
} | ||
} |