Added migrations, each creating a new database table
This commit is contained in:
22
priv/repo/migrations/20250724223301_create_users.exs
Normal file
22
priv/repo/migrations/20250724223301_create_users.exs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
defmodule Sukaato.Repo.Migrations.CreateUsers do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
create table(:users) do
|
||||||
|
add :name, :string
|
||||||
|
add :username, :string
|
||||||
|
add :password, :string
|
||||||
|
add :email, :string
|
||||||
|
add :dob, :date
|
||||||
|
add :gender_type, :string
|
||||||
|
add :gender_id, :string
|
||||||
|
add :bio, :text
|
||||||
|
add :affil, {:array, :map}
|
||||||
|
add :perms, {:array, :integer}
|
||||||
|
add :user_token, :string
|
||||||
|
add :pub_keys, :map
|
||||||
|
|
||||||
|
timestamps(type: :utc_datetime)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
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
|
16
priv/repo/migrations/20250724233039_create_folios.exs
Normal file
16
priv/repo/migrations/20250724233039_create_folios.exs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
defmodule Sukaato.Repo.Migrations.CreateFolios do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
create table(:folios) do
|
||||||
|
add :resume, :map
|
||||||
|
add :showcase, :map
|
||||||
|
add :theme_uri, :string
|
||||||
|
add :user_id, references(:users, on_delete: :nothing)
|
||||||
|
|
||||||
|
timestamps(type: :utc_datetime)
|
||||||
|
end
|
||||||
|
|
||||||
|
create index(:folios, [:user_id])
|
||||||
|
end
|
||||||
|
end
|
20
priv/repo/migrations/20250725144032_create_comments.exs
Normal file
20
priv/repo/migrations/20250725144032_create_comments.exs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
defmodule Sukaato.Repo.Migrations.CreateComments do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
create table(:comments) do
|
||||||
|
add :slug, :string
|
||||||
|
add :tripcode, :string
|
||||||
|
add :content, :text
|
||||||
|
add :ledit, :utc_datetime
|
||||||
|
add :post_id, references(:posts, on_delete: :nothing)
|
||||||
|
add :reply_to, references(:comments, on_delete: :nothing)
|
||||||
|
|
||||||
|
timestamps(type: :utc_datetime)
|
||||||
|
end
|
||||||
|
|
||||||
|
create unique_index(:comments, [:tripcode])
|
||||||
|
create index(:comments, [:post_id])
|
||||||
|
create index(:comments, [:reply_to])
|
||||||
|
end
|
||||||
|
end
|
Reference in New Issue
Block a user