about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20161119211120_create_notifications.rb14
-rw-r--r--db/schema.rb12
2 files changed, 25 insertions, 1 deletions
diff --git a/db/migrate/20161119211120_create_notifications.rb b/db/migrate/20161119211120_create_notifications.rb
new file mode 100644
index 000000000..e6bf1d66e
--- /dev/null
+++ b/db/migrate/20161119211120_create_notifications.rb
@@ -0,0 +1,14 @@
+class CreateNotifications < ActiveRecord::Migration[5.0]
+  def change
+    create_table :notifications do |t|
+      t.integer :account_id
+      t.integer :activity_id
+      t.string :activity_type
+
+      t.timestamps
+    end
+
+    add_index :notifications, :account_id
+    add_index :notifications, [:account_id, :activity_id, :activity_type], unique: true, name: 'account_activity'
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 84f75c278..20bfb36a8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 20161116162355) do
+ActiveRecord::Schema.define(version: 20161119211120) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -96,6 +96,16 @@ ActiveRecord::Schema.define(version: 20161116162355) do
     t.index ["account_id", "status_id"], name: "index_mentions_on_account_id_and_status_id", unique: true, using: :btree
   end
 
+  create_table "notifications", force: :cascade do |t|
+    t.integer  "account_id"
+    t.integer  "activity_id"
+    t.string   "activity_type"
+    t.datetime "created_at",    null: false
+    t.datetime "updated_at",    null: false
+    t.index ["account_id", "activity_id", "activity_type"], name: "account_activity", unique: true, using: :btree
+    t.index ["account_id"], name: "index_notifications_on_account_id", using: :btree
+  end
+
   create_table "oauth_access_grants", force: :cascade do |t|
     t.integer  "resource_owner_id", null: false
     t.integer  "application_id",    null: false