summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-11-25 17:10:25 +0100
committerRémy Coutable <remy@rymai.me>2017-04-14 15:20:55 +0200
commit3cb84e06b7a118fb46b4e1e0d4885026c9d4a4d1 (patch)
treeef622687724fd429f6f7fb02a19a022550bf8608 /db
parent2951a8543ef97ceb1bcaca5f5140d822729c950b (diff)
downloadgitlab-ce-3cb84e06b7a118fb46b4e1e0d4885026c9d4a4d1.tar.gz
Remove user activities table and use redis instead of PG for recording activities
Refactored specs and added a post deployment migration to remove the activity users table.
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20161128170531_drop_user_activities_table.rb23
-rw-r--r--db/schema.rb8
2 files changed, 23 insertions, 8 deletions
diff --git a/db/post_migrate/20161128170531_drop_user_activities_table.rb b/db/post_migrate/20161128170531_drop_user_activities_table.rb
new file mode 100644
index 00000000000..3ece0722821
--- /dev/null
+++ b/db/post_migrate/20161128170531_drop_user_activities_table.rb
@@ -0,0 +1,23 @@
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class DropUserActivitiesTable < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ # When using the methods "add_concurrent_index" or "add_column_with_default"
+ # you must disable the use of transactions as these methods can not run in an
+ # existing transaction. When using "add_concurrent_index" make sure that this
+ # method is the _only_ method called in the migration, any other changes
+ # should go in a separate migration. This ensures that upon failure _only_ the
+ # index creation fails and can be retried or reverted easily.
+ #
+ # To disable transactions uncomment the following line and remove these
+ # comments:
+ # disable_ddl_transaction!
+
+ def change
+ drop_table :user_activities
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 3ed28a02de2..1c592dd5d6d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1230,13 +1230,6 @@ ActiveRecord::Schema.define(version: 20170408033905) do
add_index "uploads", ["model_id", "model_type"], name: "index_uploads_on_model_id_and_model_type", using: :btree
add_index "uploads", ["path"], name: "index_uploads_on_path", using: :btree
- create_table "user_activities", force: :cascade do |t|
- t.integer "user_id"
- t.datetime "last_activity_at", null: false
- end
-
- add_index "user_activities", ["user_id"], name: "index_user_activities_on_user_id", unique: true, using: :btree
-
create_table "user_agent_details", force: :cascade do |t|
t.string "user_agent", null: false
t.string "ip_address", null: false
@@ -1396,5 +1389,4 @@ ActiveRecord::Schema.define(version: 20170408033905) do
add_foreign_key "timelogs", "merge_requests", name: "fk_timelogs_merge_requests_merge_request_id", on_delete: :cascade
add_foreign_key "trending_projects", "projects", on_delete: :cascade
add_foreign_key "u2f_registrations", "users"
- add_foreign_key "user_activities", "users", on_delete: :cascade
end