Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !4282

Merged
Created Jun 12, 2013 by Administrator@rootOwner

Increase snippet content column size.

  • Overview 5
  • Commits 1
  • Changes 1

Created by: dblessing

This fixes issue #3904 (closed)

Before:

mysql> desc snippets;
+------------+--------------+------+-----+---------+----------------+
| Field      | Type         | Null | Key | Default | Extra          |
+------------+--------------+------+-----+---------+----------------+
| id         | int(11)      | NO   | PRI | NULL    | auto_increment |
| title      | varchar(255) | YES  |     | NULL    |                |
| content    | text         | YES  |     | NULL    |                |
| author_id  | int(11)      | NO   |     | NULL    |                |
| project_id | int(11)      | NO   | MUL | NULL    |                |
| created_at | datetime     | NO   | MUL | NULL    |                |
| updated_at | datetime     | NO   |     | NULL    |                |
| file_name  | varchar(255) | YES  |     | NULL    |                |
| expires_at | datetime     | YES  | MUL | NULL    |                |
+------------+--------------+------+-----+---------+----------------+
9 rows in set (0.00 sec)

mysql> SELECT MAX(LENGTH(content)) FROM snippets;
+----------------------+
| MAX(LENGTH(content)) |
+----------------------+
|                65535 |
+----------------------+
1 row in set (0.02 sec)

After:

mysql> desc snippets;
+------------+--------------+------+-----+---------+----------------+
| Field      | Type         | Null | Key | Default | Extra          |
+------------+--------------+------+-----+---------+----------------+
| id         | int(11)      | NO   | PRI | NULL    | auto_increment |
| title      | varchar(255) | YES  |     | NULL    |                |
| content    | longtext     | YES  |     | NULL    |                |
| author_id  | int(11)      | NO   |     | NULL    |                |
| project_id | int(11)      | NO   | MUL | NULL    |                |
| created_at | datetime     | YES  | MUL | NULL    |                |
| updated_at | datetime     | YES  |     | NULL    |                |
| file_name  | varchar(255) | YES  |     | NULL    |                |
| expires_at | datetime     | YES  | MUL | NULL    |                |
+------------+--------------+------+-----+---------+----------------+
9 rows in set (0.00 sec)

mysql> SELECT MAX(LENGTH(content)) FROM snippets;
+----------------------+
| MAX(LENGTH(content)) |
+----------------------+
|               279552 |
+----------------------+
1 row in set (0.00 sec)

You will see that the 'text' type was changed to 'longtext' now after implementing this change and running a db:migrate task. The 'SELECT MAX(LENGTH(content)) FROM snippets;' simply shows that I was able to successfully create a snippet with content length > 65,535 which was the previous limit.

I went with longtext (4294967295) because I didn't see a reason why not. Merge requests also support this limit.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/dblessing/3904