[GH-ISSUE #431] WebServiceEntity and SyncUrl seem to be identical #303

Open
opened 2026-02-28 01:24:03 +03:00 by kerem · 7 comments
Owner

Originally created by @alxndrsn on GitHub (Apr 8, 2016).
Original GitHub issue: https://github.com/ushahidi/SMSSync/issues/431

There are two classes which look identical: WebServiceEntity and SyncUrl. I suspect one of them is outdated, but they're both used in various different places in the codebase, so it's not clear if that's actually the case.

Originally created by @alxndrsn on GitHub (Apr 8, 2016). Original GitHub issue: https://github.com/ushahidi/SMSSync/issues/431 There are two classes which look identical: [`WebServiceEntity`](https://github.com/ushahidi/SMSSync/blob/master/smssync/src/main/java/org/addhen/smssync/domain/entity/WebServiceEntity.java) and [`SyncUrl`](https://github.com/ushahidi/SMSSync/blob/master/smssync/src/main/java/org/addhen/smssync/data/entity/SyncUrl.java). I suspect one of them is outdated, but they're both used in various different places in the codebase, so it's not clear if that's actually the case.
Author
Owner

@eyedol commented on GitHub (Apr 22, 2016):

@alxndrsn This is a technical debt. The database library uses the class name as the table name. I changed the class names when I was refactoring the code base. Later I discovered I had to maintain the old class name, SyncUrl if I don't want to update the db. This will require writing more code. It needs revisiting. Perhaps for now note a comment in SyncUrl why it's name is so?

<!-- gh-comment-id:213274519 --> @eyedol commented on GitHub (Apr 22, 2016): @alxndrsn This is a technical debt. The database library uses the class name as the table name. I changed the class names when I was refactoring the code base. Later I discovered I had to maintain the old class name, `SyncUrl` if I don't want to update the db. This will require writing more code. It needs revisiting. Perhaps for now note a comment in `SyncUrl` why it's name is so?
Author
Owner

@alxndrsn commented on GitHub (Apr 22, 2016):

If SyncUrl has to stay, would it be possible to remove WebServiceEntity?

<!-- gh-comment-id:213339911 --> @alxndrsn commented on GitHub (Apr 22, 2016): If `SyncUrl` has to stay, would it be possible to remove `WebServiceEntity`?
Author
Owner

@eyedol commented on GitHub (Apr 22, 2016):

We can do that but it'll change the nomenclature all together. You can go for it though.

<!-- gh-comment-id:213342841 --> @eyedol commented on GitHub (Apr 22, 2016): We can do that but it'll change the nomenclature all together. You can go for it though.
Author
Owner

@alxndrsn commented on GitHub (Apr 22, 2016):

Looks like we could change the database table name in BaseDatabaseHelper.onUpgrade(), and therefore get rid of SyncUrl.

<!-- gh-comment-id:213345557 --> @alxndrsn commented on GitHub (Apr 22, 2016): Looks like we could change the database table name in [`BaseDatabaseHelper.onUpgrade()`](https://github.com/ushahidi/SMSSync/blob/a1f2224bbb4488a9772eb35a1d8648e0dc350a59/smssync/src/main/java/org/addhen/smssync/data/database/BaseDatabaseHelper.java#L96), and therefore get rid of `SyncUrl`.
Author
Owner

@eyedol commented on GitHub (Apr 22, 2016):

@alxndrsn Yeah you can. You've to do the data migration. There is no decent migration tool for Android as far as I know. Mostly I write them manually. Say if you upgrade from the app from x.x.y to x.x.z, all the saved data has to move with it. Not sure if there is a sql query to rename a table without having to create temp tables and move data around.

<!-- gh-comment-id:213504031 --> @eyedol commented on GitHub (Apr 22, 2016): @alxndrsn Yeah you can. You've to do the data migration. There is no decent migration tool for Android as far as I know. Mostly I write them manually. Say if you upgrade from the app from x.x.y to x.x.z, all the saved data has to move with it. Not sure if there is a `sql` query to rename a table without having to create temp tables and move data around.
Author
Owner

@alxndrsn commented on GitHub (Apr 22, 2016):

Something like:

ALTER TABLE SyncUrl RENAME TO WebSericeEntity

should do it: https://www.sqlite.org/lang_altertable.html

<!-- gh-comment-id:213509172 --> @alxndrsn commented on GitHub (Apr 22, 2016): Something like: ``` SQL ALTER TABLE SyncUrl RENAME TO WebSericeEntity ``` should do it: https://www.sqlite.org/lang_altertable.html
Author
Owner

@eyedol commented on GitHub (Apr 23, 2016):

That should probably do the trick

<!-- gh-comment-id:213644729 --> @eyedol commented on GitHub (Apr 23, 2016): That should probably do the trick
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SMSSync#303
No description provided.