Migrate from id to guid
See original GitHub issueCurrent state
- The
id
XML attribute is parsed from the schedule XML and used with the app.- Used to compose
PendingIntent
inAlarmServices
. - Used to compose
PendingIntent
inAlarmReceiver
. - Rendered in session details screen.
- Used to persist and query data in sessions, alerts and highlights database tables.
- Used to compose
id
values are not guaranteed to be unique -id
values used for different sessions cause errors. See https://github.com/voc/schedule/issues/63.- New session data is compared and modified in the
ScheduleChanges
class. - New session data is persisted by first deleting all old session data and then inserting all new session data in one transaction. See
SessionsDatabaseRepository#insert
. - The sessions table does mark any of its columns as primary key nor use an auto-increment key.
Target state
- The
guid
XML attribute is parsed from the schedule XML and used with the app.- Used to persist and query data in sessions, alerts and highlights database tables.
Preparation
- Stop parsing
sessionId
as anInteger
inAlarmServices
to compose aPendingIntent
. - Resolve
sessionId
being used as anInteger
inAlarmReceiver#onReceive
to compose aPendingIntent
. - Migrate
Highlight#sessionId
fromInt
toString
. SeeHighlightDBOpenHelper
.
TODOs
- Parse
guid
XML attribute. - Use
guid
within the app. - Check if
id
XML attribute can be removed. -> Removed. - Revise
SessionUrlComposer
and related tests. - Update sample data in tests - use typical guid sample data.
- Display
guid
value? -> No value for the user. - Clarify if data can be kept on application update. -> Data will be wiped on application update.
- Clarify if Chaosflix export will be broken when moving from
id
toguid
.
Related
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
How can I change an int ID column to Guid with EF migration?
I'm using EF code-first approach and want to change the Id field to guid ...
Read more >Migrating from int-based primary keys to GUID? : r/csharp
Overall, it's pretty straightforward. Add a column for each table with the new ID, generate a GUID for each row, update all navigation ......
Read more >Id to Uuid migration classes for Doctrine - GitHub
Easily migrate from an auto incremented integer id to a uuid in a project using DoctrineMigrationsBundle. Autodetect your foreign keys and update them....
Read more >Migrations and Seed Data With Entity Framework Core
EF Core provides a method called Migrate to execute migration actions for us. ... Column<Guid>(nullable: false), ... Id = Guid.NewGuid(),.
Read more >UUID Primary Key in Elixir Phoenix with PostgreSQL and Ecto
Changing the primary key type in the table is not straightforward. You need to start by running a similar migration that will create...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No, should not be affected, chaoflix uses guid for importing.
I think a better approach would be to use an auto-incrementing INTEGER column to uniquely identify a session in the database. This will keep the app simple in situations where stable numeric identifiers are required or at least very helpful (e.g. in a
RecyclerView.Adapter
).This way only the code that maps between network model and app model has to be aware of GUIDs. If the identifier in the network format changes in the future only the mapping code needs to be updated.
Using that approach also allows splitting this change into two parts:
guid
attribute instead ofid
attribute for matching items.