update migration to move assets to under user id
This commit is contained in:
parent
a11e37116a
commit
899b5c9710
2 changed files with 7 additions and 1 deletions
|
@ -4,6 +4,7 @@ import path from 'path';
|
||||||
import mongoose from 'mongoose';
|
import mongoose from 'mongoose';
|
||||||
import User from '../models/user';
|
import User from '../models/user';
|
||||||
import Project from '../models/project';
|
import Project from '../models/project';
|
||||||
|
import async from 'async';
|
||||||
require('dotenv').config({path: path.resolve('.env')});
|
require('dotenv').config({path: path.resolve('.env')});
|
||||||
mongoose.connect('mongodb://localhost:27017/p5js-web-editor');
|
mongoose.connect('mongodb://localhost:27017/p5js-web-editor');
|
||||||
mongoose.connection.on('error', () => {
|
mongoose.connection.on('error', () => {
|
||||||
|
@ -24,6 +25,11 @@ let client = s3.createClient({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const CHUNK = 100;
|
||||||
|
Project.count({}).exec().then((numProjects) => {
|
||||||
|
console.log(numProjects);
|
||||||
|
let index = 0;
|
||||||
|
})
|
||||||
Project.find({}, (err, projects) => {
|
Project.find({}, (err, projects) => {
|
||||||
projects.forEach((project, projectIndex) => {
|
projects.forEach((project, projectIndex) => {
|
||||||
if (!project.user) return;
|
if (!project.user) return;
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
require('babel-register');
|
require('babel-register');
|
||||||
require('babel-polyfill');
|
require('babel-polyfill');
|
||||||
require('./moveBucket');
|
require('./s3UnderUser');
|
||||||
|
|
Loading…
Reference in a new issue