Merge branch 'release/2.3.0' into 'stable'
[akkoma] / priv / repo / migrations / 20170906152508_create_o_auth_token.exs
index 7f8550f336e25a68f15f28d8d1296fc93cbd3d0e..bfad98b764e3b25a1daa33b94f183368e11a6858 100644 (file)
@@ -2,12 +2,12 @@ defmodule Pleroma.Repo.Migrations.CreateOAuthToken do
   use Ecto.Migration
 
   def change do
-    create table(:oauth_tokens) do
-      add :app_id, references(:apps)
-      add :user_id, references(:users)
-      add :token, :string
-      add :refresh_token, :string
-      add :valid_until, :naive_datetime
+    create_if_not_exists table(:oauth_tokens) do
+      add(:app_id, references(:apps))
+      add(:user_id, references(:users))
+      add(:token, :string)
+      add(:refresh_token, :string)
+      add(:valid_until, :naive_datetime_usec)
 
       timestamps()
     end