@@ -167,7 +167,7 @@ Every action has a `type`. The supported types are detailed below.
168#### Create table
168#### Create table
170−The `create_table` action will create a new table with the specified columns, indices and constraints.
170+The `create_table` action will create a new table with the specified columns, indices and constraints. You can optionally provide an `up` option to backfill values from an existing table.
172_Example: create a `customers` table with a few columns and a primary key_
172_Example: create a `customers` table with a few columns and a primary key_
@@ -226,6 +226,28 @@ primary_key = ["id"]
226 referenced_columns = ["id"]
226 referenced_columns = ["id"]
229+_Example: create `profiles` table based on existing `users` table_
233+type = "create_table"
235+primary_key = ["user_id"]
245+ # Backfill from `users` table and copy `users.email` to `user_email` column
248+ values = { user_id = "id", user_email = "email" }
229#### Rename table
251#### Rename table
231The `rename_table` action will change the name of an existing table.
253The `rename_table` action will change the name of an existing table.