chamilo / chamilo-lms

Chamilo is a learning management system focused on ease of use and accessibility
https://chamilo.org
GNU General Public License v3.0
798 stars 480 forks source link

TrackEDownload entity has no $sessionId property #5412

Closed AngelFQC closed 3 months ago

AngelFQC commented 5 months ago

In migration Version20220614165020, the down_session_id column is renamed to session_id

https://github.com/chamilo/chamilo-lms/blob/75b34243f25cbd90b1251a930d4b3adf77d5061e/src/CoreBundle/Migrations/Schema/V200/Version20220614165020.php#L36-L37

However, the TrackEDownloads entity has no $sessionId property, down_session_id column is deleted (but it doesn't exists) in the PR #5086 https://github.com/chamilo/chamilo-lms/pull/5086/files#diff-f5716d8b38a2eb470cbff6d387a561bb9122a26f75094dd3c369778148fa2734R21

With a Chamilo migrated, when viewing or downloading a resource file you get the An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1364 Field 'session_id' doesn't have a default value message

ywarnier commented 5 months ago

So for the sake of documentation, the track_e_downloads table has been modified to replace c_id and down_session_id by one single resource_link_id which allows us to get the c_id and session_id through the resource_link table (and ResourceLink entity).

However, I don't see where we are migrating the data in the current migration.

ywarnier commented 5 months ago

As @christianbeeznest noted, I might have previously said that this data was not very important, but dropping it is practically removing forcibly information from a database, so I've asked him to add the necessary migration for that data to end up in resource_link. This might add considerable weight to 1.* -> 2.0 migrations, so a likely point of optimization would be to delete the data from track_e_downloads altogether before the migration if you don't need it.

ywarnier commented 5 months ago

Ping @christianbeeznest