More progress made today on GFT. I got two more db models created and seeded the data in them. I also learned about UUIDs for the next few models coming up.
I came across these while setting up the models. I wanted the primary key to be generated sequentially; Sequelize does this automatically to create an
id column, but I wanted to name this column differently to make it easier to reference foreign keys down the line.
UUID stands for universally unique identifier and it’s a randomly-generated string for each line of data. Turns out this isn’t at all what I wanted for the first models (something like
9eb174d5-f4d6-4a66-b808-25e3e88efb81 is definitely overkill for a table with 8 rows of data!), but I think it will be useful later for interactions/transactions that occur in a much higher volume.
But I did learn that Sequelize gives you the option of using
UUIDV4 if you do use these…this article explained that V1 UUIDs will contain information to identify your computer as well as the time & date that the row of data was created, while V4 IDs will always be completely random.
Since I’m using scripts to seed the data at this stage, there’s a high enough chance that I could end up with duplicate IDs if I were to go with V1, so best to avoid that for now, though I do think it might be useful to use them for other types of data.
Codebar tomorrow, I’m going to work on migrating a huge external data dump into the app.