mirror of
https://github.com/mgerb/classic-wow-forums
synced 2026-01-14 02:52:49 +00:00
lots of things done: thread - reply - category - seeds
This commit is contained in:
@@ -4,15 +4,15 @@ defmodule MyApp.Repo.Migrations.CreateThread do
|
||||
def change do
|
||||
create table(:thread) do
|
||||
add :title, :string
|
||||
add :category_id, :integer
|
||||
add :content, :string
|
||||
add :view_count, :integer
|
||||
add :user_id, references(:user)
|
||||
add :last_reply_id, :integer
|
||||
add :last_reply_id, :integer # TODO: figure this out
|
||||
add :sticky, :boolean
|
||||
add :locked, :boolean
|
||||
|
||||
add :edited, :boolean
|
||||
timestamps()
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
13
priv/repo/migrations/20180103015757_create_category.exs
Normal file
13
priv/repo/migrations/20180103015757_create_category.exs
Normal file
@@ -0,0 +1,13 @@
|
||||
defmodule MyApp.Repo.Migrations.CreateCategory do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:category) do
|
||||
add :category, :string
|
||||
add :title, :string
|
||||
end
|
||||
|
||||
create unique_index(:category, [:category, :title])
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
defmodule MyApp.Repo.Migrations.ThreadCategoryForeignKey do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:thread) do
|
||||
modify :category_id, references(:category)
|
||||
end
|
||||
end
|
||||
end
|
||||
14
priv/repo/migrations/20180103040352_create_reply.exs
Normal file
14
priv/repo/migrations/20180103040352_create_reply.exs
Normal file
@@ -0,0 +1,14 @@
|
||||
defmodule MyApp.Repo.Migrations.CreateReply do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:reply) do
|
||||
add :user_id, references(:user)
|
||||
add :thread_id, references(:thread)
|
||||
add :content, :string
|
||||
add :edited, :boolean
|
||||
add :quote, :boolean
|
||||
timestamps()
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user