Added migrations, each creating a new database table
This commit is contained in:
23
priv/repo/migrations/20250724224338_create_posts.exs
Normal file
23
priv/repo/migrations/20250724224338_create_posts.exs
Normal file
@@ -0,0 +1,23 @@
|
||||
defmodule Sukaato.Repo.Migrations.CreatePosts do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:posts) do
|
||||
add :title, :string
|
||||
add :abst, :text
|
||||
add :slug, :string
|
||||
add :content, :text
|
||||
add :tags, {:array, :string}
|
||||
add :cat, :string
|
||||
add :ledit, :utc_datetime
|
||||
add :auth_id, references(:users, on_delete: :nothing)
|
||||
add :rev_id, references(:users, on_delete: :nothing)
|
||||
|
||||
timestamps(type: :utc_datetime)
|
||||
end
|
||||
|
||||
create unique_index(:posts, [:title])
|
||||
create index(:posts, [:auth_id])
|
||||
create index(:posts, [:rev_id])
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user