Added migration for snippets table creation (#12282)

no issue

- minimal table structure required for the first iteration of content snippets
- snippets are stored pieces of re-usable content that could effectively be entire posts so the `mobiledoc` field length matches the `posts.mobiledoc` field length
This commit is contained in:
Kevin Ansfield 2020-10-16 12:52:06 +01:00 committed by GitHub
parent 34875b85f3
commit 74269070dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1,2 @@
const {addTable} = require('../../utils');
module.exports = addTable('snippets');

View File

@ -492,5 +492,14 @@ module.exports = {
data: {type: 'string', maxlength: 2000, nullable: true}, data: {type: 'string', maxlength: 2000, nullable: true},
created_at: {type: 'dateTime', nullable: false}, created_at: {type: 'dateTime', nullable: false},
created_by: {type: 'string', maxlength: 24, nullable: false} created_by: {type: 'string', maxlength: 24, nullable: false}
},
snippets: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
name: {type: 'string', maxlength: 191, nullable: false, unique: true},
mobiledoc: {type: 'text', maxlength: 1000000000, fieldtype: 'long', nullable: false},
created_at: {type: 'dateTime', nullable: false},
created_by: {type: 'string', maxlength: 24, nullable: false},
updated_at: {type: 'dateTime', nullable: true},
updated_by: {type: 'string', maxlength: 24, nullable: true}
} }
}; };

View File

@ -55,7 +55,7 @@ describe('DB API', function () {
const jsonResponse = res.body; const jsonResponse = res.body;
should.exist(jsonResponse.db); should.exist(jsonResponse.db);
jsonResponse.db.should.have.length(1); jsonResponse.db.should.have.length(1);
Object.keys(jsonResponse.db[0].data).length.should.eql(33); Object.keys(jsonResponse.db[0].data).length.should.eql(34);
}); });
}); });

View File

@ -32,7 +32,7 @@ const defaultSettings = require('../../../../core/server/data/schema/default-set
*/ */
describe('DB version integrity', function () { describe('DB version integrity', function () {
// Only these variables should need updating // Only these variables should need updating
const currentSchemaHash = 'edd2611c5a774ac64035b71ea966ade4'; const currentSchemaHash = 'c4de64f1c1114eb8b05c7473e3adc29e';
const currentFixturesHash = '29148c40dfaf4f828c5fca95666f6545'; const currentFixturesHash = '29148c40dfaf4f828c5fca95666f6545';
const currentSettingsHash = 'c8daa2c9632bb75f9d60655de09ae3bd'; const currentSettingsHash = 'c8daa2c9632bb75f9d60655de09ae3bd';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01'; const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';