This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
bdfr-browser/priv/repo/migrations/20230813175025_create_subreddits.exs

17 lines
461 B
Elixir

defmodule BdfrBrowser.Repo.Migrations.CreateSubreddits do
use Ecto.Migration
def change do
create table(:subreddits, primary_key: false) do
add :id, :bigserial, primary_key: true
add :name, :string, size: 1024, unique: true
end
alter table("posts") do
add :subreddit_id, references(:subreddits, type: :bigserial)
end
create index("posts", :subreddit_id)
create index("subreddits", :name, unique: true)
end
end