diff --git a/lib/Migration/Version000000Date20241014120000.php b/lib/Migration/Version000000Date20241014120000.php new file mode 100644 index 0000000..8f327bf --- /dev/null +++ b/lib/Migration/Version000000Date20241014120000.php @@ -0,0 +1,100 @@ +hasTable(self::RESOURCES_TABLE)) { + $table = $schema->createTable(self::RESOURCES_TABLE); + $table->addColumn('id', Types::INTEGER, [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('parent_resource', Types::INTEGER, [ + 'notnull' => false, + ]); + $table->addColumn('group_folder_id', Types::BIGINT, [ + 'length' => 20, + 'notnull' => true, + ]); + $table->addColumn('type', Types::STRING, [ + 'length' => 20, + 'notnull' => true, + ]); + $table->addColumn('name', Types::STRING, [ + 'length' => 64, + 'notnull' => true, + ]); + $table->addColumn('active', Types::BOOLEAN, [ + 'notnull' => true, + ]); + $table->addColumn('last_updated_timestamp', Types::BIGINT, [ + 'notnull' => true, + ]); + + $table->setPrimaryKey(['id']); + $table->addForeignKeyConstraint( + $table, + ['parent_resource'], + ['id'], + ['onDelete' => 'CASCADE'], + 'organizationfolders_resources_parent_resource_id_fk'); + $table->addForeignKeyConstraint( + $schema->getTable(self::GROUP_FOLDERS_TABLE), + ['group_folder_id'], + ['folder_id'], + ['onDelete' => 'CASCADE'], + 'organizationfolders_resources_group_folder_id_fk'); + } + + if (!$schema->hasTable(self::FOLDER_RESOURCES_TABLE)) { + $table = $schema->createTable(self::FOLDER_RESOURCES_TABLE); + $table->addColumn('resource_id', Types::INTEGER, [ + 'notnull' => true, + ]); + $table->addColumn('members_acl_permission', Types::INTEGER, [ + 'length' => 11, + 'notnull' => true, + ]); + $table->addColumn('managers_acl_permission', Types::INTEGER, [ + 'length' => 11, + 'notnull' => true, + ]); + $table->addColumn('inherited_acl_permission', Types::INTEGER, [ + 'length' => 11, + 'notnull' => true, + ]); + + $table->setPrimaryKey(['resource_id']); + $table->addForeignKeyConstraint( + $schema->getTable(self::RESOURCES_TABLE), + ['resource_id'], + ['id'], + ['onDelete' => 'CASCADE'], + 'organizationfolders_folder_resources_resource_id_fk'); + } + + return $schema; + } +} \ No newline at end of file