0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Deleted unused schema util

refs 03cbc89a53

- this util was added to fix an issue with the types of columns in
  MySQL, but the issue was back in 2014 (!!)
- we're long past doing it in this way so we'll likely never use it
  again
This commit is contained in:
Daniel Lockyer 2022-08-10 10:53:47 +02:00
parent 58f13517d2
commit e000c6cca6
No known key found for this signature in database
GPG key ID: D21186F0B47295AD
2 changed files with 0 additions and 24 deletions

View file

@ -27,22 +27,7 @@ const getColumns = function getColumns(table, transaction) {
});
};
// This function changes the type of posts.html and posts.markdown columns to mediumtext. Due to
// a wrong datatype in schema.js some installations using mysql could have been created using the
// data type text instead of mediumtext.
// For details see: https://github.com/TryGhost/Ghost/issues/1947
const checkPostTable = function checkPostTable(transaction = db.knex) {
return transaction.raw('SHOW FIELDS FROM posts where Field ="html" OR Field = "markdown"').then(function (response) {
return _.flatten(_.map(response[0], function (entry) {
if (entry.Type.toLowerCase() !== 'mediumtext') {
return (transaction || db.knex).raw('ALTER TABLE posts MODIFY ' + entry.Field + ' MEDIUMTEXT');
}
}));
});
};
module.exports = {
checkPostTable: checkPostTable,
getTables: getTables,
getIndexes: getIndexes,
getColumns: getColumns

View file

@ -411,14 +411,6 @@ function getColumns(table, transaction = db.knex) {
return Promise.reject(tpl(messages.noSupportForDatabase, {client: client}));
}
function checkTables(transaction = db.knex) {
const client = transaction.client.config.client;
if (DatabaseInfo.isMySQL(transaction)) {
return clients[client].checkPostTable();
}
}
function createColumnMigration(...migrations) {
async function runColumnMigration(conn, migration) {
const {
@ -449,7 +441,6 @@ function createColumnMigration(...migrations) {
}
module.exports = {
checkTables: checkTables,
createTable: createTable,
deleteTable: deleteTable,
getTables: getTables,