Repository: appwrite/appwrite
File: app/controllers/api/migrations.php (PHP)

Code before:
            ->dynamic($migration, Response::MODEL_MIGRATION);
    });

App::post('/v1/migrations/csv')
    ->groups(['api', 'migrations'])
    ->desc('Import documents from a CSV')
    ->label('scope', 'migrations.write')
    ->label('event', 'migrations.[migrationId].create')
    ->label('audits.event', 'migration.create')
    ->label('sdk', new Method(
        namespace: 'migrations',
        group: null,
        name: 'createCsvMigration',
        description: '/docs/references/migrations/migration-csv.md',
        auth: [AuthType::ADMIN],
        responses: [
            new SDKResponse(
                code: Response::STATUS_CODE_ACCEPTED,
                model: Response::MODEL_MIGRATION,
            )
        ]
    ))
    ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).')
    ->param('fileId', '', new UID(), 'File ID.')
    ->param('resourceId', null, new CompoundUID(), 'Composite ID in the format {databaseId:collectionId}, identifying a collection within a database.')
    ->param('internalFile', false, new Boolean(), 'For uploading to internal bucket', true)
    ->inject('response')
    ->inject('dbForProject')
    ->inject('dbForPlatform')
    ->inject('project')
    ->inject('deviceForFiles')
    ->inject('deviceForImports')
    ->inject('queueForEvents')
    ->inject('queueForMigrations')
    ->action(function (string $bucketId, string $fileId, string $resourceId, bool $internalFile, Response $response, Database $dbForProject, Database $dbForPlatform, Document $project, Device $deviceForFiles, Device $deviceForImports, Event $queueForEvents, Migration $queueForMigrations) {
        $isAPIKey = Auth::isAppUser(Authorization::getRoles());
        $isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles());
        if ($internalFile && !$isPrivilegedUser) {
            throw new Exception(Exception::USER_UNAUTHORIZED);
        }
        $bucket = Authorization::skip(function () use ($internalFile, $dbForPlatform, $dbForProject, $bucketId) {
            if ($internalFile) {
                return $dbForPlatform->getDocument('buckets', 'default');
            }
            return $dbForProject->getDocument('buckets', $bucketId);
        });

        if ($bucket->isEmpty() || (!$isAPIKey && !$isPrivilegedUser)) {
            throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND);
        }


Review comment (suggestion):
```suggestion
    ->param('internalFile', false, new Boolean(), 'Is the file stored in an internal bucket?', true)
```

Code after:
            ->dynamic($migration, Response::MODEL_MIGRATION);
    });

App::post('/v1/migrations/csv')
    ->groups(['api', 'migrations'])
    ->desc('Import documents from a CSV')
    ->label('scope', 'migrations.write')
    ->label('event', 'migrations.[migrationId].create')
    ->label('audits.event', 'migration.create')
    ->label('sdk', new Method(
        namespace: 'migrations',
        group: null,
        name: 'createCsvMigration',
        description: '/docs/references/migrations/migration-csv.md',
        auth: [AuthType::ADMIN],
        responses: [
            new SDKResponse(
                code: Response::STATUS_CODE_ACCEPTED,
                model: Response::MODEL_MIGRATION,
            )
        ]
    ))
    ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).')
    ->param('fileId', '', new UID(), 'File ID.')
    ->param('resourceId', null, new CompoundUID(), 'Composite ID in the format {databaseId:collectionId}, identifying a collection within a database.')
    ->param('internalFile', false, new Boolean(), 'Is the file stored in an internal bucket?', true)
    ->inject('response')
    ->inject('dbForProject')
    ->inject('dbForPlatform')
    ->inject('project')
    ->inject('deviceForFiles')
    ->inject('deviceForImports')
    ->inject('queueForEvents')
    ->inject('queueForMigrations')
    ->action(function (string $bucketId, string $fileId, string $resourceId, bool $internalFile, Response $response, Database $dbForProject, Database $dbForPlatform, Document $project, Device $deviceForFiles, Device $deviceForImports, Event $queueForEvents, Migration $queueForMigrations) {
        $isAPIKey = Auth::isAppUser(Authorization::getRoles());
        $isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles());
        if ($internalFile && !$isPrivilegedUser) {
            throw new Exception(Exception::USER_UNAUTHORIZED);
        }
        $bucket = Authorization::skip(function () use ($internalFile, $dbForPlatform, $dbForProject, $bucketId) {
            if ($internalFile) {
                return $dbForPlatform->getDocument('buckets', 'default');
            }
            return $dbForProject->getDocument('buckets', $bucketId);
        });

        if ($bucket->isEmpty() || (!$isAPIKey && !$isPrivilegedUser)) {
            throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND);
        }