Parse-server: Version control, SCHEMA MIGRATION

Created on 19 Mar 2019  路  7Comments  路  Source: parse-community/parse-server

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.

feature up for grabs

Most helpful comment

I am reopening this one since similar features have been recurrently requested.

All 7 comments

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.

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();
};

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.

I am reopening this one since similar features have been recurrently requested.

+1 for version control of schema.

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.

Was this page helpful?
0 / 5 - 0 ratings