summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/schema.rb7
-rw-r--r--doc/install/installation.md2
-rw-r--r--lib/tasks/add_limits_mysql.rake14
-rw-r--r--lib/tasks/setup.rake9
4 files changed, 29 insertions, 3 deletions
diff --git a/db/schema.rb b/db/schema.rb
index 1004c3b..d9418af 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -13,19 +13,22 @@
ActiveRecord::Schema.define(version: 20140222210357) do
+ # These are extensions that must be enabled in order to support this database
+ enable_extension "plpgsql"
+
create_table "builds", force: true do |t|
t.integer "project_id"
t.string "ref"
t.string "status"
t.datetime "finished_at"
- t.text "trace", limit: 2147483647
+ t.text "trace"
t.datetime "created_at"
t.datetime "updated_at"
t.string "sha"
t.datetime "started_at"
t.string "tmp_file"
t.string "before_sha"
- t.text "push_data", limit: 16777215
+ t.text "push_data"
t.integer "runner_id"
end
diff --git a/doc/install/installation.md b/doc/install/installation.md
index c127029..43b351b 100644
--- a/doc/install/installation.md
+++ b/doc/install/installation.md
@@ -145,7 +145,7 @@ You can use either MySQL or PostgreSQL.
sudo -u gitlab_ci -H editor config/database.yml
# Setup tables
- sudo -u gitlab_ci -H bundle exec rake db:setup RAILS_ENV=production
+ sudo -u gitlab_ci -H bundle exec rake setup RAILS_ENV=production
# Setup schedules
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