summaryrefslogtreecommitdiff
path: root/priv
diff options
context:
space:
mode:
authorlambadalambda <gitgud@rogerbraun.net>2017-09-11 15:16:49 -0400
committerlambadalambda <gitgud@rogerbraun.net>2017-09-11 15:16:49 -0400
commit2b21c05105d550d09d85807246be696a1aed4b32 (patch)
treed389818eff185ca584449f2fb47ad7c1254fa3af /priv
parent95aa6a3c651fed9810889d3446f2a1d710efb55e (diff)
parentf0d41a3abf3e584c90c96644f73d533ea0680237 (diff)
downloadpleroma-2b21c05105d550d09d85807246be696a1aed4b32.tar.gz
pleroma-2b21c05105d550d09d85807246be696a1aed4b32.zip
Merge branch 'oauth2' into 'develop'
Mastodon API See merge request !27
Diffstat (limited to 'priv')
-rw-r--r--priv/repo/migrations/20170906120646_add_mastodon_apps.exs16
-rw-r--r--priv/repo/migrations/20170906143140_create_o_auth_authorizations.exs15
-rw-r--r--priv/repo/migrations/20170906152508_create_o_auth_token.exs15
-rw-r--r--priv/repo/migrations/20170911123607_create_notifications.exs15
4 files changed, 61 insertions, 0 deletions
diff --git a/priv/repo/migrations/20170906120646_add_mastodon_apps.exs b/priv/repo/migrations/20170906120646_add_mastodon_apps.exs
new file mode 100644
index 000000000..d3dd317dd
--- /dev/null
+++ b/priv/repo/migrations/20170906120646_add_mastodon_apps.exs
@@ -0,0 +1,16 @@
+defmodule Pleroma.Repo.Migrations.AddMastodonApps do
+ use Ecto.Migration
+
+ def change do
+ create table(:apps) do
+ add :client_name, :string
+ add :redirect_uris, :string
+ add :scopes, :string
+ add :website, :string
+ add :client_id, :string
+ add :client_secret, :string
+
+ timestamps()
+ end
+ end
+end
diff --git a/priv/repo/migrations/20170906143140_create_o_auth_authorizations.exs b/priv/repo/migrations/20170906143140_create_o_auth_authorizations.exs
new file mode 100644
index 000000000..b4332870e
--- /dev/null
+++ b/priv/repo/migrations/20170906143140_create_o_auth_authorizations.exs
@@ -0,0 +1,15 @@
+defmodule Pleroma.Repo.Migrations.CreateOAuthAuthorizations do
+ use Ecto.Migration
+
+ def change do
+ create table(:oauth_authorizations) do
+ add :app_id, references(:apps)
+ add :user_id, references(:users)
+ add :token, :string
+ add :valid_until, :naive_datetime
+ add :used, :boolean, default: false
+
+ timestamps()
+ end
+ end
+end
diff --git a/priv/repo/migrations/20170906152508_create_o_auth_token.exs b/priv/repo/migrations/20170906152508_create_o_auth_token.exs
new file mode 100644
index 000000000..7f8550f33
--- /dev/null
+++ b/priv/repo/migrations/20170906152508_create_o_auth_token.exs
@@ -0,0 +1,15 @@
+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
+
+ timestamps()
+ end
+ end
+end
diff --git a/priv/repo/migrations/20170911123607_create_notifications.exs b/priv/repo/migrations/20170911123607_create_notifications.exs
new file mode 100644
index 000000000..5be809fb8
--- /dev/null
+++ b/priv/repo/migrations/20170911123607_create_notifications.exs
@@ -0,0 +1,15 @@
+defmodule Pleroma.Repo.Migrations.CreateNotifications do
+ use Ecto.Migration
+
+ def change do
+ create table(:notifications) do
+ add :user_id, references(:users, on_delete: :delete_all)
+ add :activity_id, references(:activities, on_delete: :delete_all)
+ add :seen, :boolean, default: false
+
+ timestamps()
+ end
+
+ create index(:notifications, [:user_id])
+ end
+end