mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
parent
e99130d3ea
commit
6a9bc12664
3 changed files with 12 additions and 20 deletions
|
@ -22,6 +22,9 @@ import Swimlanes from '../models/swimlanes';
|
|||
import Triggers from '../models/triggers';
|
||||
import UnsavedEdits from '../models/unsavedEdits';
|
||||
import Users from '../models/users';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
// Anytime you change the schema of one of the collection in a non-backward
|
||||
// compatible way you have to write a migration in this file using the following
|
||||
// API:
|
||||
|
@ -1124,17 +1127,14 @@ Migrations.add('add-card-details-show-lists', () => {
|
|||
});
|
||||
|
||||
Migrations.add('migrate-attachments-collectionFS-to-ostrioFiles', () => {
|
||||
const os = require('os');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
tmdir = os.tmpdir();
|
||||
|
||||
AttachmentsOld.find().forEach(function(fileObj) {
|
||||
//console.log('File: ', fileObj.userId);
|
||||
|
||||
// This directory must be writable on server, so a test run first
|
||||
// We are going to copy the files locally, then move them to mongo bucket
|
||||
const fileName = path.join(tmpdir, `${fileObj._id}-${fileObj.name()}`);
|
||||
// We are going to copy the files locally, then move them to S3
|
||||
const fileName = `./assets/app/uploads/attachments/${
|
||||
fileObj._id
|
||||
}-${fileObj.name()}`;
|
||||
const newFileName = fileObj.name();
|
||||
|
||||
// This is "example" variable, change it to the userId that you might be using.
|
||||
|
@ -1192,18 +1192,16 @@ Migrations.add('migrate-attachments-collectionFS-to-ostrioFiles', () => {
|
|||
readStream.pipe(writeStream);
|
||||
});
|
||||
});
|
||||
Migrations.add('migrate-avatars-collectionFS-to-ostrioFiles', () => {
|
||||
const os = require('os');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
tmdir = os.tmpdir();
|
||||
|
||||
Migrations.add('migrate-avatars-collectionFS-to-ostrioFiles', () => {
|
||||
AvatarsOld.find().forEach(function(fileObj) {
|
||||
//console.log('File: ', fileObj.userId);
|
||||
|
||||
// This directory must be writable on server, so a test run first
|
||||
// We are going to copy the files locally, then move them to mongo bucket
|
||||
const fileName = path.join(tmpdir, `${fileObj._id}-${fileObj.name()}`);
|
||||
// We are going to copy the files locally, then move them to S3
|
||||
const fileName = `./assets/app/uploads/avatars/${
|
||||
fileObj._id
|
||||
}-${fileObj.name()}`;
|
||||
const newFileName = fileObj.name();
|
||||
|
||||
// This is "example" variable, change it to the userId that you might be using.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue