Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TrackEDownload entity has no $sessionId property #5412

Open
AngelFQC opened this issue Apr 22, 2024 · 3 comments
Open

TrackEDownload entity has no $sessionId property #5412

AngelFQC opened this issue Apr 22, 2024 · 3 comments

Comments

@AngelFQC
Copy link
Member

AngelFQC commented Apr 22, 2024

In migration Version20220614165020, the down_session_id column is renamed to session_id

$this->addSql('ALTER TABLE track_e_downloads CHANGE down_session_id session_id INT NOT NULL');
$this->addSql('CREATE INDEX session_id ON track_e_downloads (session_id)');

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

@AngelFQC AngelFQC added the Bug label Apr 22, 2024
@AngelFQC AngelFQC added this to the 2.0 milestone Apr 22, 2024
christianbeeznest added a commit to christianbeeznest/chamilo-lms that referenced this issue Apr 25, 2024
christianbeeznest added a commit that referenced this issue Apr 25, 2024
Internal: Adjust down migration for track_e_downloads schema changes - refs #5412
@AngelFQC AngelFQC assigned AngelFQC and unassigned ywarnier Apr 29, 2024
@ywarnier
Copy link
Member

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
Copy link
Member

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
Copy link
Member

Ping @christianbeeznest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants