Add: migration to create notes table
This commit is contained in:
parent
b881d0957c
commit
163acc22f4
1 changed files with 15 additions and 0 deletions
|
@ -0,0 +1,15 @@
|
||||||
|
defmodule NotesApp.Repo.Migrations.CreateNotes do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
create table(:notes) do
|
||||||
|
add :title, :string
|
||||||
|
add :content, :text
|
||||||
|
add :user_id, references(:users, on_delete: :nothing)
|
||||||
|
|
||||||
|
timestamps(type: :utc_datetime)
|
||||||
|
end
|
||||||
|
|
||||||
|
create index(:notes, [:user_id])
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue