Skip to content

Commit 898bd84

Browse files
authored
Add enum column examples (#444)
Closes #376
1 parent b6fff69 commit 898bd84

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ Example **add column** migrations:
741741
* [17_add_rating_column.json](../examples/17_add_rating_column.json)
742742
* [26_add_column_with_check_constraint.json](../examples/26_add_column_with_check_constraint.json)
743743
* [30_add_column_simple_up.json](../examples/30_add_column_simple_up.json)
744+
* [41_add_enum_column.json](../examples/41_add_enum_column.json)
744745

745746
### Alter column
746747

examples/.ledger

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@
3737
37_create_partial_index.json
3838
38_create_hash_index_with_fillfactor.json
3939
39_add_column_with_multiple_pk_in_table.json
40+
40_create_enum_type.json
41+
41_add_enum_column.json

examples/40_create_enum_type.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "40_create_enum_type",
3+
"operations": [
4+
{
5+
"sql": {
6+
"up": "CREATE TYPE fruit_size AS ENUM ('small', 'medium', 'large');"
7+
}
8+
}
9+
]
10+
}

examples/41_add_enum_column.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "41_add_enum_column",
3+
"operations": [
4+
{
5+
"add_column": {
6+
"table": "fruits",
7+
"column": {
8+
"name": "size",
9+
"type": "fruit_size",
10+
"default": "'small'"
11+
}
12+
}
13+
}
14+
]
15+
}

0 commit comments

Comments
 (0)