Skip to content

Commit

Permalink
Add enum column examples (#444)
Browse files Browse the repository at this point in the history
Closes #376
  • Loading branch information
ryanslade authored Oct 31, 2024
1 parent b6fff69 commit 898bd84
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ Example **add column** migrations:
* [17_add_rating_column.json](../examples/17_add_rating_column.json)
* [26_add_column_with_check_constraint.json](../examples/26_add_column_with_check_constraint.json)
* [30_add_column_simple_up.json](../examples/30_add_column_simple_up.json)
* [41_add_enum_column.json](../examples/41_add_enum_column.json)

### Alter column

Expand Down
2 changes: 2 additions & 0 deletions examples/.ledger
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@
37_create_partial_index.json
38_create_hash_index_with_fillfactor.json
39_add_column_with_multiple_pk_in_table.json
40_create_enum_type.json
41_add_enum_column.json
10 changes: 10 additions & 0 deletions examples/40_create_enum_type.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "40_create_enum_type",
"operations": [
{
"sql": {
"up": "CREATE TYPE fruit_size AS ENUM ('small', 'medium', 'large');"
}
}
]
}
15 changes: 15 additions & 0 deletions examples/41_add_enum_column.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "41_add_enum_column",
"operations": [
{
"add_column": {
"table": "fruits",
"column": {
"name": "size",
"type": "fruit_size",
"default": "'small'"
}
}
}
]
}

0 comments on commit 898bd84

Please sign in to comment.