Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20200229171700_create_custom_emojis.rb')
-rw-r--r--db/migrate/20200229171700_create_custom_emojis.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/db/migrate/20200229171700_create_custom_emojis.rb b/db/migrate/20200229171700_create_custom_emojis.rb
new file mode 100644
index 00000000000..1a60d7c8a63
--- /dev/null
+++ b/db/migrate/20200229171700_create_custom_emojis.rb
@@ -0,0 +1,29 @@
+class CreateCustomEmojis < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:custom_emoji)
+ create_table :custom_emoji do |t|
+ t.references :namespace, index: false, null: false, foreign_key: { on_delete: :cascade }
+ t.datetime_with_timezone :created_at, null: false
+ t.datetime_with_timezone :updated_at, null: false
+ t.text :name, null: false
+ t.text :file, null: false
+ end
+ end
+
+ unless index_exists?(:custom_emoji, [:namespace_id, :name], unique: true)
+ add_index :custom_emoji, [:namespace_id, :name], unique: true
+ end
+
+ add_text_limit(:custom_emoji, :name, 36)
+ add_text_limit(:custom_emoji, :file, 255)
+ end
+
+ def down
+ drop_table :custom_emoji
+ end
+end