You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `create_table` function will also generate an `id` column of type `integer` that will auto-increment. It will also generate two `timestamp` columns; `created_at` and `updated_at`.
26
+
The `create_table` function will generate an `id` column of type `integer` that will auto-increment. This can be changed to use the [`UUID`](https://github.com/gobuffalo/uuid) type:
27
27
28
-
Columns all have the same syntax. First is the name of the column. Second is the type of the field. Third is any options you want to set on that column.
28
+
```javascript
29
+
create_table("users", func(t) {
30
+
t.Column("id", "uuid", {})
31
+
// ...
32
+
})
33
+
```
34
+
35
+
It will also generate two `timestamp` columns; `created_at` and `updated_at`.
36
+
37
+
The `t.Columns` method takes the following arguments: name of the column, the type of the field, and finally the last argument is any options you want to set on that column.
29
38
30
39
#### <aname="column-info"></a> "Common" Types:
31
40
@@ -34,8 +43,11 @@ Columns all have the same syntax. First is the name of the column. Second is the
34
43
*`timestamp`, `time`, `datetime`
35
44
*`integer`
36
45
*`bool`
46
+
*`uuid`
47
+
48
+
Any other type passed it will be be passed straight through to the underlying database.
37
49
38
-
Any other type passed it will be be passed straight through to the underlying database. For example for PostgreSQL you could pass `jsonb`and it will be supported, however, SQLite will yell very loudly at you if you do the same thing!
50
+
For example for PostgreSQL you could pass `jsonb`and it will be supported, however, SQLite will yell very loudly at you if you do the same thing!
0 commit comments