fix failing migration on mysql

We didn't specify that the db user needs the right to create
temporary tables before.
That's why the migration will fail on most installations.
This commits removes the "TEMPORARY" from the migration
and changes the documentation to include the necessary rights for the future.
This commit is contained in:
Hannes Rosenögger 2015-09-18 19:49:04 +02:00
parent b2c06bf707
commit a22b6c591f
2 changed files with 2 additions and 2 deletions

View file

@ -1,7 +1,7 @@
class DeduplicateUserIdentities < ActiveRecord::Migration class DeduplicateUserIdentities < ActiveRecord::Migration
def change def change
execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;' execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;'
execute 'CREATE TEMPORARY TABLE tt_migration_DeduplicateUserIdentities AS SELECT id,provider,user_id FROM identities;' execute 'CREATE TABLE tt_migration_DeduplicateUserIdentities AS SELECT id,provider,user_id FROM identities;'
execute 'DELETE FROM identities WHERE id NOT IN ( SELECT MIN(id) FROM tt_migration_DeduplicateUserIdentities GROUP BY user_id, provider);' execute 'DELETE FROM identities WHERE id NOT IN ( SELECT MIN(id) FROM tt_migration_DeduplicateUserIdentities GROUP BY user_id, provider);'
execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;' execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;'
end end

View file

@ -36,7 +36,7 @@ We do not recommend using MySQL due to various issues. For example, case [(in)se
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
# Grant the GitLab user necessary permissions on the database # Grant the GitLab user necessary permissions on the database
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON `gitlabhq_production`.* TO 'git'@'localhost'; mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, CREATE TEMPORARY TABLES, DROP, INDEX, ALTER, LOCK TABLES ON `gitlabhq_production`.* TO 'git'@'localhost';
# Quit the database session # Quit the database session
mysql> \q mysql> \q