about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorSurinna Curtis <ekiru.0@gmail.com>2017-11-16 01:21:16 -0600
committerSurinna Curtis <ekiru.0@gmail.com>2017-11-16 01:21:16 -0600
commit35fbdc36f92b610e8a73e2acb220e87cf5fc83b0 (patch)
treefcd9bdb5ba49ab7a6a79590c74db858ae77b4239 /db/migrate
parent30237259367a0ef2b20908518b86bbeb358999b5 (diff)
parent88627fd7aa2493a6890d60a5965459e4c7fe6fe9 (diff)
Merge tootsuite/master at 30237259367a0ef2b20908518b86bbeb358999b5
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20170716191202_add_hide_notifications_to_mute.rb14
-rw-r--r--db/migrate/20170914032032_default_existing_mutes_to_hiding_notifications.rb8
-rw-r--r--db/migrate/20171009222537_create_keyword_mutes.rb12
-rw-r--r--db/migrate/20171021191900_move_keyword_mutes_into_glitch_namespace.rb7
-rw-r--r--db/migrate/20171028221157_add_reblogs_to_follows.rb21
5 files changed, 50 insertions, 12 deletions
diff --git a/db/migrate/20170716191202_add_hide_notifications_to_mute.rb b/db/migrate/20170716191202_add_hide_notifications_to_mute.rb
index 0410938c9..de7d2a4a2 100644
--- a/db/migrate/20170716191202_add_hide_notifications_to_mute.rb
+++ b/db/migrate/20170716191202_add_hide_notifications_to_mute.rb
@@ -1,15 +1,5 @@
-require Rails.root.join('lib', 'mastodon', 'migration_helpers')
-
 class AddHideNotificationsToMute < ActiveRecord::Migration[5.1]
-  include Mastodon::MigrationHelpers
-
-  disable_ddl_transaction!
-
-  def up
-    add_column_with_default :mutes, :hide_notifications, :boolean, default: true, allow_null: false
-  end
-  
-  def down
-    remove_column :mutes, :hide_notifications
+  def change
+    add_column :mutes, :hide_notifications, :boolean, default: false, null: false
   end
 end
diff --git a/db/migrate/20170914032032_default_existing_mutes_to_hiding_notifications.rb b/db/migrate/20170914032032_default_existing_mutes_to_hiding_notifications.rb
new file mode 100644
index 000000000..8e6cac455
--- /dev/null
+++ b/db/migrate/20170914032032_default_existing_mutes_to_hiding_notifications.rb
@@ -0,0 +1,8 @@
+class DefaultExistingMutesToHidingNotifications < ActiveRecord::Migration[5.1]
+  def up
+    change_column_default :mutes, :hide_notifications, from: false, to: true
+
+    # Unfortunately if this is applied sometime after the one to add the table we lose some data, so this is irreversible.
+    Mute.update_all(hide_notifications: true)
+  end
+end
diff --git a/db/migrate/20171009222537_create_keyword_mutes.rb b/db/migrate/20171009222537_create_keyword_mutes.rb
new file mode 100644
index 000000000..ec0c756fb
--- /dev/null
+++ b/db/migrate/20171009222537_create_keyword_mutes.rb
@@ -0,0 +1,12 @@
+class CreateKeywordMutes < ActiveRecord::Migration[5.1]
+  def change
+    create_table :keyword_mutes do |t|
+      t.references :account, null: false
+      t.string :keyword, null: false
+      t.boolean :whole_word, null: false, default: true
+      t.timestamps
+    end
+
+    add_foreign_key :keyword_mutes, :accounts, on_delete: :cascade
+  end
+end
diff --git a/db/migrate/20171021191900_move_keyword_mutes_into_glitch_namespace.rb b/db/migrate/20171021191900_move_keyword_mutes_into_glitch_namespace.rb
new file mode 100644
index 000000000..269bb49d6
--- /dev/null
+++ b/db/migrate/20171021191900_move_keyword_mutes_into_glitch_namespace.rb
@@ -0,0 +1,7 @@
+class MoveKeywordMutesIntoGlitchNamespace < ActiveRecord::Migration[5.1]
+  def change
+    safety_assured do
+      rename_table :keyword_mutes, :glitch_keyword_mutes
+    end
+  end
+end
diff --git a/db/migrate/20171028221157_add_reblogs_to_follows.rb b/db/migrate/20171028221157_add_reblogs_to_follows.rb
new file mode 100644
index 000000000..eb4640a20
--- /dev/null
+++ b/db/migrate/20171028221157_add_reblogs_to_follows.rb
@@ -0,0 +1,21 @@
+require Rails.root.join('lib', 'mastodon', 'migration_helpers')
+
+class AddReblogsToFollows < ActiveRecord::Migration[5.1]
+  include Mastodon::MigrationHelpers
+
+  safety_assured do
+    disable_ddl_transaction!
+  end
+
+  def up
+    safety_assured do
+      add_column_with_default :follows, :show_reblogs, :boolean, default: true, allow_null: false
+      add_column_with_default :follow_requests, :show_reblogs, :boolean, default: true, allow_null: false
+    end
+  end
+  
+  def down
+    remove_column :follows, :show_reblogs
+    remove_column :follow_requests, :show_reblogs
+  end
+end