summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-06-07 10:26:27 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-06-07 10:26:27 +0200
commit6e64d1ac7631675008832111f3759c007bda4504 (patch)
treea2918d570353f35b3794592fb970be4a6d06ad70 /db
parentdbf235f514cc919a10fee1d9ab8dc1c75bc25238 (diff)
parent9e256de4ac33e284ceb88c6af410f87c5f51228d (diff)
downloadgitlab-ce-6e64d1ac7631675008832111f3759c007bda4504.tar.gz
Merge remote-tracking branch 'origin/master' into rename-ci-commit-phase-2
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/production/001_admin.rb12
-rw-r--r--db/migrate/20160603180330_remove_duplicated_notification_settings.rb7
-rw-r--r--db/migrate/20160603182247_add_index_to_notification_settings.rb9
3 files changed, 22 insertions, 6 deletions
diff --git a/db/fixtures/production/001_admin.rb b/db/fixtures/production/001_admin.rb
index 78746c83225..b37dc794015 100644
--- a/db/fixtures/production/001_admin.rb
+++ b/db/fixtures/production/001_admin.rb
@@ -16,21 +16,21 @@ user = User.new(user_args)
user.skip_confirmation!
if user.save
- puts "Administrator account created:".green
+ puts "Administrator account created:".color(:green)
puts
- puts "login: root".green
+ puts "login: root".color(:green)
if user_args.key?(:password)
- puts "password: #{user_args[:password]}".green
+ puts "password: #{user_args[:password]}".color(:green)
else
- puts "password: You'll be prompted to create one on your first visit.".green
+ puts "password: You'll be prompted to create one on your first visit.".color(:green)
end
puts
else
- puts "Could not create the default administrator account:".red
+ puts "Could not create the default administrator account:".color(:red)
puts
user.errors.full_messages.map do |message|
- puts "--> #{message}".red
+ puts "--> #{message}".color(:red)
end
puts
diff --git a/db/migrate/20160603180330_remove_duplicated_notification_settings.rb b/db/migrate/20160603180330_remove_duplicated_notification_settings.rb
new file mode 100644
index 00000000000..c2fcac4c53d
--- /dev/null
+++ b/db/migrate/20160603180330_remove_duplicated_notification_settings.rb
@@ -0,0 +1,7 @@
+class RemoveDuplicatedNotificationSettings < ActiveRecord::Migration
+ def up
+ execute <<-SQL
+ DELETE FROM notification_settings WHERE id NOT IN ( SELECT min_id from (SELECT MIN(id) as min_id FROM notification_settings GROUP BY user_id, source_type, source_id) as dups )
+ SQL
+ end
+end
diff --git a/db/migrate/20160603182247_add_index_to_notification_settings.rb b/db/migrate/20160603182247_add_index_to_notification_settings.rb
new file mode 100644
index 00000000000..06462042b09
--- /dev/null
+++ b/db/migrate/20160603182247_add_index_to_notification_settings.rb
@@ -0,0 +1,9 @@
+class AddIndexToNotificationSettings < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def change
+ add_concurrent_index :notification_settings, [:user_id, :source_id, :source_type], { unique: true, name: "index_notifications_on_user_id_and_source_id_and_source_type" }
+ end
+end