| @@ -40,122 +40,122 @@ | ||
| 40 | 40 | $application->add(new OC\Core\Command\App\CheckCode($infoParser)); | 
| 41 | 41 | $application->add(new OC\Core\Command\L10n\CreateJs()); | 
| 42 | 42 | $application->add(new \OC\Core\Command\Integrity\SignApp( | 
| 43 | - \OC::$server->getIntegrityCodeChecker(), | |
| 44 | - new \OC\IntegrityCheck\Helpers\FileAccessHelper(), | |
| 45 | - \OC::$server->getURLGenerator() | |
| 43 | + \OC::$server->getIntegrityCodeChecker(), | |
| 44 | + new \OC\IntegrityCheck\Helpers\FileAccessHelper(), | |
| 45 | + \OC::$server->getURLGenerator() | |
| 46 | 46 | )); | 
| 47 | 47 | $application->add(new \OC\Core\Command\Integrity\SignCore( | 
| 48 | - \OC::$server->getIntegrityCodeChecker(), | |
| 49 | - new \OC\IntegrityCheck\Helpers\FileAccessHelper() | |
| 48 | + \OC::$server->getIntegrityCodeChecker(), | |
| 49 | + new \OC\IntegrityCheck\Helpers\FileAccessHelper() | |
| 50 | 50 | )); | 
| 51 | 51 | $application->add(new \OC\Core\Command\Integrity\CheckApp( | 
| 52 | - \OC::$server->getIntegrityCodeChecker() | |
| 52 | + \OC::$server->getIntegrityCodeChecker() | |
| 53 | 53 | )); | 
| 54 | 54 | $application->add(new \OC\Core\Command\Integrity\CheckCore( | 
| 55 | - \OC::$server->getIntegrityCodeChecker() | |
| 55 | + \OC::$server->getIntegrityCodeChecker() | |
| 56 | 56 | )); | 
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 |  if (\OC::$server->getConfig()->getSystemValue('installed', false)) { | 
| 60 | - $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager())); | |
| 61 | - $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager())); | |
| 62 | - $application->add(new OC\Core\Command\App\Install()); | |
| 63 | - $application->add(new OC\Core\Command\App\GetPath()); | |
| 64 | - $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager())); | |
| 60 | + $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager())); | |
| 61 | + $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager())); | |
| 62 | + $application->add(new OC\Core\Command\App\Install()); | |
| 63 | + $application->add(new OC\Core\Command\App\GetPath()); | |
| 64 | + $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager())); | |
| 65 | 65 | |
| 66 | - $application->add(new OC\Core\Command\TwoFactorAuth\Enable( | |
| 67 | - \OC::$server->getTwoFactorAuthManager(), \OC::$server->getUserManager() | |
| 68 | - )); | |
| 69 | - $application->add(new OC\Core\Command\TwoFactorAuth\Disable( | |
| 70 | - \OC::$server->getTwoFactorAuthManager(), \OC::$server->getUserManager() | |
| 71 | - )); | |
| 66 | + $application->add(new OC\Core\Command\TwoFactorAuth\Enable( | |
| 67 | + \OC::$server->getTwoFactorAuthManager(), \OC::$server->getUserManager() | |
| 68 | + )); | |
| 69 | + $application->add(new OC\Core\Command\TwoFactorAuth\Disable( | |
| 70 | + \OC::$server->getTwoFactorAuthManager(), \OC::$server->getUserManager() | |
| 71 | + )); | |
| 72 | 72 | |
| 73 | - $application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig())); | |
| 74 | - $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig())); | |
| 75 | - $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig())); | |
| 73 | + $application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig())); | |
| 74 | + $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig())); | |
| 75 | + $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig())); | |
| 76 | 76 | |
| 77 | - $application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig())); | |
| 78 | - $application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig())); | |
| 79 | - $application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig())); | |
| 80 | - $application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig())); | |
| 81 | - $application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig())); | |
| 82 | - $application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig())); | |
| 83 | - $application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig())); | |
| 84 | - $application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig())); | |
| 77 | + $application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig())); | |
| 78 | + $application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig())); | |
| 79 | + $application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig())); | |
| 80 | + $application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig())); | |
| 81 | + $application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig())); | |
| 82 | + $application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig())); | |
| 83 | + $application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig())); | |
| 84 | + $application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig())); | |
| 85 | 85 | |
| 86 | - $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig()))); | |
| 87 | - $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->getLogger())); | |
| 88 | - $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->getDatabaseConnection())); | |
| 89 | - $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->getDatabaseConnection())); | |
| 90 | - $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->getDatabaseConnection())); | |
| 91 | - $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->getDatabaseConnection())); | |
| 92 | - $application->add(new OC\Core\Command\Db\Migrations\GenerateFromSchemaFileCommand(\OC::$server->getConfig(), \OC::$server->getAppManager(), \OC::$server->getDatabaseConnection())); | |
| 93 | - $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig())); | |
| 86 | + $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig()))); | |
| 87 | + $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->getLogger())); | |
| 88 | + $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->getDatabaseConnection())); | |
| 89 | + $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->getDatabaseConnection())); | |
| 90 | + $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->getDatabaseConnection())); | |
| 91 | + $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->getDatabaseConnection())); | |
| 92 | + $application->add(new OC\Core\Command\Db\Migrations\GenerateFromSchemaFileCommand(\OC::$server->getConfig(), \OC::$server->getAppManager(), \OC::$server->getDatabaseConnection())); | |
| 93 | + $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig())); | |
| 94 | 94 | |
| 95 | - $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig())); | |
| 96 | - $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager())); | |
| 97 | - $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager())); | |
| 98 | - $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager())); | |
| 99 | - $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager())); | |
| 100 | - $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper())); | |
| 101 | - $application->add(new OC\Core\Command\Encryption\DecryptAll( | |
| 102 | - \OC::$server->getEncryptionManager(), | |
| 103 | - \OC::$server->getAppManager(), | |
| 104 | - \OC::$server->getConfig(), | |
| 105 | - new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()), | |
| 106 | - new \Symfony\Component\Console\Helper\QuestionHelper()) | |
| 107 | - ); | |
| 95 | + $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig())); | |
| 96 | + $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager())); | |
| 97 | + $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager())); | |
| 98 | + $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager())); | |
| 99 | + $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager())); | |
| 100 | + $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper())); | |
| 101 | + $application->add(new OC\Core\Command\Encryption\DecryptAll( | |
| 102 | + \OC::$server->getEncryptionManager(), | |
| 103 | + \OC::$server->getAppManager(), | |
| 104 | + \OC::$server->getConfig(), | |
| 105 | + new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()), | |
| 106 | + new \Symfony\Component\Console\Helper\QuestionHelper()) | |
| 107 | + ); | |
| 108 | 108 | |
| 109 | - $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig())); | |
| 110 | - $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig())); | |
| 109 | + $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig())); | |
| 110 | + $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig())); | |
| 111 | 111 | |
| 112 | - $view = new \OC\Files\View(); | |
| 113 | - $util = new \OC\Encryption\Util( | |
| 114 | - $view, | |
| 115 | - \OC::$server->getUserManager(), | |
| 116 | - \OC::$server->getGroupManager(), | |
| 117 | - \OC::$server->getConfig() | |
| 118 | - ); | |
| 119 | - $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot( | |
| 120 | - $view, | |
| 121 | - \OC::$server->getUserManager(), | |
| 122 | - \OC::$server->getConfig(), | |
| 123 | - $util, | |
| 124 | - new \Symfony\Component\Console\Helper\QuestionHelper() | |
| 125 | - ) | |
| 126 | - ); | |
| 127 | - $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util)); | |
| 112 | + $view = new \OC\Files\View(); | |
| 113 | + $util = new \OC\Encryption\Util( | |
| 114 | + $view, | |
| 115 | + \OC::$server->getUserManager(), | |
| 116 | + \OC::$server->getGroupManager(), | |
| 117 | + \OC::$server->getConfig() | |
| 118 | + ); | |
| 119 | + $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot( | |
| 120 | + $view, | |
| 121 | + \OC::$server->getUserManager(), | |
| 122 | + \OC::$server->getConfig(), | |
| 123 | + $util, | |
| 124 | + new \Symfony\Component\Console\Helper\QuestionHelper() | |
| 125 | + ) | |
| 126 | + ); | |
| 127 | + $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util)); | |
| 128 | 128 | |
| 129 | - $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory())); | |
| 130 | - $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader())); | |
| 131 | - $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector())); | |
| 132 | - $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig())); | |
| 133 | - $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess()); | |
| 134 | - $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory())); | |
| 129 | + $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory())); | |
| 130 | + $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader())); | |
| 131 | + $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector())); | |
| 132 | + $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig())); | |
| 133 | + $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess()); | |
| 134 | + $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory())); | |
| 135 | 135 | |
| 136 | - $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger())); | |
| 137 | - $application->add(new OC\Core\Command\Maintenance\Repair( | |
| 138 | - new \OC\Repair(\OC\Repair::getRepairSteps(), \OC::$server->getEventDispatcher()), \OC::$server->getConfig(), | |
| 139 | - \OC::$server->getEventDispatcher())); | |
| 136 | + $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger())); | |
| 137 | + $application->add(new OC\Core\Command\Maintenance\Repair( | |
| 138 | + new \OC\Repair(\OC\Repair::getRepairSteps(), \OC::$server->getEventDispatcher()), \OC::$server->getConfig(), | |
| 139 | + \OC::$server->getEventDispatcher())); | |
| 140 | 140 | |
| 141 | - $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); | |
| 142 | - $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager())); | |
| 143 | - $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager())); | |
| 144 | - $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager())); | |
| 145 | - $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager())); | |
| 146 | - $application->add(new OC\Core\Command\User\Report(\OC::$server->getUserManager())); | |
| 147 | - $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager())); | |
| 148 | - $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection())); | |
| 149 | - $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager())); | |
| 150 | - $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); | |
| 141 | + $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); | |
| 142 | + $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager())); | |
| 143 | + $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager())); | |
| 144 | + $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager())); | |
| 145 | + $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager())); | |
| 146 | + $application->add(new OC\Core\Command\User\Report(\OC::$server->getUserManager())); | |
| 147 | + $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager())); | |
| 148 | + $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection())); | |
| 149 | + $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager())); | |
| 150 | + $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); | |
| 151 | 151 | |
| 152 | - $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager())); | |
| 153 | - $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); | |
| 154 | - $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); | |
| 152 | + $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager())); | |
| 153 | + $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); | |
| 154 | + $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); | |
| 155 | 155 | |
| 156 | -	$application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(null), \OC::$server->getL10N('core'))); | |
| 157 | - $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager(null))); | |
| 158 | - $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager(null))); | |
| 156 | +    $application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(null), \OC::$server->getL10N('core'))); | |
| 157 | + $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager(null))); | |
| 158 | + $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager(null))); | |
| 159 | 159 |  } else { | 
| 160 | - $application->add(new OC\Core\Command\Maintenance\Install(\OC::$server->getSystemConfig())); | |
| 160 | + $application->add(new OC\Core\Command\Maintenance\Install(\OC::$server->getSystemConfig())); | |
| 161 | 161 | } | 
| @@ -30,890 +30,890 @@ | ||
| 30 | 30 | |
| 31 | 31 |  class Version13000Date20170718121200 extends SimpleMigrationStep { | 
| 32 | 32 | |
| 33 | - /** | |
| 34 | - * @param IOutput $output | |
| 35 | - * @param \Closure $schemaClosure The `\Closure` returns a `Schema` | |
| 36 | - * @param array $options | |
| 37 | - * @return null|Schema | |
| 38 | - * @since 13.0.0 | |
| 39 | - */ | |
| 40 | -	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { | |
| 41 | - /** @var Schema $schema */ | |
| 42 | - $schema = $schemaClosure(); | |
| 43 | - | |
| 44 | -		if (!$schema->hasTable('appconfig')) { | |
| 45 | -			$table = $schema->createTable('appconfig'); | |
| 46 | -			$table->addColumn('appid', 'string', [ | |
| 47 | - 'notnull' => true, | |
| 48 | - 'length' => 32, | |
| 49 | - 'default' => '', | |
| 50 | - ]); | |
| 51 | -			$table->addColumn('configkey', 'string', [ | |
| 52 | - 'notnull' => true, | |
| 53 | - 'length' => 64, | |
| 54 | - 'default' => '', | |
| 55 | - ]); | |
| 56 | -			$table->addColumn('configvalue', 'text', [ | |
| 57 | - 'notnull' => false, | |
| 58 | - ]); | |
| 59 | - $table->setPrimaryKey(['appid', 'configkey']); | |
| 60 | - $table->addIndex(['configkey'], 'appconfig_config_key_index'); | |
| 61 | - $table->addIndex(['appid'], 'appconfig_appid_key'); | |
| 62 | - } | |
| 63 | - | |
| 64 | -		if (!$schema->hasTable('storages')) { | |
| 65 | -			$table = $schema->createTable('storages'); | |
| 66 | -			$table->addColumn('id', 'string', [ | |
| 67 | - 'notnull' => false, | |
| 68 | - 'length' => 64, | |
| 69 | - ]); | |
| 70 | -			$table->addColumn('numeric_id', Type::BIGINT, [ | |
| 71 | - 'autoincrement' => true, | |
| 72 | - 'notnull' => true, | |
| 73 | - 'length' => 20, | |
| 74 | - ]); | |
| 75 | -			$table->addColumn('available', 'integer', [ | |
| 76 | - 'notnull' => true, | |
| 77 | - 'default' => 1, | |
| 78 | - ]); | |
| 79 | -			$table->addColumn('last_checked', 'integer', [ | |
| 80 | - 'notnull' => false, | |
| 81 | - ]); | |
| 82 | - $table->setPrimaryKey(['numeric_id']); | |
| 83 | - $table->addUniqueIndex(['id'], 'storages_id_index'); | |
| 84 | - } | |
| 85 | - | |
| 86 | -		if (!$schema->hasTable('mounts')) { | |
| 87 | -			$table = $schema->createTable('mounts'); | |
| 88 | -			$table->addColumn('id', 'integer', [ | |
| 89 | - 'autoincrement' => true, | |
| 90 | - 'notnull' => true, | |
| 91 | - 'length' => 4, | |
| 92 | - ]); | |
| 93 | -			$table->addColumn('storage_id', 'integer', [ | |
| 94 | - 'notnull' => true, | |
| 95 | - ]); | |
| 96 | -			$table->addColumn('root_id', 'integer', [ | |
| 97 | - 'notnull' => true, | |
| 98 | - ]); | |
| 99 | -			$table->addColumn('user_id', 'string', [ | |
| 100 | - 'notnull' => true, | |
| 101 | - 'length' => 64, | |
| 102 | - ]); | |
| 103 | -			$table->addColumn('mount_point', 'string', [ | |
| 104 | - 'notnull' => true, | |
| 105 | - 'length' => 4000, | |
| 106 | - ]); | |
| 107 | -			$table->addColumn('mount_id', 'integer', [ | |
| 108 | - 'notnull' => false, | |
| 109 | - ]); | |
| 110 | - $table->setPrimaryKey(['id']); | |
| 111 | - $table->addIndex(['user_id'], 'mounts_user_index'); | |
| 112 | - $table->addIndex(['storage_id'], 'mounts_storage_index'); | |
| 113 | - $table->addIndex(['root_id'], 'mounts_root_index'); | |
| 114 | - $table->addIndex(['mount_id'], 'mounts_mount_id_index'); | |
| 115 | - $table->addUniqueIndex(['user_id', 'root_id'], 'mounts_user_root_index'); | |
| 116 | - } | |
| 117 | - | |
| 118 | -		if (!$schema->hasTable('mimetypes')) { | |
| 119 | -			$table = $schema->createTable('mimetypes'); | |
| 120 | -			$table->addColumn('id', Type::BIGINT, [ | |
| 121 | - 'autoincrement' => true, | |
| 122 | - 'notnull' => true, | |
| 123 | - 'length' => 20, | |
| 124 | - ]); | |
| 125 | -			$table->addColumn('mimetype', 'string', [ | |
| 126 | - 'notnull' => true, | |
| 127 | - 'length' => 255, | |
| 128 | - 'default' => '', | |
| 129 | - ]); | |
| 130 | - $table->setPrimaryKey(['id']); | |
| 131 | - $table->addUniqueIndex(['mimetype'], 'mimetype_id_index'); | |
| 132 | - } | |
| 133 | - | |
| 134 | -		if (!$schema->hasTable('filecache')) { | |
| 135 | -			$table = $schema->createTable('filecache'); | |
| 136 | -			$table->addColumn('fileid', Type::BIGINT, [ | |
| 137 | - 'autoincrement' => true, | |
| 138 | - 'notnull' => true, | |
| 139 | - 'length' => 20, | |
| 140 | - ]); | |
| 141 | -			$table->addColumn('storage', Type::BIGINT, [ | |
| 142 | - 'notnull' => true, | |
| 143 | - 'length' => 20, | |
| 144 | - 'default' => 0, | |
| 145 | - ]); | |
| 146 | -			$table->addColumn('path', 'string', [ | |
| 147 | - 'notnull' => false, | |
| 148 | - 'length' => 4000, | |
| 149 | - ]); | |
| 150 | -			$table->addColumn('path_hash', 'string', [ | |
| 151 | - 'notnull' => true, | |
| 152 | - 'length' => 32, | |
| 153 | - 'default' => '', | |
| 154 | - ]); | |
| 155 | -			$table->addColumn('parent', Type::BIGINT, [ | |
| 156 | - 'notnull' => true, | |
| 157 | - 'length' => 20, | |
| 158 | - 'default' => 0, | |
| 159 | - ]); | |
| 160 | -			$table->addColumn('name', 'string', [ | |
| 161 | - 'notnull' => false, | |
| 162 | - 'length' => 250, | |
| 163 | - ]); | |
| 164 | -			$table->addColumn('mimetype', Type::BIGINT, [ | |
| 165 | - 'notnull' => true, | |
| 166 | - 'length' => 20, | |
| 167 | - 'default' => 0, | |
| 168 | - ]); | |
| 169 | -			$table->addColumn('mimepart', Type::BIGINT, [ | |
| 170 | - 'notnull' => true, | |
| 171 | - 'length' => 20, | |
| 172 | - 'default' => 0, | |
| 173 | - ]); | |
| 174 | -			$table->addColumn('size', 'bigint', [ | |
| 175 | - 'notnull' => true, | |
| 176 | - 'length' => 8, | |
| 177 | - 'default' => 0, | |
| 178 | - ]); | |
| 179 | -			$table->addColumn('mtime', 'integer', [ | |
| 180 | - 'notnull' => true, | |
| 181 | - 'length' => 4, | |
| 182 | - 'default' => 0, | |
| 183 | - ]); | |
| 184 | -			$table->addColumn('storage_mtime', 'integer', [ | |
| 185 | - 'notnull' => true, | |
| 186 | - 'length' => 4, | |
| 187 | - 'default' => 0, | |
| 188 | - ]); | |
| 189 | -			$table->addColumn('encrypted', 'integer', [ | |
| 190 | - 'notnull' => true, | |
| 191 | - 'length' => 4, | |
| 192 | - 'default' => 0, | |
| 193 | - ]); | |
| 194 | -			$table->addColumn('unencrypted_size', 'bigint', [ | |
| 195 | - 'notnull' => true, | |
| 196 | - 'length' => 8, | |
| 197 | - 'default' => 0, | |
| 198 | - ]); | |
| 199 | -			$table->addColumn('etag', 'string', [ | |
| 200 | - 'notnull' => false, | |
| 201 | - 'length' => 40, | |
| 202 | - ]); | |
| 203 | -			$table->addColumn('permissions', 'integer', [ | |
| 204 | - 'notnull' => false, | |
| 205 | - 'length' => 4, | |
| 206 | - 'default' => 0, | |
| 207 | - ]); | |
| 208 | -			$table->addColumn('checksum', 'string', [ | |
| 209 | - 'notnull' => false, | |
| 210 | - 'length' => 255, | |
| 211 | - ]); | |
| 212 | - $table->setPrimaryKey(['fileid']); | |
| 213 | - $table->addUniqueIndex(['storage', 'path_hash'], 'fs_storage_path_hash'); | |
| 214 | - $table->addIndex(['parent', 'name'], 'fs_parent_name_hash'); | |
| 215 | - $table->addIndex(['storage', 'mimetype'], 'fs_storage_mimetype'); | |
| 216 | - $table->addIndex(['storage', 'mimepart'], 'fs_storage_mimepart'); | |
| 217 | - $table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size'); | |
| 218 | - } | |
| 219 | - | |
| 220 | -		if (!$schema->hasTable('group_user')) { | |
| 221 | -			$table = $schema->createTable('group_user'); | |
| 222 | -			$table->addColumn('gid', 'string', [ | |
| 223 | - 'notnull' => true, | |
| 224 | - 'length' => 64, | |
| 225 | - 'default' => '', | |
| 226 | - ]); | |
| 227 | -			$table->addColumn('uid', 'string', [ | |
| 228 | - 'notnull' => true, | |
| 229 | - 'length' => 64, | |
| 230 | - 'default' => '', | |
| 231 | - ]); | |
| 232 | - $table->setPrimaryKey(['gid', 'uid']); | |
| 233 | - $table->addIndex(['uid'], 'gu_uid_index'); | |
| 234 | - } | |
| 235 | - | |
| 236 | -		if (!$schema->hasTable('group_admin')) { | |
| 237 | -			$table = $schema->createTable('group_admin'); | |
| 238 | -			$table->addColumn('gid', 'string', [ | |
| 239 | - 'notnull' => true, | |
| 240 | - 'length' => 64, | |
| 241 | - 'default' => '', | |
| 242 | - ]); | |
| 243 | -			$table->addColumn('uid', 'string', [ | |
| 244 | - 'notnull' => true, | |
| 245 | - 'length' => 64, | |
| 246 | - 'default' => '', | |
| 247 | - ]); | |
| 248 | - $table->setPrimaryKey(['gid', 'uid']); | |
| 249 | - $table->addIndex(['uid'], 'group_admin_uid'); | |
| 250 | - } | |
| 251 | - | |
| 252 | -		if (!$schema->hasTable('groups')) { | |
| 253 | -			$table = $schema->createTable('groups'); | |
| 254 | -			$table->addColumn('gid', 'string', [ | |
| 255 | - 'notnull' => true, | |
| 256 | - 'length' => 64, | |
| 257 | - 'default' => '', | |
| 258 | - ]); | |
| 259 | - $table->setPrimaryKey(['gid']); | |
| 260 | - } | |
| 261 | - | |
| 262 | -		if (!$schema->hasTable('preferences')) { | |
| 263 | -			$table = $schema->createTable('preferences'); | |
| 264 | -			$table->addColumn('userid', 'string', [ | |
| 265 | - 'notnull' => true, | |
| 266 | - 'length' => 64, | |
| 267 | - 'default' => '', | |
| 268 | - ]); | |
| 269 | -			$table->addColumn('appid', 'string', [ | |
| 270 | - 'notnull' => true, | |
| 271 | - 'length' => 32, | |
| 272 | - 'default' => '', | |
| 273 | - ]); | |
| 274 | -			$table->addColumn('configkey', 'string', [ | |
| 275 | - 'notnull' => true, | |
| 276 | - 'length' => 64, | |
| 277 | - 'default' => '', | |
| 278 | - ]); | |
| 279 | -			$table->addColumn('configvalue', 'text', [ | |
| 280 | - 'notnull' => false, | |
| 281 | - ]); | |
| 282 | - $table->setPrimaryKey(['userid', 'appid', 'configkey']); | |
| 283 | - } | |
| 284 | - | |
| 285 | -		if (!$schema->hasTable('properties')) { | |
| 286 | -			$table = $schema->createTable('properties'); | |
| 287 | -			$table->addColumn('id', 'integer', [ | |
| 288 | - 'autoincrement' => true, | |
| 289 | - 'notnull' => true, | |
| 290 | - 'length' => 4, | |
| 291 | - ]); | |
| 292 | -			$table->addColumn('userid', 'string', [ | |
| 293 | - 'notnull' => true, | |
| 294 | - 'length' => 64, | |
| 295 | - 'default' => '', | |
| 296 | - ]); | |
| 297 | -			$table->addColumn('propertypath', 'string', [ | |
| 298 | - 'notnull' => true, | |
| 299 | - 'length' => 255, | |
| 300 | - 'default' => '', | |
| 301 | - ]); | |
| 302 | -			$table->addColumn('propertyname', 'string', [ | |
| 303 | - 'notnull' => true, | |
| 304 | - 'length' => 255, | |
| 305 | - 'default' => '', | |
| 306 | - ]); | |
| 307 | -			$table->addColumn('propertyvalue', 'text', [ | |
| 308 | - 'notnull' => true, | |
| 309 | - ]); | |
| 310 | - $table->setPrimaryKey(['id']); | |
| 311 | - $table->addIndex(['userid'], 'property_index'); | |
| 312 | - } | |
| 313 | - | |
| 314 | -		if (!$schema->hasTable('share')) { | |
| 315 | -			$table = $schema->createTable('share'); | |
| 316 | -			$table->addColumn('id', 'integer', [ | |
| 317 | - 'autoincrement' => true, | |
| 318 | - 'notnull' => true, | |
| 319 | - 'length' => 4, | |
| 320 | - ]); | |
| 321 | -			$table->addColumn('share_type', 'smallint', [ | |
| 322 | - 'notnull' => true, | |
| 323 | - 'length' => 1, | |
| 324 | - 'default' => 0, | |
| 325 | - ]); | |
| 326 | -			$table->addColumn('share_with', 'string', [ | |
| 327 | - 'notnull' => false, | |
| 328 | - 'length' => 255, | |
| 329 | - ]); | |
| 330 | -			$table->addColumn('password', 'string', [ | |
| 331 | - 'notnull' => false, | |
| 332 | - 'length' => 255, | |
| 333 | - ]); | |
| 334 | -			$table->addColumn('uid_owner', 'string', [ | |
| 335 | - 'notnull' => true, | |
| 336 | - 'length' => 64, | |
| 337 | - 'default' => '', | |
| 338 | - ]); | |
| 339 | -			$table->addColumn('uid_initiator', 'string', [ | |
| 340 | - 'notnull' => false, | |
| 341 | - 'length' => 64, | |
| 342 | - ]); | |
| 343 | -			$table->addColumn('parent', 'integer', [ | |
| 344 | - 'notnull' => false, | |
| 345 | - 'length' => 4, | |
| 346 | - ]); | |
| 347 | -			$table->addColumn('item_type', 'string', [ | |
| 348 | - 'notnull' => true, | |
| 349 | - 'length' => 64, | |
| 350 | - 'default' => '', | |
| 351 | - ]); | |
| 352 | -			$table->addColumn('item_source', 'string', [ | |
| 353 | - 'notnull' => false, | |
| 354 | - 'length' => 255, | |
| 355 | - ]); | |
| 356 | -			$table->addColumn('item_target', 'string', [ | |
| 357 | - 'notnull' => false, | |
| 358 | - 'length' => 255, | |
| 359 | - ]); | |
| 360 | -			$table->addColumn('file_source', 'integer', [ | |
| 361 | - 'notnull' => false, | |
| 362 | - 'length' => 4, | |
| 363 | - ]); | |
| 364 | -			$table->addColumn('file_target', 'string', [ | |
| 365 | - 'notnull' => false, | |
| 366 | - 'length' => 512, | |
| 367 | - ]); | |
| 368 | -			$table->addColumn('permissions', 'smallint', [ | |
| 369 | - 'notnull' => true, | |
| 370 | - 'length' => 1, | |
| 371 | - 'default' => 0, | |
| 372 | - ]); | |
| 373 | -			$table->addColumn('stime', 'bigint', [ | |
| 374 | - 'notnull' => true, | |
| 375 | - 'length' => 8, | |
| 376 | - 'default' => 0, | |
| 377 | - ]); | |
| 378 | -			$table->addColumn('accepted', 'smallint', [ | |
| 379 | - 'notnull' => true, | |
| 380 | - 'length' => 1, | |
| 381 | - 'default' => 0, | |
| 382 | - ]); | |
| 383 | -			$table->addColumn('expiration', 'datetime', [ | |
| 384 | - 'notnull' => false, | |
| 385 | - ]); | |
| 386 | -			$table->addColumn('token', 'string', [ | |
| 387 | - 'notnull' => false, | |
| 388 | - 'length' => 32, | |
| 389 | - ]); | |
| 390 | -			$table->addColumn('mail_send', 'smallint', [ | |
| 391 | - 'notnull' => true, | |
| 392 | - 'length' => 1, | |
| 393 | - 'default' => 0, | |
| 394 | - ]); | |
| 395 | -			$table->addColumn('share_name', 'string', [ | |
| 396 | - 'notnull' => false, | |
| 397 | - 'length' => 64, | |
| 398 | - ]); | |
| 399 | - $table->setPrimaryKey(['id']); | |
| 400 | - $table->addIndex(['item_type', 'share_type'], 'item_share_type_index'); | |
| 401 | - $table->addIndex(['file_source'], 'file_source_index'); | |
| 402 | - $table->addIndex(['token'], 'token_index'); | |
| 403 | - } | |
| 404 | - | |
| 405 | -		if (!$schema->hasTable('jobs')) { | |
| 406 | -			$table = $schema->createTable('jobs'); | |
| 407 | -			$table->addColumn('id', 'integer', [ | |
| 408 | - 'autoincrement' => true, | |
| 409 | - 'notnull' => true, | |
| 410 | - 'length' => 4, | |
| 411 | - 'unsigned' => true, | |
| 412 | - ]); | |
| 413 | -			$table->addColumn('class', 'string', [ | |
| 414 | - 'notnull' => true, | |
| 415 | - 'length' => 255, | |
| 416 | - 'default' => '', | |
| 417 | - ]); | |
| 418 | -			$table->addColumn('argument', 'string', [ | |
| 419 | - 'notnull' => true, | |
| 420 | - 'length' => 4000, | |
| 421 | - 'default' => '', | |
| 422 | - ]); | |
| 423 | -			$table->addColumn('last_run', 'integer', [ | |
| 424 | - 'notnull' => false, | |
| 425 | - 'default' => 0, | |
| 426 | - ]); | |
| 427 | -			$table->addColumn('last_checked', 'integer', [ | |
| 428 | - 'notnull' => false, | |
| 429 | - 'default' => 0, | |
| 430 | - ]); | |
| 431 | -			$table->addColumn('reserved_at', 'integer', [ | |
| 432 | - 'notnull' => false, | |
| 433 | - 'default' => 0, | |
| 434 | - ]); | |
| 435 | -			$table->addColumn('execution_duration', 'integer', [ | |
| 436 | - 'notnull' => true, | |
| 437 | - 'default' => 0, | |
| 438 | - ]); | |
| 439 | - $table->setPrimaryKey(['id']); | |
| 440 | - $table->addIndex(['class'], 'job_class_index'); | |
| 441 | - } | |
| 442 | - | |
| 443 | -		if (!$schema->hasTable('users')) { | |
| 444 | -			$table = $schema->createTable('users'); | |
| 445 | -			$table->addColumn('uid', 'string', [ | |
| 446 | - 'notnull' => true, | |
| 447 | - 'length' => 64, | |
| 448 | - 'default' => '', | |
| 449 | - ]); | |
| 450 | -			$table->addColumn('displayname', 'string', [ | |
| 451 | - 'notnull' => false, | |
| 452 | - 'length' => 64, | |
| 453 | - ]); | |
| 454 | -			$table->addColumn('password', 'string', [ | |
| 455 | - 'notnull' => true, | |
| 456 | - 'length' => 255, | |
| 457 | - 'default' => '', | |
| 458 | - ]); | |
| 459 | - $table->setPrimaryKey(['uid']); | |
| 460 | - } | |
| 461 | - | |
| 462 | -		if (!$schema->hasTable('authtoken')) { | |
| 463 | -			$table = $schema->createTable('authtoken'); | |
| 464 | -			$table->addColumn('id', 'integer', [ | |
| 465 | - 'autoincrement' => true, | |
| 466 | - 'notnull' => true, | |
| 467 | - 'length' => 4, | |
| 468 | - 'unsigned' => true, | |
| 469 | - ]); | |
| 470 | -			$table->addColumn('uid', 'string', [ | |
| 471 | - 'notnull' => true, | |
| 472 | - 'length' => 64, | |
| 473 | - 'default' => '', | |
| 474 | - ]); | |
| 475 | -			$table->addColumn('login_name', 'string', [ | |
| 476 | - 'notnull' => true, | |
| 477 | - 'length' => 64, | |
| 478 | - 'default' => '', | |
| 479 | - ]); | |
| 480 | -			$table->addColumn('password', 'text', [ | |
| 481 | - 'notnull' => false, | |
| 482 | - ]); | |
| 483 | -			$table->addColumn('name', 'text', [ | |
| 484 | - 'notnull' => true, | |
| 485 | - 'default' => '', | |
| 486 | - ]); | |
| 487 | -			$table->addColumn('token', 'string', [ | |
| 488 | - 'notnull' => true, | |
| 489 | - 'length' => 200, | |
| 490 | - 'default' => '', | |
| 491 | - ]); | |
| 492 | -			$table->addColumn('type', 'smallint', [ | |
| 493 | - 'notnull' => true, | |
| 494 | - 'length' => 2, | |
| 495 | - 'default' => 0, | |
| 496 | - 'unsigned' => true, | |
| 497 | - ]); | |
| 498 | -			$table->addColumn('remember', 'smallint', [ | |
| 499 | - 'notnull' => true, | |
| 500 | - 'length' => 1, | |
| 501 | - 'default' => 0, | |
| 502 | - 'unsigned' => true, | |
| 503 | - ]); | |
| 504 | -			$table->addColumn('last_activity', 'integer', [ | |
| 505 | - 'notnull' => true, | |
| 506 | - 'length' => 4, | |
| 507 | - 'default' => 0, | |
| 508 | - 'unsigned' => true, | |
| 509 | - ]); | |
| 510 | -			$table->addColumn('last_check', 'integer', [ | |
| 511 | - 'notnull' => true, | |
| 512 | - 'length' => 4, | |
| 513 | - 'default' => 0, | |
| 514 | - 'unsigned' => true, | |
| 515 | - ]); | |
| 516 | -			$table->addColumn('scope', 'text', [ | |
| 517 | - 'notnull' => false, | |
| 518 | - ]); | |
| 519 | - $table->setPrimaryKey(['id']); | |
| 520 | - $table->addUniqueIndex(['token'], 'authtoken_token_index'); | |
| 521 | - $table->addIndex(['last_activity'], 'authtoken_last_activity_index'); | |
| 522 | - } | |
| 523 | - | |
| 524 | -		if (!$schema->hasTable('bruteforce_attempts')) { | |
| 525 | -			$table = $schema->createTable('bruteforce_attempts'); | |
| 526 | -			$table->addColumn('id', 'integer', [ | |
| 527 | - 'autoincrement' => true, | |
| 528 | - 'notnull' => true, | |
| 529 | - 'length' => 4, | |
| 530 | - 'unsigned' => true, | |
| 531 | - ]); | |
| 532 | -			$table->addColumn('action', 'string', [ | |
| 533 | - 'notnull' => true, | |
| 534 | - 'length' => 64, | |
| 535 | - 'default' => '', | |
| 536 | - ]); | |
| 537 | -			$table->addColumn('occurred', 'integer', [ | |
| 538 | - 'notnull' => true, | |
| 539 | - 'length' => 4, | |
| 540 | - 'default' => 0, | |
| 541 | - 'unsigned' => true, | |
| 542 | - ]); | |
| 543 | -			$table->addColumn('ip', 'string', [ | |
| 544 | - 'notnull' => true, | |
| 545 | - 'length' => 255, | |
| 546 | - 'default' => '', | |
| 547 | - ]); | |
| 548 | -			$table->addColumn('subnet', 'string', [ | |
| 549 | - 'notnull' => true, | |
| 550 | - 'length' => 255, | |
| 551 | - 'default' => '', | |
| 552 | - ]); | |
| 553 | -			$table->addColumn('metadata', 'string', [ | |
| 554 | - 'notnull' => true, | |
| 555 | - 'length' => 255, | |
| 556 | - 'default' => '', | |
| 557 | - ]); | |
| 558 | - $table->setPrimaryKey(['id']); | |
| 559 | - $table->addIndex(['ip'], 'bruteforce_attempts_ip'); | |
| 560 | - $table->addIndex(['subnet'], 'bruteforce_attempts_subnet'); | |
| 561 | - } | |
| 562 | - | |
| 563 | -		if (!$schema->hasTable('vcategory')) { | |
| 564 | -			$table = $schema->createTable('vcategory'); | |
| 565 | -			$table->addColumn('id', 'integer', [ | |
| 566 | - 'autoincrement' => true, | |
| 567 | - 'notnull' => true, | |
| 568 | - 'length' => 4, | |
| 569 | - 'unsigned' => true, | |
| 570 | - ]); | |
| 571 | -			$table->addColumn('uid', 'string', [ | |
| 572 | - 'notnull' => true, | |
| 573 | - 'length' => 64, | |
| 574 | - 'default' => '', | |
| 575 | - ]); | |
| 576 | -			$table->addColumn('type', 'string', [ | |
| 577 | - 'notnull' => true, | |
| 578 | - 'length' => 64, | |
| 579 | - 'default' => '', | |
| 580 | - ]); | |
| 581 | -			$table->addColumn('category', 'string', [ | |
| 582 | - 'notnull' => true, | |
| 583 | - 'length' => 255, | |
| 584 | - 'default' => '', | |
| 585 | - ]); | |
| 586 | - $table->setPrimaryKey(['id']); | |
| 587 | - $table->addIndex(['uid'], 'uid_index'); | |
| 588 | - $table->addIndex(['type'], 'type_index'); | |
| 589 | - $table->addIndex(['category'], 'category_index'); | |
| 590 | - } | |
| 591 | - | |
| 592 | -		if (!$schema->hasTable('vcategory_to_object')) { | |
| 593 | -			$table = $schema->createTable('vcategory_to_object'); | |
| 594 | -			$table->addColumn('objid', 'integer', [ | |
| 595 | - 'notnull' => true, | |
| 596 | - 'length' => 4, | |
| 597 | - 'default' => 0, | |
| 598 | - 'unsigned' => true, | |
| 599 | - ]); | |
| 600 | -			$table->addColumn('categoryid', 'integer', [ | |
| 601 | - 'notnull' => true, | |
| 602 | - 'length' => 4, | |
| 603 | - 'default' => 0, | |
| 604 | - 'unsigned' => true, | |
| 605 | - ]); | |
| 606 | -			$table->addColumn('type', 'string', [ | |
| 607 | - 'notnull' => true, | |
| 608 | - 'length' => 64, | |
| 609 | - 'default' => '', | |
| 610 | - ]); | |
| 611 | - $table->setPrimaryKey(['categoryid', 'objid', 'type']); | |
| 612 | - $table->addIndex(['objid', 'type'], 'vcategory_objectd_index'); | |
| 613 | - } | |
| 614 | - | |
| 615 | -		if (!$schema->hasTable('systemtag')) { | |
| 616 | -			$table = $schema->createTable('systemtag'); | |
| 617 | -			$table->addColumn('id', 'integer', [ | |
| 618 | - 'autoincrement' => true, | |
| 619 | - 'notnull' => true, | |
| 620 | - 'length' => 4, | |
| 621 | - 'unsigned' => true, | |
| 622 | - ]); | |
| 623 | -			$table->addColumn('name', 'string', [ | |
| 624 | - 'notnull' => true, | |
| 625 | - 'length' => 64, | |
| 626 | - 'default' => '', | |
| 627 | - ]); | |
| 628 | -			$table->addColumn('visibility', 'smallint', [ | |
| 629 | - 'notnull' => true, | |
| 630 | - 'length' => 1, | |
| 631 | - 'default' => 1, | |
| 632 | - ]); | |
| 633 | -			$table->addColumn('editable', 'smallint', [ | |
| 634 | - 'notnull' => true, | |
| 635 | - 'length' => 1, | |
| 636 | - 'default' => 1, | |
| 637 | - ]); | |
| 638 | - $table->setPrimaryKey(['id']); | |
| 639 | - $table->addUniqueIndex(['name', 'visibility', 'editable'], 'tag_ident'); | |
| 640 | - } | |
| 641 | - | |
| 642 | -		if (!$schema->hasTable('systemtag_object_mapping')) { | |
| 643 | -			$table = $schema->createTable('systemtag_object_mapping'); | |
| 644 | -			$table->addColumn('objectid', 'string', [ | |
| 645 | - 'notnull' => true, | |
| 646 | - 'length' => 64, | |
| 647 | - 'default' => '', | |
| 648 | - ]); | |
| 649 | -			$table->addColumn('objecttype', 'string', [ | |
| 650 | - 'notnull' => true, | |
| 651 | - 'length' => 64, | |
| 652 | - 'default' => '', | |
| 653 | - ]); | |
| 654 | -			$table->addColumn('systemtagid', 'integer', [ | |
| 655 | - 'notnull' => true, | |
| 656 | - 'length' => 4, | |
| 657 | - 'default' => 0, | |
| 658 | - 'unsigned' => true, | |
| 659 | - ]); | |
| 660 | - $table->addUniqueIndex(['objecttype', 'objectid', 'systemtagid'], 'mapping'); | |
| 661 | - } | |
| 662 | - | |
| 663 | -		if (!$schema->hasTable('systemtag_group')) { | |
| 664 | -			$table = $schema->createTable('systemtag_group'); | |
| 665 | -			$table->addColumn('systemtagid', 'integer', [ | |
| 666 | - 'notnull' => true, | |
| 667 | - 'length' => 4, | |
| 668 | - 'default' => 0, | |
| 669 | - 'unsigned' => true, | |
| 670 | - ]); | |
| 671 | -			$table->addColumn('gid', 'string', [ | |
| 672 | - 'notnull' => true, | |
| 673 | - ]); | |
| 674 | - $table->setPrimaryKey(['gid', 'systemtagid']); | |
| 675 | - } | |
| 676 | - | |
| 677 | -		if (!$schema->hasTable('file_locks')) { | |
| 678 | -			$table = $schema->createTable('file_locks'); | |
| 679 | -			$table->addColumn('id', 'integer', [ | |
| 680 | - 'autoincrement' => true, | |
| 681 | - 'notnull' => true, | |
| 682 | - 'length' => 4, | |
| 683 | - 'unsigned' => true, | |
| 684 | - ]); | |
| 685 | -			$table->addColumn('lock', 'integer', [ | |
| 686 | - 'notnull' => true, | |
| 687 | - 'length' => 4, | |
| 688 | - 'default' => 0, | |
| 689 | - ]); | |
| 690 | -			$table->addColumn('key', 'string', [ | |
| 691 | - 'notnull' => true, | |
| 692 | - 'length' => 64, | |
| 693 | - ]); | |
| 694 | -			$table->addColumn('ttl', 'integer', [ | |
| 695 | - 'notnull' => true, | |
| 696 | - 'length' => 4, | |
| 697 | - 'default' => -1, | |
| 698 | - ]); | |
| 699 | - $table->setPrimaryKey(['id']); | |
| 700 | - $table->addUniqueIndex(['key'], 'lock_key_index'); | |
| 701 | - $table->addIndex(['ttl'], 'lock_ttl_index'); | |
| 702 | - } | |
| 703 | - | |
| 704 | -		if (!$schema->hasTable('comments')) { | |
| 705 | -			$table = $schema->createTable('comments'); | |
| 706 | -			$table->addColumn('id', 'integer', [ | |
| 707 | - 'autoincrement' => true, | |
| 708 | - 'notnull' => true, | |
| 709 | - 'length' => 4, | |
| 710 | - 'unsigned' => true, | |
| 711 | - ]); | |
| 712 | -			$table->addColumn('parent_id', 'integer', [ | |
| 713 | - 'notnull' => true, | |
| 714 | - 'length' => 4, | |
| 715 | - 'default' => 0, | |
| 716 | - 'unsigned' => true, | |
| 717 | - ]); | |
| 718 | -			$table->addColumn('topmost_parent_id', 'integer', [ | |
| 719 | - 'notnull' => true, | |
| 720 | - 'length' => 4, | |
| 721 | - 'default' => 0, | |
| 722 | - 'unsigned' => true, | |
| 723 | - ]); | |
| 724 | -			$table->addColumn('children_count', 'integer', [ | |
| 725 | - 'notnull' => true, | |
| 726 | - 'length' => 4, | |
| 727 | - 'default' => 0, | |
| 728 | - 'unsigned' => true, | |
| 729 | - ]); | |
| 730 | -			$table->addColumn('actor_type', 'string', [ | |
| 731 | - 'notnull' => true, | |
| 732 | - 'length' => 64, | |
| 733 | - 'default' => '', | |
| 734 | - ]); | |
| 735 | -			$table->addColumn('actor_id', 'string', [ | |
| 736 | - 'notnull' => true, | |
| 737 | - 'length' => 64, | |
| 738 | - 'default' => '', | |
| 739 | - ]); | |
| 740 | -			$table->addColumn('message', 'text', [ | |
| 741 | - 'notnull' => false, | |
| 742 | - ]); | |
| 743 | -			$table->addColumn('verb', 'string', [ | |
| 744 | - 'notnull' => false, | |
| 745 | - 'length' => 64, | |
| 746 | - ]); | |
| 747 | -			$table->addColumn('creation_timestamp', 'datetime', [ | |
| 748 | - 'notnull' => false, | |
| 749 | - ]); | |
| 750 | -			$table->addColumn('latest_child_timestamp', 'datetime', [ | |
| 751 | - 'notnull' => false, | |
| 752 | - ]); | |
| 753 | -			$table->addColumn('object_type', 'string', [ | |
| 754 | - 'notnull' => true, | |
| 755 | - 'length' => 64, | |
| 756 | - 'default' => '', | |
| 757 | - ]); | |
| 758 | -			$table->addColumn('object_id', 'string', [ | |
| 759 | - 'notnull' => true, | |
| 760 | - 'length' => 64, | |
| 761 | - 'default' => '', | |
| 762 | - ]); | |
| 763 | - $table->setPrimaryKey(['id']); | |
| 764 | - $table->addIndex(['parent_id'], 'comments_parent_id_index'); | |
| 765 | - $table->addIndex(['topmost_parent_id'], 'comments_topmost_parent_id_idx'); | |
| 766 | - $table->addIndex(['object_type', 'object_id', 'creation_timestamp'], 'comments_object_index'); | |
| 767 | - $table->addIndex(['actor_type', 'actor_id'], 'comments_actor_index'); | |
| 768 | - } | |
| 769 | - | |
| 770 | -		if (!$schema->hasTable('comments_read_markers')) { | |
| 771 | -			$table = $schema->createTable('comments_read_markers'); | |
| 772 | -			$table->addColumn('user_id', 'string', [ | |
| 773 | - 'notnull' => true, | |
| 774 | - 'length' => 64, | |
| 775 | - 'default' => '', | |
| 776 | - ]); | |
| 777 | -			$table->addColumn('marker_datetime', 'datetime', [ | |
| 778 | - 'notnull' => false, | |
| 779 | - ]); | |
| 780 | -			$table->addColumn('object_type', 'string', [ | |
| 781 | - 'notnull' => true, | |
| 782 | - 'length' => 64, | |
| 783 | - 'default' => '', | |
| 784 | - ]); | |
| 785 | -			$table->addColumn('object_id', 'string', [ | |
| 786 | - 'notnull' => true, | |
| 787 | - 'length' => 64, | |
| 788 | - 'default' => '', | |
| 789 | - ]); | |
| 790 | - $table->addIndex(['object_type', 'object_id'], 'comments_marker_object_index'); | |
| 791 | - $table->addUniqueIndex(['user_id', 'object_type', 'object_id'], 'comments_marker_index'); | |
| 792 | - } | |
| 793 | - | |
| 794 | -		if (!$schema->hasTable('credentials')) { | |
| 795 | -			$table = $schema->createTable('credentials'); | |
| 796 | -			$table->addColumn('user', 'string', [ | |
| 797 | - 'notnull' => true, | |
| 798 | - 'length' => 64, | |
| 799 | - ]); | |
| 800 | -			$table->addColumn('identifier', 'string', [ | |
| 801 | - 'notnull' => true, | |
| 802 | - 'length' => 64, | |
| 803 | - ]); | |
| 804 | -			$table->addColumn('credentials', 'text', [ | |
| 805 | - 'notnull' => false, | |
| 806 | - ]); | |
| 807 | - $table->setPrimaryKey(['user', 'identifier']); | |
| 808 | - $table->addIndex(['user'], 'credentials_user'); | |
| 809 | - } | |
| 810 | - | |
| 811 | -		if (!$schema->hasTable('admin_sections')) { | |
| 812 | -			$table = $schema->createTable('admin_sections'); | |
| 813 | -			$table->addColumn('id', 'string', [ | |
| 814 | - 'notnull' => true, | |
| 815 | - 'length' => 64, | |
| 816 | - ]); | |
| 817 | -			$table->addColumn('class', 'string', [ | |
| 818 | - 'notnull' => true, | |
| 819 | - 'length' => 255, | |
| 820 | - 'default' => '', | |
| 821 | - ]); | |
| 822 | -			$table->addColumn('priority', 'smallint', [ | |
| 823 | - 'notnull' => true, | |
| 824 | - 'length' => 1, | |
| 825 | - 'default' => 0, | |
| 826 | - ]); | |
| 827 | - $table->setPrimaryKey(['id']); | |
| 828 | - $table->addUniqueIndex(['class'], 'admin_sections_class'); | |
| 829 | - } | |
| 830 | - | |
| 831 | -		if (!$schema->hasTable('admin_settings')) { | |
| 832 | -			$table = $schema->createTable('admin_settings'); | |
| 833 | -			$table->addColumn('id', 'integer', [ | |
| 834 | - 'autoincrement' => true, | |
| 835 | - 'notnull' => true, | |
| 836 | - 'length' => 4, | |
| 837 | - ]); | |
| 838 | -			$table->addColumn('class', 'string', [ | |
| 839 | - 'notnull' => true, | |
| 840 | - 'length' => 255, | |
| 841 | - 'default' => '', | |
| 842 | - ]); | |
| 843 | -			$table->addColumn('section', 'string', [ | |
| 844 | - 'notnull' => false, | |
| 845 | - 'length' => 64, | |
| 846 | - ]); | |
| 847 | -			$table->addColumn('priority', 'smallint', [ | |
| 848 | - 'notnull' => true, | |
| 849 | - 'length' => 1, | |
| 850 | - 'default' => 0, | |
| 851 | - ]); | |
| 852 | - $table->setPrimaryKey(['id']); | |
| 853 | - $table->addUniqueIndex(['class'], 'admin_settings_class'); | |
| 854 | - $table->addIndex(['section'], 'admin_settings_section'); | |
| 855 | - } | |
| 856 | - | |
| 857 | -		if (!$schema->hasTable('personal_sections')) { | |
| 858 | -			$table = $schema->createTable('personal_sections'); | |
| 859 | -			$table->addColumn('id', 'string', [ | |
| 860 | - 'notnull' => true, | |
| 861 | - 'length' => 64, | |
| 862 | - ]); | |
| 863 | -			$table->addColumn('class', 'string', [ | |
| 864 | - 'notnull' => true, | |
| 865 | - 'length' => 255, | |
| 866 | - 'default' => '', | |
| 867 | - ]); | |
| 868 | -			$table->addColumn('priority', 'smallint', [ | |
| 869 | - 'notnull' => true, | |
| 870 | - 'length' => 1, | |
| 871 | - 'default' => 0, | |
| 872 | - ]); | |
| 873 | - $table->setPrimaryKey(['id']); | |
| 874 | - $table->addUniqueIndex(['class'], 'personal_sections_class'); | |
| 875 | - } | |
| 876 | - | |
| 877 | -		if (!$schema->hasTable('personal_settings')) { | |
| 878 | -			$table = $schema->createTable('personal_settings'); | |
| 879 | -			$table->addColumn('id', 'integer', [ | |
| 880 | - 'autoincrement' => true, | |
| 881 | - 'notnull' => true, | |
| 882 | - 'length' => 4, | |
| 883 | - ]); | |
| 884 | -			$table->addColumn('class', 'string', [ | |
| 885 | - 'notnull' => true, | |
| 886 | - 'length' => 255, | |
| 887 | - 'default' => '', | |
| 888 | - ]); | |
| 889 | -			$table->addColumn('section', 'string', [ | |
| 890 | - 'notnull' => false, | |
| 891 | - 'length' => 64, | |
| 892 | - ]); | |
| 893 | -			$table->addColumn('priority', 'smallint', [ | |
| 894 | - 'notnull' => true, | |
| 895 | - 'length' => 1, | |
| 896 | - 'default' => 0, | |
| 897 | - ]); | |
| 898 | - $table->setPrimaryKey(['id']); | |
| 899 | - $table->addUniqueIndex(['class'], 'personal_settings_class'); | |
| 900 | - $table->addIndex(['section'], 'personal_settings_section'); | |
| 901 | - } | |
| 902 | - | |
| 903 | -		if (!$schema->hasTable('accounts')) { | |
| 904 | -			$table = $schema->createTable('accounts'); | |
| 905 | -			$table->addColumn('uid', 'string', [ | |
| 906 | - 'notnull' => true, | |
| 907 | - 'length' => 64, | |
| 908 | - 'default' => '', | |
| 909 | - ]); | |
| 910 | -			$table->addColumn('data', 'text', [ | |
| 911 | - 'notnull' => true, | |
| 912 | - 'default' => '', | |
| 913 | - ]); | |
| 914 | - $table->setPrimaryKey(['uid']); | |
| 915 | - } | |
| 916 | - return $schema; | |
| 917 | - } | |
| 33 | + /** | |
| 34 | + * @param IOutput $output | |
| 35 | + * @param \Closure $schemaClosure The `\Closure` returns a `Schema` | |
| 36 | + * @param array $options | |
| 37 | + * @return null|Schema | |
| 38 | + * @since 13.0.0 | |
| 39 | + */ | |
| 40 | +    public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { | |
| 41 | + /** @var Schema $schema */ | |
| 42 | + $schema = $schemaClosure(); | |
| 43 | + | |
| 44 | +        if (!$schema->hasTable('appconfig')) { | |
| 45 | +            $table = $schema->createTable('appconfig'); | |
| 46 | +            $table->addColumn('appid', 'string', [ | |
| 47 | + 'notnull' => true, | |
| 48 | + 'length' => 32, | |
| 49 | + 'default' => '', | |
| 50 | + ]); | |
| 51 | +            $table->addColumn('configkey', 'string', [ | |
| 52 | + 'notnull' => true, | |
| 53 | + 'length' => 64, | |
| 54 | + 'default' => '', | |
| 55 | + ]); | |
| 56 | +            $table->addColumn('configvalue', 'text', [ | |
| 57 | + 'notnull' => false, | |
| 58 | + ]); | |
| 59 | + $table->setPrimaryKey(['appid', 'configkey']); | |
| 60 | + $table->addIndex(['configkey'], 'appconfig_config_key_index'); | |
| 61 | + $table->addIndex(['appid'], 'appconfig_appid_key'); | |
| 62 | + } | |
| 63 | + | |
| 64 | +        if (!$schema->hasTable('storages')) { | |
| 65 | +            $table = $schema->createTable('storages'); | |
| 66 | +            $table->addColumn('id', 'string', [ | |
| 67 | + 'notnull' => false, | |
| 68 | + 'length' => 64, | |
| 69 | + ]); | |
| 70 | +            $table->addColumn('numeric_id', Type::BIGINT, [ | |
| 71 | + 'autoincrement' => true, | |
| 72 | + 'notnull' => true, | |
| 73 | + 'length' => 20, | |
| 74 | + ]); | |
| 75 | +            $table->addColumn('available', 'integer', [ | |
| 76 | + 'notnull' => true, | |
| 77 | + 'default' => 1, | |
| 78 | + ]); | |
| 79 | +            $table->addColumn('last_checked', 'integer', [ | |
| 80 | + 'notnull' => false, | |
| 81 | + ]); | |
| 82 | + $table->setPrimaryKey(['numeric_id']); | |
| 83 | + $table->addUniqueIndex(['id'], 'storages_id_index'); | |
| 84 | + } | |
| 85 | + | |
| 86 | +        if (!$schema->hasTable('mounts')) { | |
| 87 | +            $table = $schema->createTable('mounts'); | |
| 88 | +            $table->addColumn('id', 'integer', [ | |
| 89 | + 'autoincrement' => true, | |
| 90 | + 'notnull' => true, | |
| 91 | + 'length' => 4, | |
| 92 | + ]); | |
| 93 | +            $table->addColumn('storage_id', 'integer', [ | |
| 94 | + 'notnull' => true, | |
| 95 | + ]); | |
| 96 | +            $table->addColumn('root_id', 'integer', [ | |
| 97 | + 'notnull' => true, | |
| 98 | + ]); | |
| 99 | +            $table->addColumn('user_id', 'string', [ | |
| 100 | + 'notnull' => true, | |
| 101 | + 'length' => 64, | |
| 102 | + ]); | |
| 103 | +            $table->addColumn('mount_point', 'string', [ | |
| 104 | + 'notnull' => true, | |
| 105 | + 'length' => 4000, | |
| 106 | + ]); | |
| 107 | +            $table->addColumn('mount_id', 'integer', [ | |
| 108 | + 'notnull' => false, | |
| 109 | + ]); | |
| 110 | + $table->setPrimaryKey(['id']); | |
| 111 | + $table->addIndex(['user_id'], 'mounts_user_index'); | |
| 112 | + $table->addIndex(['storage_id'], 'mounts_storage_index'); | |
| 113 | + $table->addIndex(['root_id'], 'mounts_root_index'); | |
| 114 | + $table->addIndex(['mount_id'], 'mounts_mount_id_index'); | |
| 115 | + $table->addUniqueIndex(['user_id', 'root_id'], 'mounts_user_root_index'); | |
| 116 | + } | |
| 117 | + | |
| 118 | +        if (!$schema->hasTable('mimetypes')) { | |
| 119 | +            $table = $schema->createTable('mimetypes'); | |
| 120 | +            $table->addColumn('id', Type::BIGINT, [ | |
| 121 | + 'autoincrement' => true, | |
| 122 | + 'notnull' => true, | |
| 123 | + 'length' => 20, | |
| 124 | + ]); | |
| 125 | +            $table->addColumn('mimetype', 'string', [ | |
| 126 | + 'notnull' => true, | |
| 127 | + 'length' => 255, | |
| 128 | + 'default' => '', | |
| 129 | + ]); | |
| 130 | + $table->setPrimaryKey(['id']); | |
| 131 | + $table->addUniqueIndex(['mimetype'], 'mimetype_id_index'); | |
| 132 | + } | |
| 133 | + | |
| 134 | +        if (!$schema->hasTable('filecache')) { | |
| 135 | +            $table = $schema->createTable('filecache'); | |
| 136 | +            $table->addColumn('fileid', Type::BIGINT, [ | |
| 137 | + 'autoincrement' => true, | |
| 138 | + 'notnull' => true, | |
| 139 | + 'length' => 20, | |
| 140 | + ]); | |
| 141 | +            $table->addColumn('storage', Type::BIGINT, [ | |
| 142 | + 'notnull' => true, | |
| 143 | + 'length' => 20, | |
| 144 | + 'default' => 0, | |
| 145 | + ]); | |
| 146 | +            $table->addColumn('path', 'string', [ | |
| 147 | + 'notnull' => false, | |
| 148 | + 'length' => 4000, | |
| 149 | + ]); | |
| 150 | +            $table->addColumn('path_hash', 'string', [ | |
| 151 | + 'notnull' => true, | |
| 152 | + 'length' => 32, | |
| 153 | + 'default' => '', | |
| 154 | + ]); | |
| 155 | +            $table->addColumn('parent', Type::BIGINT, [ | |
| 156 | + 'notnull' => true, | |
| 157 | + 'length' => 20, | |
| 158 | + 'default' => 0, | |
| 159 | + ]); | |
| 160 | +            $table->addColumn('name', 'string', [ | |
| 161 | + 'notnull' => false, | |
| 162 | + 'length' => 250, | |
| 163 | + ]); | |
| 164 | +            $table->addColumn('mimetype', Type::BIGINT, [ | |
| 165 | + 'notnull' => true, | |
| 166 | + 'length' => 20, | |
| 167 | + 'default' => 0, | |
| 168 | + ]); | |
| 169 | +            $table->addColumn('mimepart', Type::BIGINT, [ | |
| 170 | + 'notnull' => true, | |
| 171 | + 'length' => 20, | |
| 172 | + 'default' => 0, | |
| 173 | + ]); | |
| 174 | +            $table->addColumn('size', 'bigint', [ | |
| 175 | + 'notnull' => true, | |
| 176 | + 'length' => 8, | |
| 177 | + 'default' => 0, | |
| 178 | + ]); | |
| 179 | +            $table->addColumn('mtime', 'integer', [ | |
| 180 | + 'notnull' => true, | |
| 181 | + 'length' => 4, | |
| 182 | + 'default' => 0, | |
| 183 | + ]); | |
| 184 | +            $table->addColumn('storage_mtime', 'integer', [ | |
| 185 | + 'notnull' => true, | |
| 186 | + 'length' => 4, | |
| 187 | + 'default' => 0, | |
| 188 | + ]); | |
| 189 | +            $table->addColumn('encrypted', 'integer', [ | |
| 190 | + 'notnull' => true, | |
| 191 | + 'length' => 4, | |
| 192 | + 'default' => 0, | |
| 193 | + ]); | |
| 194 | +            $table->addColumn('unencrypted_size', 'bigint', [ | |
| 195 | + 'notnull' => true, | |
| 196 | + 'length' => 8, | |
| 197 | + 'default' => 0, | |
| 198 | + ]); | |
| 199 | +            $table->addColumn('etag', 'string', [ | |
| 200 | + 'notnull' => false, | |
| 201 | + 'length' => 40, | |
| 202 | + ]); | |
| 203 | +            $table->addColumn('permissions', 'integer', [ | |
| 204 | + 'notnull' => false, | |
| 205 | + 'length' => 4, | |
| 206 | + 'default' => 0, | |
| 207 | + ]); | |
| 208 | +            $table->addColumn('checksum', 'string', [ | |
| 209 | + 'notnull' => false, | |
| 210 | + 'length' => 255, | |
| 211 | + ]); | |
| 212 | + $table->setPrimaryKey(['fileid']); | |
| 213 | + $table->addUniqueIndex(['storage', 'path_hash'], 'fs_storage_path_hash'); | |
| 214 | + $table->addIndex(['parent', 'name'], 'fs_parent_name_hash'); | |
| 215 | + $table->addIndex(['storage', 'mimetype'], 'fs_storage_mimetype'); | |
| 216 | + $table->addIndex(['storage', 'mimepart'], 'fs_storage_mimepart'); | |
| 217 | + $table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size'); | |
| 218 | + } | |
| 219 | + | |
| 220 | +        if (!$schema->hasTable('group_user')) { | |
| 221 | +            $table = $schema->createTable('group_user'); | |
| 222 | +            $table->addColumn('gid', 'string', [ | |
| 223 | + 'notnull' => true, | |
| 224 | + 'length' => 64, | |
| 225 | + 'default' => '', | |
| 226 | + ]); | |
| 227 | +            $table->addColumn('uid', 'string', [ | |
| 228 | + 'notnull' => true, | |
| 229 | + 'length' => 64, | |
| 230 | + 'default' => '', | |
| 231 | + ]); | |
| 232 | + $table->setPrimaryKey(['gid', 'uid']); | |
| 233 | + $table->addIndex(['uid'], 'gu_uid_index'); | |
| 234 | + } | |
| 235 | + | |
| 236 | +        if (!$schema->hasTable('group_admin')) { | |
| 237 | +            $table = $schema->createTable('group_admin'); | |
| 238 | +            $table->addColumn('gid', 'string', [ | |
| 239 | + 'notnull' => true, | |
| 240 | + 'length' => 64, | |
| 241 | + 'default' => '', | |
| 242 | + ]); | |
| 243 | +            $table->addColumn('uid', 'string', [ | |
| 244 | + 'notnull' => true, | |
| 245 | + 'length' => 64, | |
| 246 | + 'default' => '', | |
| 247 | + ]); | |
| 248 | + $table->setPrimaryKey(['gid', 'uid']); | |
| 249 | + $table->addIndex(['uid'], 'group_admin_uid'); | |
| 250 | + } | |
| 251 | + | |
| 252 | +        if (!$schema->hasTable('groups')) { | |
| 253 | +            $table = $schema->createTable('groups'); | |
| 254 | +            $table->addColumn('gid', 'string', [ | |
| 255 | + 'notnull' => true, | |
| 256 | + 'length' => 64, | |
| 257 | + 'default' => '', | |
| 258 | + ]); | |
| 259 | + $table->setPrimaryKey(['gid']); | |
| 260 | + } | |
| 261 | + | |
| 262 | +        if (!$schema->hasTable('preferences')) { | |
| 263 | +            $table = $schema->createTable('preferences'); | |
| 264 | +            $table->addColumn('userid', 'string', [ | |
| 265 | + 'notnull' => true, | |
| 266 | + 'length' => 64, | |
| 267 | + 'default' => '', | |
| 268 | + ]); | |
| 269 | +            $table->addColumn('appid', 'string', [ | |
| 270 | + 'notnull' => true, | |
| 271 | + 'length' => 32, | |
| 272 | + 'default' => '', | |
| 273 | + ]); | |
| 274 | +            $table->addColumn('configkey', 'string', [ | |
| 275 | + 'notnull' => true, | |
| 276 | + 'length' => 64, | |
| 277 | + 'default' => '', | |
| 278 | + ]); | |
| 279 | +            $table->addColumn('configvalue', 'text', [ | |
| 280 | + 'notnull' => false, | |
| 281 | + ]); | |
| 282 | + $table->setPrimaryKey(['userid', 'appid', 'configkey']); | |
| 283 | + } | |
| 284 | + | |
| 285 | +        if (!$schema->hasTable('properties')) { | |
| 286 | +            $table = $schema->createTable('properties'); | |
| 287 | +            $table->addColumn('id', 'integer', [ | |
| 288 | + 'autoincrement' => true, | |
| 289 | + 'notnull' => true, | |
| 290 | + 'length' => 4, | |
| 291 | + ]); | |
| 292 | +            $table->addColumn('userid', 'string', [ | |
| 293 | + 'notnull' => true, | |
| 294 | + 'length' => 64, | |
| 295 | + 'default' => '', | |
| 296 | + ]); | |
| 297 | +            $table->addColumn('propertypath', 'string', [ | |
| 298 | + 'notnull' => true, | |
| 299 | + 'length' => 255, | |
| 300 | + 'default' => '', | |
| 301 | + ]); | |
| 302 | +            $table->addColumn('propertyname', 'string', [ | |
| 303 | + 'notnull' => true, | |
| 304 | + 'length' => 255, | |
| 305 | + 'default' => '', | |
| 306 | + ]); | |
| 307 | +            $table->addColumn('propertyvalue', 'text', [ | |
| 308 | + 'notnull' => true, | |
| 309 | + ]); | |
| 310 | + $table->setPrimaryKey(['id']); | |
| 311 | + $table->addIndex(['userid'], 'property_index'); | |
| 312 | + } | |
| 313 | + | |
| 314 | +        if (!$schema->hasTable('share')) { | |
| 315 | +            $table = $schema->createTable('share'); | |
| 316 | +            $table->addColumn('id', 'integer', [ | |
| 317 | + 'autoincrement' => true, | |
| 318 | + 'notnull' => true, | |
| 319 | + 'length' => 4, | |
| 320 | + ]); | |
| 321 | +            $table->addColumn('share_type', 'smallint', [ | |
| 322 | + 'notnull' => true, | |
| 323 | + 'length' => 1, | |
| 324 | + 'default' => 0, | |
| 325 | + ]); | |
| 326 | +            $table->addColumn('share_with', 'string', [ | |
| 327 | + 'notnull' => false, | |
| 328 | + 'length' => 255, | |
| 329 | + ]); | |
| 330 | +            $table->addColumn('password', 'string', [ | |
| 331 | + 'notnull' => false, | |
| 332 | + 'length' => 255, | |
| 333 | + ]); | |
| 334 | +            $table->addColumn('uid_owner', 'string', [ | |
| 335 | + 'notnull' => true, | |
| 336 | + 'length' => 64, | |
| 337 | + 'default' => '', | |
| 338 | + ]); | |
| 339 | +            $table->addColumn('uid_initiator', 'string', [ | |
| 340 | + 'notnull' => false, | |
| 341 | + 'length' => 64, | |
| 342 | + ]); | |
| 343 | +            $table->addColumn('parent', 'integer', [ | |
| 344 | + 'notnull' => false, | |
| 345 | + 'length' => 4, | |
| 346 | + ]); | |
| 347 | +            $table->addColumn('item_type', 'string', [ | |
| 348 | + 'notnull' => true, | |
| 349 | + 'length' => 64, | |
| 350 | + 'default' => '', | |
| 351 | + ]); | |
| 352 | +            $table->addColumn('item_source', 'string', [ | |
| 353 | + 'notnull' => false, | |
| 354 | + 'length' => 255, | |
| 355 | + ]); | |
| 356 | +            $table->addColumn('item_target', 'string', [ | |
| 357 | + 'notnull' => false, | |
| 358 | + 'length' => 255, | |
| 359 | + ]); | |
| 360 | +            $table->addColumn('file_source', 'integer', [ | |
| 361 | + 'notnull' => false, | |
| 362 | + 'length' => 4, | |
| 363 | + ]); | |
| 364 | +            $table->addColumn('file_target', 'string', [ | |
| 365 | + 'notnull' => false, | |
| 366 | + 'length' => 512, | |
| 367 | + ]); | |
| 368 | +            $table->addColumn('permissions', 'smallint', [ | |
| 369 | + 'notnull' => true, | |
| 370 | + 'length' => 1, | |
| 371 | + 'default' => 0, | |
| 372 | + ]); | |
| 373 | +            $table->addColumn('stime', 'bigint', [ | |
| 374 | + 'notnull' => true, | |
| 375 | + 'length' => 8, | |
| 376 | + 'default' => 0, | |
| 377 | + ]); | |
| 378 | +            $table->addColumn('accepted', 'smallint', [ | |
| 379 | + 'notnull' => true, | |
| 380 | + 'length' => 1, | |
| 381 | + 'default' => 0, | |
| 382 | + ]); | |
| 383 | +            $table->addColumn('expiration', 'datetime', [ | |
| 384 | + 'notnull' => false, | |
| 385 | + ]); | |
| 386 | +            $table->addColumn('token', 'string', [ | |
| 387 | + 'notnull' => false, | |
| 388 | + 'length' => 32, | |
| 389 | + ]); | |
| 390 | +            $table->addColumn('mail_send', 'smallint', [ | |
| 391 | + 'notnull' => true, | |
| 392 | + 'length' => 1, | |
| 393 | + 'default' => 0, | |
| 394 | + ]); | |
| 395 | +            $table->addColumn('share_name', 'string', [ | |
| 396 | + 'notnull' => false, | |
| 397 | + 'length' => 64, | |
| 398 | + ]); | |
| 399 | + $table->setPrimaryKey(['id']); | |
| 400 | + $table->addIndex(['item_type', 'share_type'], 'item_share_type_index'); | |
| 401 | + $table->addIndex(['file_source'], 'file_source_index'); | |
| 402 | + $table->addIndex(['token'], 'token_index'); | |
| 403 | + } | |
| 404 | + | |
| 405 | +        if (!$schema->hasTable('jobs')) { | |
| 406 | +            $table = $schema->createTable('jobs'); | |
| 407 | +            $table->addColumn('id', 'integer', [ | |
| 408 | + 'autoincrement' => true, | |
| 409 | + 'notnull' => true, | |
| 410 | + 'length' => 4, | |
| 411 | + 'unsigned' => true, | |
| 412 | + ]); | |
| 413 | +            $table->addColumn('class', 'string', [ | |
| 414 | + 'notnull' => true, | |
| 415 | + 'length' => 255, | |
| 416 | + 'default' => '', | |
| 417 | + ]); | |
| 418 | +            $table->addColumn('argument', 'string', [ | |
| 419 | + 'notnull' => true, | |
| 420 | + 'length' => 4000, | |
| 421 | + 'default' => '', | |
| 422 | + ]); | |
| 423 | +            $table->addColumn('last_run', 'integer', [ | |
| 424 | + 'notnull' => false, | |
| 425 | + 'default' => 0, | |
| 426 | + ]); | |
| 427 | +            $table->addColumn('last_checked', 'integer', [ | |
| 428 | + 'notnull' => false, | |
| 429 | + 'default' => 0, | |
| 430 | + ]); | |
| 431 | +            $table->addColumn('reserved_at', 'integer', [ | |
| 432 | + 'notnull' => false, | |
| 433 | + 'default' => 0, | |
| 434 | + ]); | |
| 435 | +            $table->addColumn('execution_duration', 'integer', [ | |
| 436 | + 'notnull' => true, | |
| 437 | + 'default' => 0, | |
| 438 | + ]); | |
| 439 | + $table->setPrimaryKey(['id']); | |
| 440 | + $table->addIndex(['class'], 'job_class_index'); | |
| 441 | + } | |
| 442 | + | |
| 443 | +        if (!$schema->hasTable('users')) { | |
| 444 | +            $table = $schema->createTable('users'); | |
| 445 | +            $table->addColumn('uid', 'string', [ | |
| 446 | + 'notnull' => true, | |
| 447 | + 'length' => 64, | |
| 448 | + 'default' => '', | |
| 449 | + ]); | |
| 450 | +            $table->addColumn('displayname', 'string', [ | |
| 451 | + 'notnull' => false, | |
| 452 | + 'length' => 64, | |
| 453 | + ]); | |
| 454 | +            $table->addColumn('password', 'string', [ | |
| 455 | + 'notnull' => true, | |
| 456 | + 'length' => 255, | |
| 457 | + 'default' => '', | |
| 458 | + ]); | |
| 459 | + $table->setPrimaryKey(['uid']); | |
| 460 | + } | |
| 461 | + | |
| 462 | +        if (!$schema->hasTable('authtoken')) { | |
| 463 | +            $table = $schema->createTable('authtoken'); | |
| 464 | +            $table->addColumn('id', 'integer', [ | |
| 465 | + 'autoincrement' => true, | |
| 466 | + 'notnull' => true, | |
| 467 | + 'length' => 4, | |
| 468 | + 'unsigned' => true, | |
| 469 | + ]); | |
| 470 | +            $table->addColumn('uid', 'string', [ | |
| 471 | + 'notnull' => true, | |
| 472 | + 'length' => 64, | |
| 473 | + 'default' => '', | |
| 474 | + ]); | |
| 475 | +            $table->addColumn('login_name', 'string', [ | |
| 476 | + 'notnull' => true, | |
| 477 | + 'length' => 64, | |
| 478 | + 'default' => '', | |
| 479 | + ]); | |
| 480 | +            $table->addColumn('password', 'text', [ | |
| 481 | + 'notnull' => false, | |
| 482 | + ]); | |
| 483 | +            $table->addColumn('name', 'text', [ | |
| 484 | + 'notnull' => true, | |
| 485 | + 'default' => '', | |
| 486 | + ]); | |
| 487 | +            $table->addColumn('token', 'string', [ | |
| 488 | + 'notnull' => true, | |
| 489 | + 'length' => 200, | |
| 490 | + 'default' => '', | |
| 491 | + ]); | |
| 492 | +            $table->addColumn('type', 'smallint', [ | |
| 493 | + 'notnull' => true, | |
| 494 | + 'length' => 2, | |
| 495 | + 'default' => 0, | |
| 496 | + 'unsigned' => true, | |
| 497 | + ]); | |
| 498 | +            $table->addColumn('remember', 'smallint', [ | |
| 499 | + 'notnull' => true, | |
| 500 | + 'length' => 1, | |
| 501 | + 'default' => 0, | |
| 502 | + 'unsigned' => true, | |
| 503 | + ]); | |
| 504 | +            $table->addColumn('last_activity', 'integer', [ | |
| 505 | + 'notnull' => true, | |
| 506 | + 'length' => 4, | |
| 507 | + 'default' => 0, | |
| 508 | + 'unsigned' => true, | |
| 509 | + ]); | |
| 510 | +            $table->addColumn('last_check', 'integer', [ | |
| 511 | + 'notnull' => true, | |
| 512 | + 'length' => 4, | |
| 513 | + 'default' => 0, | |
| 514 | + 'unsigned' => true, | |
| 515 | + ]); | |
| 516 | +            $table->addColumn('scope', 'text', [ | |
| 517 | + 'notnull' => false, | |
| 518 | + ]); | |
| 519 | + $table->setPrimaryKey(['id']); | |
| 520 | + $table->addUniqueIndex(['token'], 'authtoken_token_index'); | |
| 521 | + $table->addIndex(['last_activity'], 'authtoken_last_activity_index'); | |
| 522 | + } | |
| 523 | + | |
| 524 | +        if (!$schema->hasTable('bruteforce_attempts')) { | |
| 525 | +            $table = $schema->createTable('bruteforce_attempts'); | |
| 526 | +            $table->addColumn('id', 'integer', [ | |
| 527 | + 'autoincrement' => true, | |
| 528 | + 'notnull' => true, | |
| 529 | + 'length' => 4, | |
| 530 | + 'unsigned' => true, | |
| 531 | + ]); | |
| 532 | +            $table->addColumn('action', 'string', [ | |
| 533 | + 'notnull' => true, | |
| 534 | + 'length' => 64, | |
| 535 | + 'default' => '', | |
| 536 | + ]); | |
| 537 | +            $table->addColumn('occurred', 'integer', [ | |
| 538 | + 'notnull' => true, | |
| 539 | + 'length' => 4, | |
| 540 | + 'default' => 0, | |
| 541 | + 'unsigned' => true, | |
| 542 | + ]); | |
| 543 | +            $table->addColumn('ip', 'string', [ | |
| 544 | + 'notnull' => true, | |
| 545 | + 'length' => 255, | |
| 546 | + 'default' => '', | |
| 547 | + ]); | |
| 548 | +            $table->addColumn('subnet', 'string', [ | |
| 549 | + 'notnull' => true, | |
| 550 | + 'length' => 255, | |
| 551 | + 'default' => '', | |
| 552 | + ]); | |
| 553 | +            $table->addColumn('metadata', 'string', [ | |
| 554 | + 'notnull' => true, | |
| 555 | + 'length' => 255, | |
| 556 | + 'default' => '', | |
| 557 | + ]); | |
| 558 | + $table->setPrimaryKey(['id']); | |
| 559 | + $table->addIndex(['ip'], 'bruteforce_attempts_ip'); | |
| 560 | + $table->addIndex(['subnet'], 'bruteforce_attempts_subnet'); | |
| 561 | + } | |
| 562 | + | |
| 563 | +        if (!$schema->hasTable('vcategory')) { | |
| 564 | +            $table = $schema->createTable('vcategory'); | |
| 565 | +            $table->addColumn('id', 'integer', [ | |
| 566 | + 'autoincrement' => true, | |
| 567 | + 'notnull' => true, | |
| 568 | + 'length' => 4, | |
| 569 | + 'unsigned' => true, | |
| 570 | + ]); | |
| 571 | +            $table->addColumn('uid', 'string', [ | |
| 572 | + 'notnull' => true, | |
| 573 | + 'length' => 64, | |
| 574 | + 'default' => '', | |
| 575 | + ]); | |
| 576 | +            $table->addColumn('type', 'string', [ | |
| 577 | + 'notnull' => true, | |
| 578 | + 'length' => 64, | |
| 579 | + 'default' => '', | |
| 580 | + ]); | |
| 581 | +            $table->addColumn('category', 'string', [ | |
| 582 | + 'notnull' => true, | |
| 583 | + 'length' => 255, | |
| 584 | + 'default' => '', | |
| 585 | + ]); | |
| 586 | + $table->setPrimaryKey(['id']); | |
| 587 | + $table->addIndex(['uid'], 'uid_index'); | |
| 588 | + $table->addIndex(['type'], 'type_index'); | |
| 589 | + $table->addIndex(['category'], 'category_index'); | |
| 590 | + } | |
| 591 | + | |
| 592 | +        if (!$schema->hasTable('vcategory_to_object')) { | |
| 593 | +            $table = $schema->createTable('vcategory_to_object'); | |
| 594 | +            $table->addColumn('objid', 'integer', [ | |
| 595 | + 'notnull' => true, | |
| 596 | + 'length' => 4, | |
| 597 | + 'default' => 0, | |
| 598 | + 'unsigned' => true, | |
| 599 | + ]); | |
| 600 | +            $table->addColumn('categoryid', 'integer', [ | |
| 601 | + 'notnull' => true, | |
| 602 | + 'length' => 4, | |
| 603 | + 'default' => 0, | |
| 604 | + 'unsigned' => true, | |
| 605 | + ]); | |
| 606 | +            $table->addColumn('type', 'string', [ | |
| 607 | + 'notnull' => true, | |
| 608 | + 'length' => 64, | |
| 609 | + 'default' => '', | |
| 610 | + ]); | |
| 611 | + $table->setPrimaryKey(['categoryid', 'objid', 'type']); | |
| 612 | + $table->addIndex(['objid', 'type'], 'vcategory_objectd_index'); | |
| 613 | + } | |
| 614 | + | |
| 615 | +        if (!$schema->hasTable('systemtag')) { | |
| 616 | +            $table = $schema->createTable('systemtag'); | |
| 617 | +            $table->addColumn('id', 'integer', [ | |
| 618 | + 'autoincrement' => true, | |
| 619 | + 'notnull' => true, | |
| 620 | + 'length' => 4, | |
| 621 | + 'unsigned' => true, | |
| 622 | + ]); | |
| 623 | +            $table->addColumn('name', 'string', [ | |
| 624 | + 'notnull' => true, | |
| 625 | + 'length' => 64, | |
| 626 | + 'default' => '', | |
| 627 | + ]); | |
| 628 | +            $table->addColumn('visibility', 'smallint', [ | |
| 629 | + 'notnull' => true, | |
| 630 | + 'length' => 1, | |
| 631 | + 'default' => 1, | |
| 632 | + ]); | |
| 633 | +            $table->addColumn('editable', 'smallint', [ | |
| 634 | + 'notnull' => true, | |
| 635 | + 'length' => 1, | |
| 636 | + 'default' => 1, | |
| 637 | + ]); | |
| 638 | + $table->setPrimaryKey(['id']); | |
| 639 | + $table->addUniqueIndex(['name', 'visibility', 'editable'], 'tag_ident'); | |
| 640 | + } | |
| 641 | + | |
| 642 | +        if (!$schema->hasTable('systemtag_object_mapping')) { | |
| 643 | +            $table = $schema->createTable('systemtag_object_mapping'); | |
| 644 | +            $table->addColumn('objectid', 'string', [ | |
| 645 | + 'notnull' => true, | |
| 646 | + 'length' => 64, | |
| 647 | + 'default' => '', | |
| 648 | + ]); | |
| 649 | +            $table->addColumn('objecttype', 'string', [ | |
| 650 | + 'notnull' => true, | |
| 651 | + 'length' => 64, | |
| 652 | + 'default' => '', | |
| 653 | + ]); | |
| 654 | +            $table->addColumn('systemtagid', 'integer', [ | |
| 655 | + 'notnull' => true, | |
| 656 | + 'length' => 4, | |
| 657 | + 'default' => 0, | |
| 658 | + 'unsigned' => true, | |
| 659 | + ]); | |
| 660 | + $table->addUniqueIndex(['objecttype', 'objectid', 'systemtagid'], 'mapping'); | |
| 661 | + } | |
| 662 | + | |
| 663 | +        if (!$schema->hasTable('systemtag_group')) { | |
| 664 | +            $table = $schema->createTable('systemtag_group'); | |
| 665 | +            $table->addColumn('systemtagid', 'integer', [ | |
| 666 | + 'notnull' => true, | |
| 667 | + 'length' => 4, | |
| 668 | + 'default' => 0, | |
| 669 | + 'unsigned' => true, | |
| 670 | + ]); | |
| 671 | +            $table->addColumn('gid', 'string', [ | |
| 672 | + 'notnull' => true, | |
| 673 | + ]); | |
| 674 | + $table->setPrimaryKey(['gid', 'systemtagid']); | |
| 675 | + } | |
| 676 | + | |
| 677 | +        if (!$schema->hasTable('file_locks')) { | |
| 678 | +            $table = $schema->createTable('file_locks'); | |
| 679 | +            $table->addColumn('id', 'integer', [ | |
| 680 | + 'autoincrement' => true, | |
| 681 | + 'notnull' => true, | |
| 682 | + 'length' => 4, | |
| 683 | + 'unsigned' => true, | |
| 684 | + ]); | |
| 685 | +            $table->addColumn('lock', 'integer', [ | |
| 686 | + 'notnull' => true, | |
| 687 | + 'length' => 4, | |
| 688 | + 'default' => 0, | |
| 689 | + ]); | |
| 690 | +            $table->addColumn('key', 'string', [ | |
| 691 | + 'notnull' => true, | |
| 692 | + 'length' => 64, | |
| 693 | + ]); | |
| 694 | +            $table->addColumn('ttl', 'integer', [ | |
| 695 | + 'notnull' => true, | |
| 696 | + 'length' => 4, | |
| 697 | + 'default' => -1, | |
| 698 | + ]); | |
| 699 | + $table->setPrimaryKey(['id']); | |
| 700 | + $table->addUniqueIndex(['key'], 'lock_key_index'); | |
| 701 | + $table->addIndex(['ttl'], 'lock_ttl_index'); | |
| 702 | + } | |
| 703 | + | |
| 704 | +        if (!$schema->hasTable('comments')) { | |
| 705 | +            $table = $schema->createTable('comments'); | |
| 706 | +            $table->addColumn('id', 'integer', [ | |
| 707 | + 'autoincrement' => true, | |
| 708 | + 'notnull' => true, | |
| 709 | + 'length' => 4, | |
| 710 | + 'unsigned' => true, | |
| 711 | + ]); | |
| 712 | +            $table->addColumn('parent_id', 'integer', [ | |
| 713 | + 'notnull' => true, | |
| 714 | + 'length' => 4, | |
| 715 | + 'default' => 0, | |
| 716 | + 'unsigned' => true, | |
| 717 | + ]); | |
| 718 | +            $table->addColumn('topmost_parent_id', 'integer', [ | |
| 719 | + 'notnull' => true, | |
| 720 | + 'length' => 4, | |
| 721 | + 'default' => 0, | |
| 722 | + 'unsigned' => true, | |
| 723 | + ]); | |
| 724 | +            $table->addColumn('children_count', 'integer', [ | |
| 725 | + 'notnull' => true, | |
| 726 | + 'length' => 4, | |
| 727 | + 'default' => 0, | |
| 728 | + 'unsigned' => true, | |
| 729 | + ]); | |
| 730 | +            $table->addColumn('actor_type', 'string', [ | |
| 731 | + 'notnull' => true, | |
| 732 | + 'length' => 64, | |
| 733 | + 'default' => '', | |
| 734 | + ]); | |
| 735 | +            $table->addColumn('actor_id', 'string', [ | |
| 736 | + 'notnull' => true, | |
| 737 | + 'length' => 64, | |
| 738 | + 'default' => '', | |
| 739 | + ]); | |
| 740 | +            $table->addColumn('message', 'text', [ | |
| 741 | + 'notnull' => false, | |
| 742 | + ]); | |
| 743 | +            $table->addColumn('verb', 'string', [ | |
| 744 | + 'notnull' => false, | |
| 745 | + 'length' => 64, | |
| 746 | + ]); | |
| 747 | +            $table->addColumn('creation_timestamp', 'datetime', [ | |
| 748 | + 'notnull' => false, | |
| 749 | + ]); | |
| 750 | +            $table->addColumn('latest_child_timestamp', 'datetime', [ | |
| 751 | + 'notnull' => false, | |
| 752 | + ]); | |
| 753 | +            $table->addColumn('object_type', 'string', [ | |
| 754 | + 'notnull' => true, | |
| 755 | + 'length' => 64, | |
| 756 | + 'default' => '', | |
| 757 | + ]); | |
| 758 | +            $table->addColumn('object_id', 'string', [ | |
| 759 | + 'notnull' => true, | |
| 760 | + 'length' => 64, | |
| 761 | + 'default' => '', | |
| 762 | + ]); | |
| 763 | + $table->setPrimaryKey(['id']); | |
| 764 | + $table->addIndex(['parent_id'], 'comments_parent_id_index'); | |
| 765 | + $table->addIndex(['topmost_parent_id'], 'comments_topmost_parent_id_idx'); | |
| 766 | + $table->addIndex(['object_type', 'object_id', 'creation_timestamp'], 'comments_object_index'); | |
| 767 | + $table->addIndex(['actor_type', 'actor_id'], 'comments_actor_index'); | |
| 768 | + } | |
| 769 | + | |
| 770 | +        if (!$schema->hasTable('comments_read_markers')) { | |
| 771 | +            $table = $schema->createTable('comments_read_markers'); | |
| 772 | +            $table->addColumn('user_id', 'string', [ | |
| 773 | + 'notnull' => true, | |
| 774 | + 'length' => 64, | |
| 775 | + 'default' => '', | |
| 776 | + ]); | |
| 777 | +            $table->addColumn('marker_datetime', 'datetime', [ | |
| 778 | + 'notnull' => false, | |
| 779 | + ]); | |
| 780 | +            $table->addColumn('object_type', 'string', [ | |
| 781 | + 'notnull' => true, | |
| 782 | + 'length' => 64, | |
| 783 | + 'default' => '', | |
| 784 | + ]); | |
| 785 | +            $table->addColumn('object_id', 'string', [ | |
| 786 | + 'notnull' => true, | |
| 787 | + 'length' => 64, | |
| 788 | + 'default' => '', | |
| 789 | + ]); | |
| 790 | + $table->addIndex(['object_type', 'object_id'], 'comments_marker_object_index'); | |
| 791 | + $table->addUniqueIndex(['user_id', 'object_type', 'object_id'], 'comments_marker_index'); | |
| 792 | + } | |
| 793 | + | |
| 794 | +        if (!$schema->hasTable('credentials')) { | |
| 795 | +            $table = $schema->createTable('credentials'); | |
| 796 | +            $table->addColumn('user', 'string', [ | |
| 797 | + 'notnull' => true, | |
| 798 | + 'length' => 64, | |
| 799 | + ]); | |
| 800 | +            $table->addColumn('identifier', 'string', [ | |
| 801 | + 'notnull' => true, | |
| 802 | + 'length' => 64, | |
| 803 | + ]); | |
| 804 | +            $table->addColumn('credentials', 'text', [ | |
| 805 | + 'notnull' => false, | |
| 806 | + ]); | |
| 807 | + $table->setPrimaryKey(['user', 'identifier']); | |
| 808 | + $table->addIndex(['user'], 'credentials_user'); | |
| 809 | + } | |
| 810 | + | |
| 811 | +        if (!$schema->hasTable('admin_sections')) { | |
| 812 | +            $table = $schema->createTable('admin_sections'); | |
| 813 | +            $table->addColumn('id', 'string', [ | |
| 814 | + 'notnull' => true, | |
| 815 | + 'length' => 64, | |
| 816 | + ]); | |
| 817 | +            $table->addColumn('class', 'string', [ | |
| 818 | + 'notnull' => true, | |
| 819 | + 'length' => 255, | |
| 820 | + 'default' => '', | |
| 821 | + ]); | |
| 822 | +            $table->addColumn('priority', 'smallint', [ | |
| 823 | + 'notnull' => true, | |
| 824 | + 'length' => 1, | |
| 825 | + 'default' => 0, | |
| 826 | + ]); | |
| 827 | + $table->setPrimaryKey(['id']); | |
| 828 | + $table->addUniqueIndex(['class'], 'admin_sections_class'); | |
| 829 | + } | |
| 830 | + | |
| 831 | +        if (!$schema->hasTable('admin_settings')) { | |
| 832 | +            $table = $schema->createTable('admin_settings'); | |
| 833 | +            $table->addColumn('id', 'integer', [ | |
| 834 | + 'autoincrement' => true, | |
| 835 | + 'notnull' => true, | |
| 836 | + 'length' => 4, | |
| 837 | + ]); | |
| 838 | +            $table->addColumn('class', 'string', [ | |
| 839 | + 'notnull' => true, | |
| 840 | + 'length' => 255, | |
| 841 | + 'default' => '', | |
| 842 | + ]); | |
| 843 | +            $table->addColumn('section', 'string', [ | |
| 844 | + 'notnull' => false, | |
| 845 | + 'length' => 64, | |
| 846 | + ]); | |
| 847 | +            $table->addColumn('priority', 'smallint', [ | |
| 848 | + 'notnull' => true, | |
| 849 | + 'length' => 1, | |
| 850 | + 'default' => 0, | |
| 851 | + ]); | |
| 852 | + $table->setPrimaryKey(['id']); | |
| 853 | + $table->addUniqueIndex(['class'], 'admin_settings_class'); | |
| 854 | + $table->addIndex(['section'], 'admin_settings_section'); | |
| 855 | + } | |
| 856 | + | |
| 857 | +        if (!$schema->hasTable('personal_sections')) { | |
| 858 | +            $table = $schema->createTable('personal_sections'); | |
| 859 | +            $table->addColumn('id', 'string', [ | |
| 860 | + 'notnull' => true, | |
| 861 | + 'length' => 64, | |
| 862 | + ]); | |
| 863 | +            $table->addColumn('class', 'string', [ | |
| 864 | + 'notnull' => true, | |
| 865 | + 'length' => 255, | |
| 866 | + 'default' => '', | |
| 867 | + ]); | |
| 868 | +            $table->addColumn('priority', 'smallint', [ | |
| 869 | + 'notnull' => true, | |
| 870 | + 'length' => 1, | |
| 871 | + 'default' => 0, | |
| 872 | + ]); | |
| 873 | + $table->setPrimaryKey(['id']); | |
| 874 | + $table->addUniqueIndex(['class'], 'personal_sections_class'); | |
| 875 | + } | |
| 876 | + | |
| 877 | +        if (!$schema->hasTable('personal_settings')) { | |
| 878 | +            $table = $schema->createTable('personal_settings'); | |
| 879 | +            $table->addColumn('id', 'integer', [ | |
| 880 | + 'autoincrement' => true, | |
| 881 | + 'notnull' => true, | |
| 882 | + 'length' => 4, | |
| 883 | + ]); | |
| 884 | +            $table->addColumn('class', 'string', [ | |
| 885 | + 'notnull' => true, | |
| 886 | + 'length' => 255, | |
| 887 | + 'default' => '', | |
| 888 | + ]); | |
| 889 | +            $table->addColumn('section', 'string', [ | |
| 890 | + 'notnull' => false, | |
| 891 | + 'length' => 64, | |
| 892 | + ]); | |
| 893 | +            $table->addColumn('priority', 'smallint', [ | |
| 894 | + 'notnull' => true, | |
| 895 | + 'length' => 1, | |
| 896 | + 'default' => 0, | |
| 897 | + ]); | |
| 898 | + $table->setPrimaryKey(['id']); | |
| 899 | + $table->addUniqueIndex(['class'], 'personal_settings_class'); | |
| 900 | + $table->addIndex(['section'], 'personal_settings_section'); | |
| 901 | + } | |
| 902 | + | |
| 903 | +        if (!$schema->hasTable('accounts')) { | |
| 904 | +            $table = $schema->createTable('accounts'); | |
| 905 | +            $table->addColumn('uid', 'string', [ | |
| 906 | + 'notnull' => true, | |
| 907 | + 'length' => 64, | |
| 908 | + 'default' => '', | |
| 909 | + ]); | |
| 910 | +            $table->addColumn('data', 'text', [ | |
| 911 | + 'notnull' => true, | |
| 912 | + 'default' => '', | |
| 913 | + ]); | |
| 914 | + $table->setPrimaryKey(['uid']); | |
| 915 | + } | |
| 916 | + return $schema; | |
| 917 | + } | |
| 918 | 918 | |
| 919 | 919 | } | 
| @@ -11,32 +11,32 @@ | ||
| 11 | 11 | */ | 
| 12 | 12 |  class Version13000Date20170926101637 extends BigIntMigration { | 
| 13 | 13 | |
| 14 | - /** | |
| 15 | - * @return array Returns an array with the following structure | |
| 16 | - * ['table1' => ['column1', 'column2'], ...] | |
| 17 | - * @since 13.0.0 | |
| 18 | - */ | |
| 19 | -	protected function getColumnsByTable() { | |
| 20 | - return [ | |
| 21 | - 'admin_settings' => ['id'], | |
| 22 | - 'authtoken' => ['id'], | |
| 23 | - 'bruteforce_attempts' => ['id'], | |
| 24 | - 'comments' => ['id', 'parent_id', 'topmost_parent_id'], | |
| 25 | - // Disabled for now 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart'], | |
| 26 | - 'file_locks' => ['id'], | |
| 27 | - 'jobs' => ['id'], | |
| 28 | - // Disabled for now 'mimetypes' => ['id'], | |
| 29 | - 'mounts' => ['id'], | |
| 30 | - 'personal_settings' => ['id'], | |
| 31 | - 'properties' => ['id'], | |
| 32 | - 'share' => ['id', 'parent', 'file_source'], | |
| 33 | - // Disabled for now 'storages' => ['numeric_id'], | |
| 34 | - 'systemtag' => ['id'], | |
| 35 | - 'systemtag_group' => ['systemtagid'], | |
| 36 | - 'systemtag_object_mapping' => ['systemtagid'], | |
| 37 | - 'vcategory' => ['id'], | |
| 38 | - 'vcategory_to_object' => ['objid', 'categoryid'], | |
| 39 | - ]; | |
| 40 | - } | |
| 14 | + /** | |
| 15 | + * @return array Returns an array with the following structure | |
| 16 | + * ['table1' => ['column1', 'column2'], ...] | |
| 17 | + * @since 13.0.0 | |
| 18 | + */ | |
| 19 | +    protected function getColumnsByTable() { | |
| 20 | + return [ | |
| 21 | + 'admin_settings' => ['id'], | |
| 22 | + 'authtoken' => ['id'], | |
| 23 | + 'bruteforce_attempts' => ['id'], | |
| 24 | + 'comments' => ['id', 'parent_id', 'topmost_parent_id'], | |
| 25 | + // Disabled for now 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart'], | |
| 26 | + 'file_locks' => ['id'], | |
| 27 | + 'jobs' => ['id'], | |
| 28 | + // Disabled for now 'mimetypes' => ['id'], | |
| 29 | + 'mounts' => ['id'], | |
| 30 | + 'personal_settings' => ['id'], | |
| 31 | + 'properties' => ['id'], | |
| 32 | + 'share' => ['id', 'parent', 'file_source'], | |
| 33 | + // Disabled for now 'storages' => ['numeric_id'], | |
| 34 | + 'systemtag' => ['id'], | |
| 35 | + 'systemtag_group' => ['systemtagid'], | |
| 36 | + 'systemtag_object_mapping' => ['systemtagid'], | |
| 37 | + 'vcategory' => ['id'], | |
| 38 | + 'vcategory_to_object' => ['objid', 'categoryid'], | |
| 39 | + ]; | |
| 40 | + } | |
| 41 | 41 | |
| 42 | 42 | } | 
| @@ -33,75 +33,75 @@ | ||
| 33 | 33 | |
| 34 | 34 |  class ConvertFilecacheBigInt extends Command { | 
| 35 | 35 | |
| 36 | - /** @var IDBConnection */ | |
| 37 | - private $connection; | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * @param IDBConnection $connection | |
| 41 | - */ | |
| 42 | -	public function __construct(IDBConnection $connection) { | |
| 43 | - $this->connection = $connection; | |
| 44 | - parent::__construct(); | |
| 45 | - } | |
| 46 | - | |
| 47 | -	protected function configure() { | |
| 48 | - $this | |
| 49 | -			->setName('db:convert-filecache-bigint') | |
| 50 | -			->setDescription('Convert the ID columns of the filecache to BigInt'); | |
| 51 | - } | |
| 52 | - | |
| 53 | -	protected function getColumnsByTable() { | |
| 54 | - return [ | |
| 55 | - 'activity' => ['activity_id', 'object_id'], | |
| 56 | - 'activity_mq' => ['mail_id'], | |
| 57 | - 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart'], | |
| 58 | - 'mimetypes' => ['id'], | |
| 59 | - 'storages' => ['numeric_id'], | |
| 60 | - ]; | |
| 61 | - } | |
| 62 | - | |
| 63 | -	protected function execute(InputInterface $input, OutputInterface $output) { | |
| 64 | - | |
| 65 | - $schema = new SchemaWrapper($this->connection); | |
| 66 | - $updates = []; | |
| 67 | - | |
| 68 | - $tables = $this->getColumnsByTable(); | |
| 69 | -		foreach ($tables as $tableName => $columns) { | |
| 70 | -			if (!$schema->hasTable($tableName)) { | |
| 71 | - continue; | |
| 72 | - } | |
| 73 | - | |
| 74 | - $table = $schema->getTable($tableName); | |
| 75 | - | |
| 76 | -			foreach ($columns as $columnName) { | |
| 77 | - $column = $table->getColumn($columnName); | |
| 78 | -				if ($column->getType()->getName() !== Type::BIGINT) { | |
| 79 | - $column->setType(Type::getType(Type::BIGINT)); | |
| 80 | - $column->setOptions(['length' => 20]); | |
| 81 | - | |
| 82 | - $updates[] = $tableName . '.' . $columnName; | |
| 83 | - } | |
| 84 | - } | |
| 85 | - } | |
| 86 | - | |
| 87 | -		if (empty($updates)) { | |
| 88 | -			$output->writeln('<info>All tables already up to date!</info>'); | |
| 89 | - return 0; | |
| 90 | - } | |
| 91 | - | |
| 92 | -		$output->writeln('<comment>This can take up to hours, depending on the number of files in your instance!</comment>'); | |
| 93 | - | |
| 94 | -		if ($input->isInteractive()) { | |
| 95 | -			$helper = $this->getHelper('question'); | |
| 96 | -			$question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false); | |
| 97 | - | |
| 98 | -			if (!$helper->ask($input, $output, $question)) { | |
| 99 | - return 1; | |
| 100 | - } | |
| 101 | - } | |
| 102 | - | |
| 103 | - $this->connection->migrateToSchema($schema->getWrappedSchema()); | |
| 104 | - | |
| 105 | - return 0; | |
| 106 | - } | |
| 36 | + /** @var IDBConnection */ | |
| 37 | + private $connection; | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * @param IDBConnection $connection | |
| 41 | + */ | |
| 42 | +    public function __construct(IDBConnection $connection) { | |
| 43 | + $this->connection = $connection; | |
| 44 | + parent::__construct(); | |
| 45 | + } | |
| 46 | + | |
| 47 | +    protected function configure() { | |
| 48 | + $this | |
| 49 | +            ->setName('db:convert-filecache-bigint') | |
| 50 | +            ->setDescription('Convert the ID columns of the filecache to BigInt'); | |
| 51 | + } | |
| 52 | + | |
| 53 | +    protected function getColumnsByTable() { | |
| 54 | + return [ | |
| 55 | + 'activity' => ['activity_id', 'object_id'], | |
| 56 | + 'activity_mq' => ['mail_id'], | |
| 57 | + 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart'], | |
| 58 | + 'mimetypes' => ['id'], | |
| 59 | + 'storages' => ['numeric_id'], | |
| 60 | + ]; | |
| 61 | + } | |
| 62 | + | |
| 63 | +    protected function execute(InputInterface $input, OutputInterface $output) { | |
| 64 | + | |
| 65 | + $schema = new SchemaWrapper($this->connection); | |
| 66 | + $updates = []; | |
| 67 | + | |
| 68 | + $tables = $this->getColumnsByTable(); | |
| 69 | +        foreach ($tables as $tableName => $columns) { | |
| 70 | +            if (!$schema->hasTable($tableName)) { | |
| 71 | + continue; | |
| 72 | + } | |
| 73 | + | |
| 74 | + $table = $schema->getTable($tableName); | |
| 75 | + | |
| 76 | +            foreach ($columns as $columnName) { | |
| 77 | + $column = $table->getColumn($columnName); | |
| 78 | +                if ($column->getType()->getName() !== Type::BIGINT) { | |
| 79 | + $column->setType(Type::getType(Type::BIGINT)); | |
| 80 | + $column->setOptions(['length' => 20]); | |
| 81 | + | |
| 82 | + $updates[] = $tableName . '.' . $columnName; | |
| 83 | + } | |
| 84 | + } | |
| 85 | + } | |
| 86 | + | |
| 87 | +        if (empty($updates)) { | |
| 88 | +            $output->writeln('<info>All tables already up to date!</info>'); | |
| 89 | + return 0; | |
| 90 | + } | |
| 91 | + | |
| 92 | +        $output->writeln('<comment>This can take up to hours, depending on the number of files in your instance!</comment>'); | |
| 93 | + | |
| 94 | +        if ($input->isInteractive()) { | |
| 95 | +            $helper = $this->getHelper('question'); | |
| 96 | +            $question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false); | |
| 97 | + | |
| 98 | +            if (!$helper->ask($input, $output, $question)) { | |
| 99 | + return 1; | |
| 100 | + } | |
| 101 | + } | |
| 102 | + | |
| 103 | + $this->connection->migrateToSchema($schema->getWrappedSchema()); | |
| 104 | + | |
| 105 | + return 0; | |
| 106 | + } | |
| 107 | 107 | } |