summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-05 20:58:08 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-05 20:58:08 +0300
commitd0f59cd5b3376c6c5a1e449cac26f0d795c3b717 (patch)
tree4f5c6da894b56e4104d43889e3afcea6f15b68f8 /lib
parent9bcf03cde0e93d14fd0660ba871655219a7e1bef (diff)
downloadgitlab-ci-d0f59cd5b3376c6c5a1e449cac26f0d795c3b717.tar.gz
Add mysql limits to separate rake task
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/add_limits_mysql.rake14
-rw-r--r--lib/tasks/setup.rake9
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/tasks/add_limits_mysql.rake b/lib/tasks/add_limits_mysql.rake
new file mode 100644
index 0000000..0025702
--- /dev/null
+++ b/lib/tasks/add_limits_mysql.rake
@@ -0,0 +1,14 @@
+desc "GitLab | Add limits to strings in mysql database"
+task add_limits_mysql: :environment do
+ puts "Adding limits to schema.rb for mysql"
+ LimitsToMysql.new.up
+end
+
+class LimitsToMysql < ActiveRecord::Migration
+ def up
+ return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] =~ /^mysql/
+
+ change_column :builds, :trace, :text, limit: 2147483647
+ change_column :builds, :push_data, :text, limit: 2147483647
+ end
+end
diff --git a/lib/tasks/setup.rake b/lib/tasks/setup.rake
new file mode 100644
index 0000000..2d0882b
--- /dev/null
+++ b/lib/tasks/setup.rake
@@ -0,0 +1,9 @@
+desc "GitLab | Setup gitlab db"
+task :setup do
+ setup_db
+end
+
+def setup_db
+ Rake::Task["db:setup"].invoke
+ Rake::Task["add_limits_mysql"].invoke
+end