Alexandre Bodin e6145f18b1 wip
2021-06-24 09:09:29 +02:00

27 lines
519 B
JavaScript

'use strict';
const createSchemaBuilder = require('./builder');
const createSchemaProvider = db => {
/*
1. Load schema from DB
3. Run migrations on old schema
2. Build new schema
4. Diff the two
5. Apply diff
*/
return {
get builder() {
return createSchemaBuilder(db);
},
async sync() {
// TODO: sync schema instead of creating it
await this.builder.dropSchema();
await this.builder.createSchema();
},
};
};
module.exports = createSchemaProvider;