diff --git a/core/Migrations/Version20170111103310.php b/core/Migrations/Version20170111103310.php new file mode 100644 index 000000000000..70c7811c0e98 --- /dev/null +++ b/core/Migrations/Version20170111103310.php @@ -0,0 +1,134 @@ +connection->getPrefix(); + if (!$schema->hasTable("${prefix}external_mounts")) { + $table = $schema->createTable("${prefix}external_mounts"); + $table->addColumn('mount_id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 20, + ]); + $table->addColumn('mount_point', 'string', [ + 'notnull' => true, + 'length' => 128, + ]); + $table->addColumn('storage_backend', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('auth_backend', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('priority', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 100, + ]); + // admin = 1, personal = 2 + $table->addColumn('type', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->setPrimaryKey(['mount_id']); + } + + if (!$schema->hasTable("${prefix}external_applicable")) { + $table = $schema->createTable("${prefix}external_applicable"); + $table->addColumn('applicable_id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 20, + ]); + // foreign key: external_mounts.mount_id + $table->addColumn('mount_id', 'bigint', [ + 'notnull' => true, + 'length' => 20, + ]); + // possible mount types: global = 1, group = 2, user = 3 + $table->addColumn('type', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('value', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->setPrimaryKey(['applicable_id']); + $table->addIndex(['mount_id'], 'applicable_mount'); + $table->addIndex(['type', 'value'], 'applicable_type_value'); + $table->addUniqueIndex(['type', 'value', 'mount_id'], 'applicable_type_value_mount'); + } + + if (!$schema->hasTable("${prefix}external_config")) { + $table = $schema->createTable("${prefix}external_config"); + $table->addColumn('config_id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 20, + ]); + // foreign key: external_mounts.mount_id + $table->addColumn('mount_id', 'bigint', [ + 'notnull' => true, + 'length' => 20, + ]); + $table->addColumn('key', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('value', 'string', [ + 'notnull' => true, + 'length' => 4096, + ]); + $table->setPrimaryKey(['config_id']); + $table->addIndex(['mount_id'], 'config_mount'); + $table->addUniqueIndex(['mount_id', 'key'], 'config_mount_key'); + } + + if (!$schema->hasTable("${prefix}external_options")) { + $table = $schema->createTable("${prefix}external_options"); + $table->addColumn('option_id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 20, + ]); + // foreign key: external_mounts.mount_id + $table->addColumn('mount_id', 'bigint', [ + 'notnull' => true, + 'length' => 20, + ]); + $table->addColumn('key', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('value', 'string', [ + 'notnull' => true, + 'length' => 256, + ]); + $table->setPrimaryKey(['option_id']); + $table->addIndex(['mount_id'], 'option_mount'); + $table->addUniqueIndex(['mount_id', 'key'], 'option_mount_key'); + } + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) { + // this down() migration is auto-generated, please modify it to your needs + + } +} diff --git a/db_structure.xml b/db_structure.xml index 40f51daa3b44..6b91c3c4c5d0 100644 --- a/db_structure.xml +++ b/db_structure.xml @@ -1884,225 +1884,4 @@ - -