Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
337
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
23
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TransFem.org
Sharkey
Commits
696cd3b0
Commit
696cd3b0
authored
7 years ago
by
otofune
Browse files
Options
Downloads
Patches
Plain Diff
migration - add migration to support changed filename usage
parent
2c234beb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/migration/change-gridfs-metadata-name-to-filename.js
+30
-0
30 additions, 0 deletions
tools/migration/change-gridfs-metadata-name-to-filename.js
with
30 additions
and
0 deletions
tools/migration/change-gridfs-metadata-name-to-filename.js
0 → 100644
+
30
−
0
View file @
696cd3b0
// for Node.js interpret
/**
* change usage of GridFS filename
* see commit fb422b4d603c53a70712caba55b35a48a8c2e619
*/
const
{
default
:
DriveFile
}
=
require
(
'
../../built/api/models/drive-file
'
)
async
function
applyNewChange
(
doc
)
{
const
result
=
await
DriveFile
.
update
(
doc
.
_id
,
{
$set
:
{
filename
:
doc
.
metadata
.
name
},
$unset
:
{
'
metadata.name
'
:
''
}
})
return
result
.
ok
===
1
}
async
function
main
()
{
const
oldTypeDocs
=
await
DriveFile
.
find
({
'
metadata.name
'
:
{
$exists
:
true
}
})
return
await
Promise
.
all
(
oldTypeDocs
.
map
(
applyNewChange
))
}
main
().
then
(
console
.
dir
).
catch
(
console
.
error
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment