# |
Mar 12th 2019, 15:28 |
half2me |
just thought it might be cleaner if I could use a behavior |
# |
Mar 12th 2019, 15:28 |
jeremyharris |
ok no the generation is done outside of the type class (using the type class newId method) |
# |
Mar 12th 2019, 15:28 |
half2me |
and just put it in the beforeSave |
# |
Mar 12th 2019, 15:27 |
jeremyharris |
lemme check the type class |
# |
Mar 12th 2019, 15:27 |
half2me |
i mean I could always use the Text::uuid() |
# |
Mar 12th 2019, 15:27 |
jeremyharris |
nah not that I know of. there might be on FOC awesome list |
# |
Mar 12th 2019, 15:27 |
half2me |
there were functions for generating, renewing etc. |
# |
Mar 12th 2019, 15:27 |
half2me |
and I saw in the database type |
# |
Mar 12th 2019, 15:27 |
half2me |
because I would need to regenerate those values sometimes |
# |
Mar 12th 2019, 15:27 |
jeremyharris |
but char(36) is still what you want |
# |
Mar 12th 2019, 15:27 |
half2me |
just wondering if there is a behavior for that |
# |
Mar 12th 2019, 15:27 |
half2me |
no problem, yeah I thought I would need to |
# |
Mar 12th 2019, 15:26 |
jeremyharris |
sorry I misunderstood |
# |
Mar 12th 2019, 15:26 |
half2me |
I mean it doesn't cause any problems if we always stamp it |
# |
Mar 12th 2019, 15:26 |
jeremyharris |
then if it’s just a field like that you will have to populate it yourself |
# |
Mar 12th 2019, 15:26 |
half2me |
but only sometimes stamped |
# |
Mar 12th 2019, 15:26 |
jeremyharris |
ooooh |
# |
Mar 12th 2019, 15:26 |
half2me |
its just an identifier stamped on an entity |
# |
Mar 12th 2019, 15:26 |
half2me |
none |
# |
Mar 12th 2019, 15:26 |
jeremyharris |
is this for a FK or a PK? |
# |
Mar 12th 2019, 15:26 |
half2me |
Seems to me like it shouldn't by default |
# |
Mar 12th 2019, 15:26 |
half2me |
would the default behavior stamp anyway? |
# |
Mar 12th 2019, 15:25 |
half2me |
if its allowed to be null though |
# |
Mar 12th 2019, 15:25 |
half2me |
but still no stamping :) |
# |
Mar 12th 2019, 15:25 |
half2me |
@jeremyharris I changed my migration, and its generating a CHAR(36) nicely |
# |
Mar 12th 2019, 15:19 |
jeremyharris |
and bake your fixture, if your fixture doesn’t show up as a type=uuid something was wrong |
# |
Mar 12th 2019, 15:18 |
half2me |
just as a normal one |
# |
Mar 12th 2019, 15:18 |
half2me |
I don't want it as the primary index |
# |
Mar 12th 2019, 15:18 |
jeremyharris |
yeah that would be best :slightly_smiling_face: |
# |
Mar 12th 2019, 15:18 |
jeremyharris |
also, set it as the primary index |
# |
Mar 12th 2019, 15:18 |
half2me |
maybe I'll just use the uuid type in the migration :) |
# |
Mar 12th 2019, 15:18 |
half2me |
ah okay :) |
# |
Mar 12th 2019, 15:18 |
jeremyharris |
you want char(36) |
# |
Mar 12th 2019, 15:18 |
half2me |
but when I create a new entity and save, it stays null |
# |
Mar 12th 2019, 15:17 |
half2me |
its a varchar(36) |
# |
Mar 12th 2019, 15:17 |
half2me |
my uuid field is just null |
# |
Mar 12th 2019, 15:17 |
jeremyharris |
you shouldn’t need to do anything in initializeSchema |
# |
Mar 12th 2019, 15:17 |
half2me |
but it doesn't seem to be generating one automatically |
# |
Mar 12th 2019, 15:16 |
half2me |
@jeremyharris I even tried setting the column type to uuid manually in the initializeSchema |
# |
Mar 12th 2019, 14:13 |
half2me |
alright, I'll try that, thanks @jeremyharris |
# |
Mar 12th 2019, 14:12 |
jeremyharris |
and if you want to validate your keys, using `uuid` in validation will do the trick |