Skip to content

Add migration scripts #49

Description

@joe-replin

Subject of the issue/enhancement/features

The adapt-youtube component ships no migration scripts at all. As a result, legacy course content whose _media._aspectRatio is stored as a string cannot be imported into the Adapt Authoring Tool, because the current component schema types that property as a number. The import aborts entirely, and the only workaround is manually editing the course JSON. Any project with a YouTube component built before the schema typed this field is affected.

Your environment

  • version (AT/Framework): Adapt Authoring Tool on Framework 5.56.2 (server). Imported course built on Framework 5.40.5. adapt-youtube 3.2.0.
  • which browser and its version: N/A (server-side import and content migration)
  • device(s) + operating system(s): N/A (server-side import and content migration)

Steps to reproduce

  1. Author or obtain a course containing an adapt-youtube component where _media._aspectRatio is a string value, for example "_aspectRatio": "1.778".
  2. Export the course as Framework source.
  3. Import the course into an Adapt Authoring Tool instance whose installed framework types _media._aspectRatio as a number.
  4. Confirm the import and let the framework content migration run.

Expected behaviour

A migration script bundled with adapt-youtube should detect a string _media._aspectRatio and coerce it to a number during import, so the course imports cleanly without manual intervention. This mirrors how other plugins ship migrations/ scripts to reconcile schema changes across versions.

Actual behaviour

The import fails and rolls back with the following error:

Import of framework content failed, youtube-component: /_media/_aspectRatio must be number

Because adapt-youtube contains no migrations/ directory and no migration scripts of any kind, there is no mechanism to reconcile the legacy string value against the numeric schema. The schema change was made without a corresponding migration, so pre-existing content is left invalid with no upgrade path. The author must hand-edit the JSON (removing the quotes around the value) before the import will succeed.

Suggested Fix (if known)

Add a migrations/ directory to adapt-youtube with a migration that converts _media._aspectRatio from a string to a number on affected component instances. While doing so, audit the component's schema history for any other type or shape changes since early versions (for example nullable fields such as _progressColor) and cover them in the same migration set, so legacy courses upgrade cleanly on import.

Metadata

Metadata

Assignees

Projects

Status
Needs Reviewing

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions