<p>Don't worry about the UID column. Check out <a href="https://craftcms.stackexchange.com/questions/6599/activerecord-defineattributes#comment7535_6601">this comment from Brad Bell</a>. Craft uses the UID internally, and will add them when needed. You should be fine by leaving them blank.</p>

CC BY-SA 3.0
2015-02-02T14:34:13.563Z
2015-02-02T14:34:13.563Z
2017-04-13T12:51:00.200Z
Aaron Berkowitz
<p>As <a href="https://craftcms.stackexchange.com/a/6923/57">aberkie</a> 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.</p>

<p>You can programmatically create one with <a href="http://buildwithcraft.com/classreference/helpers/StringHelper#UUID-detail" rel="nofollow noreferrer">StringHelper::UUID</a> or use a site like <a href="http://www.guidgen.com/" rel="nofollow noreferrer">guidgen.com</a> to get a valid one.</p>

CC BY-SA 3.0
2015-02-03T04:32:01.497Z
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
CC BY-SA 3.0
2015-02-03T05:48:11.703Z
Nope... the chances of a proper GUID/UUID conflicting are so astronomical it's not worth worrying about.
Brad Bell
CC BY-SA 4.0
2018-08-20T17:11:31.697Z
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
CC BY-SA 4.0
2018-08-20T17:33:46.487Z
@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
CC BY-SA 3.0
2015-02-02T15:58:20.290Z
2015-02-02T16:27:00.997Z
2017-04-13T12:51:00.303Z
Brad Bell
<p>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</p>

<field>
Clarification on UID creation
# Clarification on UID creation

(Asked by: username_0 on 2015-02-02)

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

**Tags:** field

---

## 2 answers

### Answer by username_2 on 2015-02-02. Score: 6 | Accepted answer

As [aberkie](https://craftcms.stackexchange.com/a/6923/57) 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](http://buildwithcraft.com/classreference/helpers/StringHelper#UUID-detail) or use a site like [guidgen.com](http://www.guidgen.com/) to get a valid one.

> **Comments:**
> **username_0**: 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.  
> **username_2**: Nope... the chances of a proper GUID/UUID conflicting are so astronomical it's not worth worrying about.  
> **username_3**: 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.)?  
> **username_4**: @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.  

---

### Answer by username_1 on 2015-02-02. Score: 0

Don't worry about the UID column. Check out [this comment from Brad Bell](https://craftcms.stackexchange.com/questions/6599/activerecord-defineattributes#comment7535_6601). Craft uses the UID internally, and will add them when needed. You should be fine by leaving them blank.


---

