I'm using a custom type that consists of keys like title, text, datetime, keywords etc. My simple "database" is just a list of hundreds of these.
The problem is that as for now I'm using their Unix times to identify them, and that was a big mistake, as due to how the app works there will be multiple of the same dates.
So naturally, I want to include the ID key in my custom type now.
The database is saved and loaded to/from file using RandomAccessFile library. How can I "migrate" the database to convert the old custom types to the new one? All the other keys are the same, I just want to add the "ID" key that I will pre-populate with increasing numbers while doing that. Will I need to create a second temporary type for that?
How will the app behave if I load up the RandomAccessFile, but the custom type has been now modified with an extra key? Will its' values be empty, or will it crash while loading the file into a list?
TL;DR I want to add a new key "ID" to my custom type, but the database (not sql or anything. pure list) list contains these types in the "old version", so without the newly added key in custom type definition. Will the list load from RandomAccessFile correctly and can I just iterate through it setting the new key to the values I want?
The problem is that as for now I'm using their Unix times to identify them, and that was a big mistake, as due to how the app works there will be multiple of the same dates.
So naturally, I want to include the ID key in my custom type now.
The database is saved and loaded to/from file using RandomAccessFile library. How can I "migrate" the database to convert the old custom types to the new one? All the other keys are the same, I just want to add the "ID" key that I will pre-populate with increasing numbers while doing that. Will I need to create a second temporary type for that?
How will the app behave if I load up the RandomAccessFile, but the custom type has been now modified with an extra key? Will its' values be empty, or will it crash while loading the file into a list?
TL;DR I want to add a new key "ID" to my custom type, but the database (not sql or anything. pure list) list contains these types in the "old version", so without the newly added key in custom type definition. Will the list load from RandomAccessFile correctly and can I just iterate through it setting the new key to the values I want?