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
3c25eb26
Commit
3c25eb26
authored
Jan 19, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate repository size limits from MB to Bytes
parent
930b098c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
136 additions
and
4 deletions
+136
-4
db/migrate/20170118194941_convert_application_settings_repository_size_limit_to_bytes.rb
...rt_application_settings_repository_size_limit_to_bytes.rb
+42
-0
db/migrate/20170118200338_convert_projects_repository_size_limit_to_bytes.rb
...200338_convert_projects_repository_size_limit_to_bytes.rb
+45
-0
db/migrate/20170118200412_convert_namespaces_repository_size_limit_to_bytes.rb
...0412_convert_namespaces_repository_size_limit_to_bytes.rb
+45
-0
db/schema.rb
db/schema.rb
+4
-4
No files found.
db/migrate/20170118194941_convert_application_settings_repository_size_limit_to_bytes.rb
0 → 100644
View file @
3c25eb26
class
ConvertApplicationSettingsRepositorySizeLimitToBytes
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
connection
.
transaction
do
rename_column
:application_settings
,
:repository_size_limit
,
:repository_size_limit_mb
add_column
:application_settings
,
:repository_size_limit
,
:integer
,
default:
0
,
limit:
8
end
bigint_expression
=
if
Gitlab
::
Database
.
postgresql?
'repository_size_limit_mb::bigint * 1024 * 1024'
else
'repository_size_limit_mb * 1024 * 1024'
end
connection
.
transaction
do
update_column_in_batches
(
:application_settings
,
:repository_size_limit
,
Arel
::
Nodes
::
SqlLiteral
.
new
(
bigint_expression
))
do
|
t
,
query
|
query
.
where
(
t
[
:repository_size_limit_mb
].
not_eq
(
nil
))
end
remove_column
:application_settings
,
:repository_size_limit_mb
end
end
def
down
connection
.
transaction
do
rename_column
:application_settings
,
:repository_size_limit
,
:repository_size_limit_bytes
add_column
:application_settings
,
:repository_size_limit
,
:integer
,
default:
0
,
limit:
nil
end
connection
.
transaction
do
update_column_in_batches
(
:application_settings
,
:repository_size_limit
,
Arel
::
Nodes
::
SqlLiteral
.
new
(
'repository_size_limit_bytes / 1024 / 1024'
))
do
|
t
,
query
|
query
.
where
(
t
[
:repository_size_limit_bytes
].
not_eq
(
nil
))
end
remove_column
:application_settings
,
:repository_size_limit_bytes
end
end
end
db/migrate/20170118200338_convert_projects_repository_size_limit_to_bytes.rb
0 → 100644
View file @
3c25eb26
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
ConvertProjectsRepositorySizeLimitToBytes
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
connection
.
transaction
do
rename_column
:projects
,
:repository_size_limit
,
:repository_size_limit_mb
add_column
:projects
,
:repository_size_limit
,
:integer
,
limit:
8
end
bigint_expression
=
if
Gitlab
::
Database
.
postgresql?
'repository_size_limit_mb::bigint * 1024 * 1024'
else
'repository_size_limit_mb * 1024 * 1024'
end
connection
.
transaction
do
update_column_in_batches
(
:projects
,
:repository_size_limit
,
Arel
::
Nodes
::
SqlLiteral
.
new
(
bigint_expression
))
do
|
t
,
query
|
query
.
where
(
t
[
:repository_size_limit_mb
].
not_eq
(
nil
))
end
remove_column
:projects
,
:repository_size_limit_mb
end
end
def
down
connection
.
transaction
do
rename_column
:projects
,
:repository_size_limit
,
:repository_size_limit_bytes
add_column
:projects
,
:repository_size_limit
,
:integer
,
limit:
nil
end
connection
.
transaction
do
update_column_in_batches
(
:projects
,
:repository_size_limit
,
Arel
::
Nodes
::
SqlLiteral
.
new
(
'repository_size_limit_bytes / 1024 / 1024'
))
do
|
t
,
query
|
query
.
where
(
t
[
:repository_size_limit_bytes
].
not_eq
(
nil
))
end
remove_column
:projects
,
:repository_size_limit_bytes
end
end
end
db/migrate/20170118200412_convert_namespaces_repository_size_limit_to_bytes.rb
0 → 100644
View file @
3c25eb26
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
ConvertNamespacesRepositorySizeLimitToBytes
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
connection
.
transaction
do
rename_column
:namespaces
,
:repository_size_limit
,
:repository_size_limit_mb
add_column
:namespaces
,
:repository_size_limit
,
:integer
,
limit:
8
end
bigint_expression
=
if
Gitlab
::
Database
.
postgresql?
'repository_size_limit_mb::bigint * 1024 * 1024'
else
'repository_size_limit_mb * 1024 * 1024'
end
connection
.
transaction
do
update_column_in_batches
(
:namespaces
,
:repository_size_limit
,
Arel
::
Nodes
::
SqlLiteral
.
new
(
bigint_expression
))
do
|
t
,
query
|
query
.
where
(
t
[
:repository_size_limit_mb
].
not_eq
(
nil
))
end
remove_column
:namespaces
,
:repository_size_limit_mb
end
end
def
down
connection
.
transaction
do
rename_column
:namespaces
,
:repository_size_limit
,
:repository_size_limit_bytes
add_column
:namespaces
,
:repository_size_limit
,
:integer
,
limit:
nil
end
connection
.
transaction
do
update_column_in_batches
(
:namespaces
,
:repository_size_limit
,
Arel
::
Nodes
::
SqlLiteral
.
new
(
'repository_size_limit_bytes / 1024 / 1024'
))
do
|
t
,
query
|
query
.
where
(
t
[
:repository_size_limit_bytes
].
not_eq
(
nil
))
end
remove_column
:namespaces
,
:repository_size_limit_bytes
end
end
end
db/schema.rb
View file @
3c25eb26
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201701
06172237
)
do
ActiveRecord
::
Schema
.
define
(
version:
201701
18200412
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -102,7 +102,6 @@ ActiveRecord::Schema.define(version: 20170106172237) do
t
.
boolean
"usage_ping_enabled"
,
default:
true
,
null:
false
t
.
boolean
"koding_enabled"
t
.
string
"koding_url"
t
.
integer
"repository_size_limit"
,
default:
0
t
.
text
"sign_in_text_html"
t
.
text
"help_page_text_html"
t
.
text
"shared_runners_text_html"
...
...
@@ -119,6 +118,7 @@ ActiveRecord::Schema.define(version: 20170106172237) do
t
.
string
"plantuml_url"
t
.
boolean
"plantuml_enabled"
t
.
integer
"shared_runners_minutes"
,
default:
0
,
null:
false
t
.
integer
"repository_size_limit"
,
limit:
8
,
default:
0
end
create_table
"approvals"
,
force: :cascade
do
|
t
|
...
...
@@ -853,10 +853,10 @@ ActiveRecord::Schema.define(version: 20170106172237) do
t
.
datetime
"ldap_sync_last_sync_at"
t
.
datetime
"deleted_at"
t
.
boolean
"lfs_enabled"
t
.
integer
"repository_size_limit"
t
.
text
"description_html"
t
.
integer
"parent_id"
t
.
integer
"shared_runners_minutes_limit"
t
.
integer
"repository_size_limit"
,
limit:
8
end
add_index
"namespaces"
,
[
"created_at"
],
name:
"index_namespaces_on_created_at"
,
using: :btree
...
...
@@ -1105,8 +1105,8 @@ ActiveRecord::Schema.define(version: 20170106172237) do
t
.
boolean
"repository_read_only"
t
.
boolean
"lfs_enabled"
t
.
text
"description_html"
t
.
integer
"repository_size_limit"
t
.
boolean
"only_allow_merge_if_all_discussions_are_resolved"
t
.
integer
"repository_size_limit"
,
limit:
8
end
add_index
"projects"
,
[
"ci_id"
],
name:
"index_projects_on_ci_id"
,
using: :btree
...
...
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