mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 18:33:55 +00:00
Fix schema storage
This commit is contained in:
parent
0d9ba0e5fd
commit
59eb3990dd
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const createSchemaDiff = require('../schema-diff');
|
||||
const createSchemaDiff = require('../diff');
|
||||
|
||||
let diffSchemas;
|
||||
describe('diffSchemas', () => {
|
||||
|
||||
@ -49,8 +49,6 @@ const createSchemaProvider = db => {
|
||||
|
||||
const { status, diff } = this.schemaDiff.diff(DBSchema, schema);
|
||||
|
||||
console.log(diff.tables.updated.flatMap(t => t.columns.updated).map(x => x.object));
|
||||
|
||||
if (status === 'CHANGED') {
|
||||
await this.builder.updateSchema(diff);
|
||||
}
|
||||
@ -81,6 +79,7 @@ const createSchemaProvider = db => {
|
||||
|
||||
if (oldHash !== hash) {
|
||||
debug('Schema changed');
|
||||
|
||||
return this.syncSchema();
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,12 @@ module.exports = db => {
|
||||
return null;
|
||||
}
|
||||
|
||||
return typeof res.schema === 'object' ? res.schema : JSON.parse(res.schema);
|
||||
const parsedSchema = typeof res.schema === 'object' ? res.schema : JSON.parse(res.schema);
|
||||
|
||||
return {
|
||||
...res,
|
||||
schema: parsedSchema,
|
||||
};
|
||||
},
|
||||
|
||||
hashSchema(schema) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user