3

I have a series of matrix blocks that use a ton of the same fields and was hoping I could simply duplicate them in the database and update the context and id of the fields. It'd be a LOT faster this way however i'm unsure of the UID column, how/when that is created and if i should leave it blank, or if that column existing means i'm going to have to it all manually

  • I needed a different number, But I saw another tool that helped me so much that the tool is also very nice, I hope that's tool will be more useful too. codebeautify.org/guid-generator – user9887 Jul 13 '19 at 7:01
5

As aberkie pointed out, Craft does use them internally, but they should not be left blank or you'll potentially run into some issues now and you'll miss out on some upcoming features.

You can programmatically create one with StringHelper::UUID or use a site like guidgen.com to get a valid one.

| improve this answer | |
  • Thanks Brad, so is there little to no concern about there being duplicate UIDs if using something like guidgen? I've already got all my fields created now (did it manually) but this will be very helpful for future reference. – Christopher Healey Feb 3 '15 at 4:32
  • Nope... the chances of a proper GUID/UUID conflicting are so astronomical it's not worth worrying about. – Brad Bell Feb 3 '15 at 5:48
  • If I'm understanding this correctly, does this mean that the uid column for any given table row is not used anywhere else to reference that row (unlike columns like fieldId, layoutId, etc.)? – Sandwich Aug 20 '18 at 17:11
  • 1
    @Sandwich Within the database itself, UIDs are never used as references in foreign keys; only ID columns. However Craft does use them in a couple places as as an alternative to IDs when selecting rows, and there will be much more liberal use of selecting rows by UID in an upcoming release. – Brandon Kelly Aug 20 '18 at 17:33
1

Don't worry about the UID column. Check out this comment from Brad Bell. Craft uses the UID internally, and will add them when needed. You should be fine by leaving them blank.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.