Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6a280c90
Commit
6a280c90
authored
Feb 22, 2022
by
Pedro Pombeiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document how to increase a text limit constraint
parent
0175304d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
doc/development/database/strings_and_the_text_data_type.md
doc/development/database/strings_and_the_text_data_type.md
+20
-0
No files found.
doc/development/database/strings_and_the_text_data_type.md
View file @
6a280c90
...
@@ -253,6 +253,26 @@ class ValidateTextLimitMigration < Gitlab::Database::Migration[1.0]
...
@@ -253,6 +253,26 @@ class ValidateTextLimitMigration < Gitlab::Database::Migration[1.0]
end
end
```
```
## Increasing a text limit constraint on an existing column
Increasing text limits on existing database columns can be safely achieved by first adding the new limit (with a different name),
and then dropping the previous limit:
```
ruby
class
ChangeMaintainerNoteLimitInCiRunner
<
Gitlab
::
Database
::
Migration
[
1.0
]
disable_ddl_transaction!
def
up
add_text_limit
:ci_runners
,
:maintainer_note
,
1024
,
constraint_name:
check_constraint_name
(
:ci_runners
,
:maintainer_note
,
'max_length_1MB'
)
remove_text_limit
:ci_runners
,
:maintainer_note
,
constraint_name:
check_constraint_name
(
:ci_runners
,
:maintainer_note
,
'max_length'
)
end
def
down
# no-op: Danger of failing if there are records with length(maintainer_note) > 255
end
end
```
## Text limit constraints on large tables
## Text limit constraints on large tables
If you have to clean up a text column for a really
[
large table
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/rubocop/rubocop-migrations.yml#L3
)
If you have to clean up a text column for a really
[
large table
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/rubocop/rubocop-migrations.yml#L3
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment