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
427f1e59
Commit
427f1e59
authored
Jan 19, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
making the migrate reversible
parent
77f06178
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
app/models/appearance.rb
app/models/appearance.rb
+2
-0
db/migrate/20180119135717_add_uploader_index_to_uploads.rb
db/migrate/20180119135717_add_uploader_index_to_uploads.rb
+7
-2
spec/uploaders/records_uploads_spec.rb
spec/uploaders/records_uploads_spec.rb
+2
-6
No files found.
app/models/appearance.rb
View file @
427f1e59
...
...
@@ -12,6 +12,8 @@ class Appearance < ActiveRecord::Base
mount_uploader
:logo
,
AttachmentUploader
mount_uploader
:header_logo
,
AttachmentUploader
has_many
:uploads
,
as: :model
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
CACHE_KEY
=
'current_appearance'
.
freeze
after_commit
:flush_redis_cache
...
...
db/migrate/20180119135717_add_uploader_index_to_uploads.rb
View file @
427f1e59
...
...
@@ -8,8 +8,13 @@ class AddUploaderIndexToUploads < ActiveRecord::Migration
disable_ddl_transaction!
def
change
def
up
remove_concurrent_index
:uploads
,
:path
add_concurrent_index
:uploads
,
[
:uploader
,
:path
],
using: :btree
add_concurrent_index
:uploads
,
[
:uploader
,
:path
],
using: :btree
end
def
down
remove_concurrent_index
:uploads
,
[
:uploader
,
:path
]
add_concurrent_index
:uploads
,
:path
,
using: :btree
end
end
spec/uploaders/records_uploads_spec.rb
View file @
427f1e59
...
...
@@ -7,13 +7,9 @@ describe RecordsUploads do
storage_options
Gitlab
.
config
.
uploads
storage
:file
def
model
FactoryBot
.
build_stubbed
(
:user
)
end
end
RecordsUploadsExampleUploader
.
new
RecordsUploadsExampleUploader
.
new
(
build_stubbed
(
:user
))
end
def
upload_fixture
(
filename
)
...
...
@@ -56,7 +52,7 @@ describe RecordsUploads do
expect
(
upload
.
path
).
to
eq
uploader
.
upload_path
expect
(
upload
.
model_id
).
to
eq
uploader
.
model
.
id
expect
(
upload
.
model_type
).
to
eq
uploader
.
model
.
class
.
to_s
expect
(
upload
.
uploader
).
to
eq
uploader
.
class
expect
(
upload
.
uploader
).
to
eq
uploader
.
class
.
to_s
end
end
...
...
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