elimu-ai / webapp

🖥 Web application for hosting Android applications and educational content
https://hin.elimu.ai
MIT License
30 stars 54 forks source link

Rename `LetterSoundCorrespondence` to `LetterSound` #1677

Closed nya-elimu closed 1 week ago

nya-elimu commented 1 month ago

Rename the LetterSoundCorrespondence entity.

From LetterSoundCorrespondence.java to LetterSound.java.

SnehaHS65 commented 1 month ago

Hi, can I take up this issue?

nya-elimu commented 1 month ago

Hi, can I take up this issue?

@SnehaHS65 Yes, please do 🙂

jo-elimu commented 1 week ago

@SnehaHS65 After running the DB migration script, I just realized that

ALTER TABLE `LetterSound_Letter` DROP COLUMN `LetterSound_id`;

and

ALTER TABLE `LetterSound_Sound` DROP COLUMN `LetterSound_id`;

will not work because they don't exist. These columns do get created automatically, but only in the new empty tables LetterSound_Letter and LetterSound_Sound. And since we delete those empty tables before renaming the original tables, we can remove these DROP COLUMN commands from the file: https://github.com/elimu-ai/webapp/pull/1777/files

jo-elimu commented 1 week ago

Done:

[HIN] 05:53:05.488 [main] INFO  ai.elimu.util.db.DbMigrationHelper - Migration script found for version 2004022
[HIN] 05:53:05.488 [main] INFO  ai.elimu.util.db.DbMigrationHelper - Executing sql: DROP TABLE IF EXISTS `LetterSound`;
[HIN] 05:53:05.499 [main] INFO  ai.elimu.util.db.DbMigrationHelper - Executing sql: ALTER TABLE `LetterSoundCorrespondence` RENAME TO `LetterSound`;
[HIN] 05:53:05.503 [main] INFO  ai.elimu.util.db.DbMigrationHelper - Executing sql: DROP TABLE IF EXISTS `LetterSound_Letter`;
[HIN] 05:53:05.505 [main] INFO  ai.elimu.util.db.DbMigrationHelper - Executing sql: ALTER TABLE `LetterSoundCorrespondence_Letter` RENAME TO `LetterSound_Letter`;
[HIN] 05:53:05.509 [main] INFO  ai.elimu.util.db.DbMigrationHelper - Executing sql: ALTER TABLE `LetterSound_Letter` CHANGE `LetterSoundCorrespondence_id` `LetterSound_id` bigint(20) NOT NULL;
[HIN] 05:53:05.515 [main] INFO  ai.elimu.util.db.DbMigrationHelper - Executing sql: DROP TABLE IF EXISTS `LetterSound_Sound`;
[HIN] 05:53:05.519 [main] INFO  ai.elimu.util.db.DbMigrationHelper - Executing sql: ALTER TABLE `LetterSoundCorrespondence_Sound` RENAME TO `LetterSound_Sound`;
[HIN] 05:53:05.524 [main] INFO  ai.elimu.util.db.DbMigrationHelper - Executing sql: ALTER TABLE `LetterSound_Sound` CHANGE `LetterSoundCorrespondence_id` `LetterSound_id` bigint(20) NOT NULL;
[HIN] 05:53:05.536 [main] INFO  ai.elimu.util.db.DbMigrationHelper - Executing sql: DROP TABLE IF EXISTS `Word_LetterSound`;
[HIN] 05:53:05.541 [main] INFO  ai.elimu.util.db.DbMigrationHelper - Executing sql: ALTER TABLE `Word_LetterSoundCorrespondence` RENAME TO `Word_LetterSound`;
[HIN] 05:53:05.545 [main] INFO  ai.elimu.util.db.DbMigrationHelper - Updating current version (2004022)
[HIN] 05:53:05.550 [main] INFO  ai.elimu.util.db.DbMigrationHelper - Database migration complete!

@SnehaHS65 Your changes are now in production (http://hin.elimu.ai/ + http://tgl.elimu.ai/), and from what I can see everything is running smoothly. Thank you very much for putting so much time and effort into this change, which I think helped make the code more simple and easier to work with.