Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version control, SCHEMA MIGRATION #5434

Closed
mpadula1990 opened this issue Mar 19, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@mpadula1990
Copy link

commented Mar 19, 2019

if i work with various enviroments (develop, staging and production) and I update the schema in develop, the JS SDK have a function to migrate to others enviroments with the differences?

sory for my english.

@georgesjamous

This comment has been minimized.

Copy link
Contributor

commented Mar 20, 2019

Unfortunately no, you have to create your own schema migration script and run it on the target environment.

If in Develop you have additional classes or schema fields, and you have disabled the class creation, you have to create a migration script to add these new classes to the new environment.

parse is not aware of any other environment. Supposing that each one has its own database and server.

@acinader

This comment has been minimized.

Copy link
Member

commented Apr 2, 2019

I use the npm package: mongodb-migrate

Here is what one of my migrations looks like:

var mongodb = require('mongodb');

const indexes = [
    {
        "key": {"_p_toUser": 1, "_rperm": 1, "postDate": -1, "_updated_at": -1},
        "background": true
    }
];

exports.up = function (db, next) {
    db.createCollection('FeedItem')
        .then((collection) => {
            return collection.createIndexes(indexes);
        })
        .then(() => next())
        .catch(e => next(e));
};

exports.down = function(db, next){
    next();
};
@stale

This comment has been minimized.

Copy link

commented May 17, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 17, 2019

@stale stale bot closed this May 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.