]> git.openstreetmap.org Git - rails.git/blobdiff - db/migrate/20210511104518_add_time_to_friendships.rb
Add rate limiting to user friendships
[rails.git] / db / migrate / 20210511104518_add_time_to_friendships.rb
diff --git a/db/migrate/20210511104518_add_time_to_friendships.rb b/db/migrate/20210511104518_add_time_to_friendships.rb
new file mode 100644 (file)
index 0000000..4f426a6
--- /dev/null
@@ -0,0 +1,9 @@
+class AddTimeToFriendships < ActiveRecord::Migration[6.0]
+  disable_ddl_transaction!
+
+  def change
+    add_column :friends, :created_at, :datetime
+    add_index :friends, [:user_id, :created_at], :algorithm => :concurrently
+    remove_index :friends, :column => :user_id, :name => "friends_user_id_idx"
+  end
+end