Skip to content

Commit e01c431

Browse files
authored
Merge pull request #27 from epochtalk/message-drafts
feat: create messages.user_drafts table to store message drafts
2 parents 70429e1 + 9773f10 commit e01c431

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
defmodule Epoch.Repo.Migrations.MessageDrafts do
2+
use Ecto.Migration
3+
@schema_prefix "messages"
4+
5+
def up do
6+
create table(:user_drafts, [prefix: @schema_prefix, primary_key: false]) do
7+
add :user_id, references(:users, type: :uuid, on_delete: :delete_all, prefix: "public"), null: false
8+
add :draft, :text
9+
add :updated_at, :timestamp
10+
end
11+
create unique_index(:user_drafts, [:user_id], prefix: @schema_prefix)
12+
end
13+
14+
def down do
15+
drop table(:user_drafts, [prefix: @schema_prefix])
16+
end
17+
end

0 commit comments

Comments
 (0)