about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20170105224407_add_shortcode_to_media_attachments.rb14
-rw-r--r--db/migrate/20170109120109_create_web_settings.rb12
-rw-r--r--db/migrate/20170112154826_migrate_settings.rb19
-rw-r--r--db/migrate/20170114194937_add_application_to_statuses.rb5
-rw-r--r--db/migrate/20170114203041_add_website_to_oauth_application.rb5
-rw-r--r--db/migrate/20170119214911_create_preview_cards.rb17
-rw-r--r--db/migrate/20170123162658_add_severity_to_domain_blocks.rb5
-rw-r--r--db/migrate/20170123203248_add_reject_media_to_domain_blocks.rb5
-rw-r--r--db/migrate/20170125145934_add_spoiler_text_to_statuses.rb5
9 files changed, 87 insertions, 0 deletions
diff --git a/db/migrate/20170105224407_add_shortcode_to_media_attachments.rb b/db/migrate/20170105224407_add_shortcode_to_media_attachments.rb
new file mode 100644
index 000000000..2685ae150
--- /dev/null
+++ b/db/migrate/20170105224407_add_shortcode_to_media_attachments.rb
@@ -0,0 +1,14 @@
+class AddShortcodeToMediaAttachments < ActiveRecord::Migration[5.0]
+  def up
+    add_column :media_attachments, :shortcode, :string, null: true, default: nil
+    add_index :media_attachments, :shortcode, unique: true
+
+    # Migrate old links
+    MediaAttachment.local.update_all('shortcode = id')
+  end
+
+  def down
+  	remove_index :media_attachments, :shortcode
+  	remove_column :media_attachments, :shortcode
+  end
+end
diff --git a/db/migrate/20170109120109_create_web_settings.rb b/db/migrate/20170109120109_create_web_settings.rb
new file mode 100644
index 000000000..2aeae1f91
--- /dev/null
+++ b/db/migrate/20170109120109_create_web_settings.rb
@@ -0,0 +1,12 @@
+class CreateWebSettings < ActiveRecord::Migration[5.0]
+  def change
+    create_table :web_settings do |t|
+      t.integer :user_id
+      t.json :data
+
+      t.timestamps
+    end
+
+    add_index :web_settings, :user_id, unique: true
+  end
+end
diff --git a/db/migrate/20170112154826_migrate_settings.rb b/db/migrate/20170112154826_migrate_settings.rb
new file mode 100644
index 000000000..f6f6ed531
--- /dev/null
+++ b/db/migrate/20170112154826_migrate_settings.rb
@@ -0,0 +1,19 @@
+class MigrateSettings < ActiveRecord::Migration
+  def up
+    remove_index :settings, [:target_type, :target_id, :var]
+    rename_column :settings, :target_id, :thing_id
+    rename_column :settings, :target_type, :thing_type
+    change_column :settings, :thing_id, :integer, null: true, default: nil
+    change_column :settings, :thing_type, :string, null: true, default: nil
+    add_index :settings, [:thing_type, :thing_id, :var], unique: true
+  end
+
+  def down
+    remove_index :settings, [:thing_type, :thing_id, :var]
+    rename_column :settings, :thing_id, :target_id
+    rename_column :settings, :thing_type, :target_type
+    change_column :settings, :target_id, :integer, null: false
+    change_column :settings, :target_type, :string, null: false, default: ''
+    add_index :settings, [:target_type, :target_id, :var], unique: true
+  end
+end
diff --git a/db/migrate/20170114194937_add_application_to_statuses.rb b/db/migrate/20170114194937_add_application_to_statuses.rb
new file mode 100644
index 000000000..b699db2ac
--- /dev/null
+++ b/db/migrate/20170114194937_add_application_to_statuses.rb
@@ -0,0 +1,5 @@
+class AddApplicationToStatuses < ActiveRecord::Migration[5.0]
+  def change
+    add_column :statuses, :application_id, :int
+  end
+end
diff --git a/db/migrate/20170114203041_add_website_to_oauth_application.rb b/db/migrate/20170114203041_add_website_to_oauth_application.rb
new file mode 100644
index 000000000..ee674be72
--- /dev/null
+++ b/db/migrate/20170114203041_add_website_to_oauth_application.rb
@@ -0,0 +1,5 @@
+class AddWebsiteToOauthApplication < ActiveRecord::Migration[5.0]
+  def change
+    add_column :oauth_applications, :website, :string
+  end
+end
diff --git a/db/migrate/20170119214911_create_preview_cards.rb b/db/migrate/20170119214911_create_preview_cards.rb
new file mode 100644
index 000000000..70ed91bbd
--- /dev/null
+++ b/db/migrate/20170119214911_create_preview_cards.rb
@@ -0,0 +1,17 @@
+class CreatePreviewCards < ActiveRecord::Migration[5.0]
+  def change
+    create_table :preview_cards do |t|
+      t.integer :status_id
+      t.string :url, null: false, default: ''
+
+      # OpenGraph
+      t.string :title, null: true
+      t.string :description, null: true
+      t.attachment :image
+
+      t.timestamps
+    end
+
+    add_index :preview_cards, :status_id, unique: true
+  end
+end
diff --git a/db/migrate/20170123162658_add_severity_to_domain_blocks.rb b/db/migrate/20170123162658_add_severity_to_domain_blocks.rb
new file mode 100644
index 000000000..dcbc32a1a
--- /dev/null
+++ b/db/migrate/20170123162658_add_severity_to_domain_blocks.rb
@@ -0,0 +1,5 @@
+class AddSeverityToDomainBlocks < ActiveRecord::Migration[5.0]
+  def change
+    add_column :domain_blocks, :severity, :integer, default: 0
+  end
+end
diff --git a/db/migrate/20170123203248_add_reject_media_to_domain_blocks.rb b/db/migrate/20170123203248_add_reject_media_to_domain_blocks.rb
new file mode 100644
index 000000000..999fccda0
--- /dev/null
+++ b/db/migrate/20170123203248_add_reject_media_to_domain_blocks.rb
@@ -0,0 +1,5 @@
+class AddRejectMediaToDomainBlocks < ActiveRecord::Migration[5.0]
+  def change
+    add_column :domain_blocks, :reject_media, :boolean
+  end
+end
diff --git a/db/migrate/20170125145934_add_spoiler_text_to_statuses.rb b/db/migrate/20170125145934_add_spoiler_text_to_statuses.rb
new file mode 100644
index 000000000..2c43210ba
--- /dev/null
+++ b/db/migrate/20170125145934_add_spoiler_text_to_statuses.rb
@@ -0,0 +1,5 @@
+class AddSpoilerTextToStatuses < ActiveRecord::Migration[5.0]
+  def change
+    add_column :statuses, :spoiler_text, :text, default: "", null: false
+  end
+end