Skip to content

Commit

Permalink
udpate item.cid migration dwyl/mvp#410
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Aug 24, 2023
1 parent 8bffcfe commit 79f8725
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/mvp/15-item-cid.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,42 @@ create a migration file:
mix ecto.gen.migration add_cid_to_item
```

You should see output similar to the following:

```sh
* creating priv/repo/migrations/20230824153220_add_cid_to_item.exs
```

This tells us that the migration file was created:
`priv/repo/migrations/20230824153220_add_cid_to_item.exs`
Open the file, you should see a blank migration:

```elixir
defmodule App.Repo.Migrations.AddCidToItem do
use Ecto.Migration

def change do

end
end
```


Update it to:

```elixir
defmodule App.Repo.Migrations.AddCidToItem do
use Ecto.Migration

def change do
alter table(:items) do
add(:cid, :string)
end
end
end
```


> **Note**: if you're rusty on `migrations`,
see:
[devhints.io/phoenix-migrations](https://devhints.io/phoenix-migrations)

0 comments on commit 79f8725

Please sign in to comment.