Files
Classeo/backend/migrations/Version20260324162229.php
Mathias STRASSER df25a8cbb0
Some checks failed
CI / Backend Tests (push) Has been cancelled
CI / Frontend Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Naming Conventions (push) Has been cancelled
CI / Build Check (push) Has been cancelled
feat: Permettre à l'élève de rendre un devoir avec réponse texte et pièces jointes
L'élève peut désormais répondre à un devoir via un éditeur WYSIWYG,
joindre des fichiers (PDF, JPEG, PNG, DOCX), sauvegarder un brouillon
et soumettre définitivement son rendu. Le système détecte automatiquement
les soumissions en retard par rapport à la date d'échéance.

Côté enseignant, une page dédiée affiche la liste complète des élèves
avec leur statut (soumis, en retard, brouillon, non rendu), le détail
de chaque rendu avec ses pièces jointes téléchargeables, et les
statistiques de rendus par classe.
2026-03-25 19:38:47 +01:00

52 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260324162229 extends AbstractMigration
{
public function getDescription(): string
{
return 'Create homework_submissions and submission_attachments tables';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE homework_submissions (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id UUID NOT NULL,
homework_id UUID NOT NULL REFERENCES homework(id),
student_id UUID NOT NULL REFERENCES users(id),
response_html TEXT,
status VARCHAR(20) NOT NULL DEFAULT \'draft\',
submitted_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
UNIQUE (homework_id, student_id)
)');
$this->addSql('CREATE TABLE submission_attachments (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
submission_id UUID NOT NULL REFERENCES homework_submissions(id) ON DELETE CASCADE,
filename VARCHAR(255) NOT NULL,
file_path VARCHAR(500) NOT NULL,
file_size INT NOT NULL,
mime_type VARCHAR(100) NOT NULL,
uploaded_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
)');
$this->addSql('CREATE INDEX idx_submission_homework_tenant ON homework_submissions(homework_id, tenant_id)');
$this->addSql('CREATE INDEX idx_submission_lookup ON homework_submissions(homework_id, student_id, tenant_id)');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE IF EXISTS submission_attachments');
$this->addSql('DROP TABLE IF EXISTS homework_submissions');
}
}