mirror of
https://github.com/strapi/strapi.git
synced 2025-11-25 14:41:15 +00:00
Fix schema storage
This commit is contained in:
parent
0d9ba0e5fd
commit
59eb3990dd
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const createSchemaDiff = require('../schema-diff');
|
const createSchemaDiff = require('../diff');
|
||||||
|
|
||||||
let diffSchemas;
|
let diffSchemas;
|
||||||
describe('diffSchemas', () => {
|
describe('diffSchemas', () => {
|
||||||
|
|||||||
@ -49,8 +49,6 @@ const createSchemaProvider = db => {
|
|||||||
|
|
||||||
const { status, diff } = this.schemaDiff.diff(DBSchema, schema);
|
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') {
|
if (status === 'CHANGED') {
|
||||||
await this.builder.updateSchema(diff);
|
await this.builder.updateSchema(diff);
|
||||||
}
|
}
|
||||||
@ -81,6 +79,7 @@ const createSchemaProvider = db => {
|
|||||||
|
|
||||||
if (oldHash !== hash) {
|
if (oldHash !== hash) {
|
||||||
debug('Schema changed');
|
debug('Schema changed');
|
||||||
|
|
||||||
return this.syncSchema();
|
return this.syncSchema();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,12 @@ module.exports = db => {
|
|||||||
return null;
|
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) {
|
hashSchema(schema) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user