about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorEugen <eugen@zeonfederated.com>2017-03-15 22:55:22 +0100
committerGitHub <noreply@github.com>2017-03-15 22:55:22 +0100
commite245115f47082ffba27205f508301d14e792c369 (patch)
tree21a77b788dace45b734da6e64f1b0705016192f0 /db/migrate
parent620f70e42c16c324459ca2da52c68f1def8683de (diff)
parentc1124228e857b0e85f5bf927d2c41c7fadfdf955 (diff)
Merge branch 'master' into mastodon-site-api
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20170301222600_create_mutes.rb12
-rw-r--r--db/migrate/20170303212857_add_last_emailed_at_to_users.rb5
-rw-r--r--db/migrate/20170304202101_add_type_to_media_attachments.rb12
3 files changed, 29 insertions, 0 deletions
diff --git a/db/migrate/20170301222600_create_mutes.rb b/db/migrate/20170301222600_create_mutes.rb
new file mode 100644
index 000000000..8f1bb22f5
--- /dev/null
+++ b/db/migrate/20170301222600_create_mutes.rb
@@ -0,0 +1,12 @@
+class CreateMutes < ActiveRecord::Migration[5.0]
+  def change
+    create_table :mutes do |t|
+      t.integer :account_id, null: false
+      t.integer :target_account_id, null: false
+      t.timestamps null: false
+    end
+
+    add_index :mutes, [:account_id, :target_account_id], unique: true
+
+  end
+end
diff --git a/db/migrate/20170303212857_add_last_emailed_at_to_users.rb b/db/migrate/20170303212857_add_last_emailed_at_to_users.rb
new file mode 100644
index 000000000..9ae3da4fb
--- /dev/null
+++ b/db/migrate/20170303212857_add_last_emailed_at_to_users.rb
@@ -0,0 +1,5 @@
+class AddLastEmailedAtToUsers < ActiveRecord::Migration[5.0]
+  def change
+    add_column :users, :last_emailed_at, :datetime, null: true, default: nil
+  end
+end
diff --git a/db/migrate/20170304202101_add_type_to_media_attachments.rb b/db/migrate/20170304202101_add_type_to_media_attachments.rb
new file mode 100644
index 000000000..514079958
--- /dev/null
+++ b/db/migrate/20170304202101_add_type_to_media_attachments.rb
@@ -0,0 +1,12 @@
+class AddTypeToMediaAttachments < ActiveRecord::Migration[5.0]
+  def up
+    add_column :media_attachments, :type, :integer, default: 0, null: false
+
+    MediaAttachment.where(file_content_type: MediaAttachment::IMAGE_MIME_TYPES).update_all(type: MediaAttachment.types[:image])
+    MediaAttachment.where(file_content_type: MediaAttachment::VIDEO_MIME_TYPES).update_all(type: MediaAttachment.types[:video])
+  end
+
+  def down
+    remove_column :media_attachments, :type
+  end
+end