Commit e8466a21ca880b0ecc2682177d07234f6f3725f6
Exists in
spb-stable
and in
3 other branches
Merge branch 'case_sensitivity' into 'master'
Case Sensitivity for MYSQL #1014
Showing
5 changed files
with
66 additions
and
74 deletions
Show diff stats
app/models/namespace.rb
| ... | ... | @@ -27,7 +27,7 @@ class Namespace < ActiveRecord::Base |
| 27 | 27 | format: { with: Gitlab::Regex.name_regex, |
| 28 | 28 | message: "only letters, digits, spaces & '_' '-' '.' allowed." } |
| 29 | 29 | validates :description, length: { within: 0..255 } |
| 30 | - validates :path, uniqueness: true, presence: true, length: { within: 1..255 }, | |
| 30 | + validates :path, uniqueness: { case_sensitive: false }, presence: true, length: { within: 1..255 }, | |
| 31 | 31 | exclusion: { in: Gitlab::Blacklist.path }, |
| 32 | 32 | format: { with: Gitlab::Regex.path_regex, |
| 33 | 33 | message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } | ... | ... |
app/models/user.rb
| ... | ... | @@ -109,7 +109,7 @@ class User < ActiveRecord::Base |
| 109 | 109 | validates :bio, length: { maximum: 255 }, allow_blank: true |
| 110 | 110 | validates :extern_uid, allow_blank: true, uniqueness: {scope: :provider} |
| 111 | 111 | validates :projects_limit, presence: true, numericality: {greater_than_or_equal_to: 0} |
| 112 | - validates :username, presence: true, uniqueness: true, | |
| 112 | + validates :username, presence: true, uniqueness: { case_sensitive: false }, | |
| 113 | 113 | exclusion: { in: Gitlab::Blacklist.path }, |
| 114 | 114 | format: { with: Gitlab::Regex.username_regex, |
| 115 | 115 | message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } | ... | ... |
| ... | ... | @@ -0,0 +1,45 @@ |
| 1 | +## Note | |
| 2 | + | |
| 3 | +We do not recommend using MySQL due to various issues. For example, case [(in)sensitivity](https://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html) and [problems](http://bugs.mysql.com/bug.php?id=65830) that [suggested](http://bugs.mysql.com/bug.php?id=50909) [fixes](http://bugs.mysql.com/bug.php?id=65830) [have](http://bugs.mysql.com/bug.php?id=63164). | |
| 4 | + | |
| 5 | +## MySQL | |
| 6 | + | |
| 7 | + # Install the database packages | |
| 8 | + sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev | |
| 9 | + | |
| 10 | + # Pick a database root password (can be anything), type it and press enter | |
| 11 | + # Retype the database root password and press enter | |
| 12 | + | |
| 13 | + # Secure your installation. | |
| 14 | + sudo mysql_secure_installation | |
| 15 | + | |
| 16 | + # Login to MySQL | |
| 17 | + mysql -u root -p | |
| 18 | + | |
| 19 | + # Type the database root password | |
| 20 | + | |
| 21 | + # Create a user for GitLab | |
| 22 | + # do not type the 'mysql>', this is part of the prompt | |
| 23 | + # change $password in the command below to a real password you pick | |
| 24 | + mysql> CREATE USER 'git'@'localhost' IDENTIFIED BY '$password'; | |
| 25 | + | |
| 26 | + # Create the GitLab production database | |
| 27 | + mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; | |
| 28 | + | |
| 29 | + # Grant the GitLab user necessary permissions on the table. | |
| 30 | + mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'git'@'localhost'; | |
| 31 | + | |
| 32 | + # Quit the database session | |
| 33 | + mysql> \q | |
| 34 | + | |
| 35 | + # Try connecting to the new database with the new user | |
| 36 | + sudo -u git -H mysql -u git -p -D gitlabhq_production | |
| 37 | + | |
| 38 | + # Type the password you replaced $password with earlier | |
| 39 | + | |
| 40 | + # You should now see a 'mysql>' prompt | |
| 41 | + | |
| 42 | + # Quit the database session | |
| 43 | + mysql> \q | |
| 44 | + | |
| 45 | + # You are done installing the database and can go back to the rest of the installation. | ... | ... |
doc/install/databases.md
| ... | ... | @@ -1,71 +0,0 @@ |
| 1 | -# Setup Database | |
| 2 | - | |
| 3 | -GitLab supports the following databases: | |
| 4 | - | |
| 5 | -* MySQL (preferred) | |
| 6 | -* PostgreSQL | |
| 7 | - | |
| 8 | - | |
| 9 | -## MySQL | |
| 10 | - | |
| 11 | - # Install the database packages | |
| 12 | - sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev | |
| 13 | - | |
| 14 | - # Pick a database root password (can be anything), type it and press enter | |
| 15 | - # Retype the database root password and press enter | |
| 16 | - | |
| 17 | - # Secure your installation. | |
| 18 | - sudo mysql_secure_installation | |
| 19 | - | |
| 20 | - # Login to MySQL | |
| 21 | - mysql -u root -p | |
| 22 | - | |
| 23 | - # Type the database root password | |
| 24 | - | |
| 25 | - # Create a user for GitLab | |
| 26 | - # do not type the 'mysql>', this is part of the prompt | |
| 27 | - # change $password in the command below to a real password you pick | |
| 28 | - mysql> CREATE USER 'git'@'localhost' IDENTIFIED BY '$password'; | |
| 29 | - | |
| 30 | - # Create the GitLab production database | |
| 31 | - mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; | |
| 32 | - | |
| 33 | - # Grant the GitLab user necessary permissions on the table. | |
| 34 | - mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'git'@'localhost'; | |
| 35 | - | |
| 36 | - # Quit the database session | |
| 37 | - mysql> \q | |
| 38 | - | |
| 39 | - # Try connecting to the new database with the new user | |
| 40 | - sudo -u git -H mysql -u git -p -D gitlabhq_production | |
| 41 | - | |
| 42 | - # Type the password you replaced $password with earlier | |
| 43 | - | |
| 44 | - # You should now see a 'mysql>' prompt | |
| 45 | - | |
| 46 | - # Quit the database session | |
| 47 | - mysql> \q | |
| 48 | - | |
| 49 | - # You are done installing the database and can go back to the rest of the installation. | |
| 50 | - | |
| 51 | - | |
| 52 | -## PostgreSQL | |
| 53 | - | |
| 54 | - # Install the database packages | |
| 55 | - sudo apt-get install -y postgresql-9.1 postgresql-client libpq-dev | |
| 56 | - | |
| 57 | - # Login to PostgreSQL | |
| 58 | - sudo -u postgres psql -d template1 | |
| 59 | - | |
| 60 | - # Create a user for GitLab. | |
| 61 | - template1=# CREATE USER git; | |
| 62 | - | |
| 63 | - # Create the GitLab production database & grant all privileges on database | |
| 64 | - template1=# CREATE DATABASE gitlabhq_production OWNER git; | |
| 65 | - | |
| 66 | - # Quit the database session | |
| 67 | - template1=# \q | |
| 68 | - | |
| 69 | - # Try connecting to the new database with the new user | |
| 70 | - sudo -u git -H psql -d gitlabhq_production | |
| 71 | - |
doc/install/installation.md
| ... | ... | @@ -144,7 +144,25 @@ GitLab Shell is an ssh access and repository management software developed speci |
| 144 | 144 | |
| 145 | 145 | # 5. Database |
| 146 | 146 | |
| 147 | -To setup the MySQL/PostgreSQL database and dependencies please see [doc/install/databases.md](./databases.md). | |
| 147 | +We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](doc/install/database_mysql.md). | |
| 148 | + | |
| 149 | + # Install the database packages | |
| 150 | + sudo apt-get install -y postgresql-9.1 postgresql-client libpq-dev | |
| 151 | + | |
| 152 | + # Login to PostgreSQL | |
| 153 | + sudo -u postgres psql -d template1 | |
| 154 | + | |
| 155 | + # Create a user for GitLab. | |
| 156 | + template1=# CREATE USER git; | |
| 157 | + | |
| 158 | + # Create the GitLab production database & grant all privileges on database | |
| 159 | + template1=# CREATE DATABASE gitlabhq_production OWNER git; | |
| 160 | + | |
| 161 | + # Quit the database session | |
| 162 | + template1=# \q | |
| 163 | + | |
| 164 | + # Try connecting to the new database with the new user | |
| 165 | + sudo -u git -H psql -d gitlabhq_production | |
| 148 | 166 | |
| 149 | 167 | |
| 150 | 168 | # 6. GitLab | ... | ... |