diff --git a/migrations/2021-01-13-make-some-job-fields-longer.js b/migrations/2021-01-13-make-some-job-fields-longer.js new file mode 100644 index 00000000..286fd888 --- /dev/null +++ b/migrations/2021-01-13-make-some-job-fields-longer.js @@ -0,0 +1,20 @@ +/* + * Make some Job fields longer + * title: 64 -> 128 + * description: change type to TEXT (unlimited length) + */ + +module.exports = { + up: queryInterface => { + return Promise.all([ + queryInterface.sequelize.query(`ALTER TABLE bookings.jobs ALTER COLUMN title TYPE VARCHAR(128)`), + queryInterface.sequelize.query(`ALTER TABLE bookings.jobs ALTER COLUMN description TYPE TEXT`) + ]) + }, + down: queryInterface => { + return Promise.all([ + queryInterface.sequelize.query(`ALTER TABLE bookings.jobs ALTER COLUMN title TYPE VARCHAR(64)`), + queryInterface.sequelize.query(`ALTER TABLE bookings.jobs ALTER COLUMN description TYPE VARCHAR(255)`) + ]) + } +} diff --git a/src/bootstrap.js b/src/bootstrap.js index 8e14bba3..eaaf88ec 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -9,7 +9,7 @@ Joi.rateType = () => Joi.string().valid('hourly', 'daily', 'weekly', 'monthly') Joi.jobStatus = () => Joi.string().valid('sourcing', 'in-review', 'assigned', 'closed', 'cancelled') Joi.workload = () => Joi.string().valid('full-time', 'fractional') Joi.jobCandidateStatus = () => Joi.string().valid('open', 'selected', 'shortlist', 'rejected', 'cancelled') -Joi.title = () => Joi.string().max(64) +Joi.title = () => Joi.string().max(128) function buildServices (dir) { const files = fs.readdirSync(dir) diff --git a/src/models/Job.js b/src/models/Job.js index 3e278a15..14cec753 100644 --- a/src/models/Job.js +++ b/src/models/Job.js @@ -66,13 +66,13 @@ module.exports = (sequelize) => { }, externalId: { field: 'external_id', - type: Sequelize.STRING + type: Sequelize.STRING(255) }, description: { - type: Sequelize.STRING + type: Sequelize.TEXT, // technically unlimited length }, title: { - type: Sequelize.STRING, + type: Sequelize.STRING(128), allowNull: false }, startDate: { @@ -90,22 +90,22 @@ module.exports = (sequelize) => { }, resourceType: { field: 'resource_type', - type: Sequelize.STRING + type: Sequelize.STRING(255) }, rateType: { field: 'rate_type', - type: Sequelize.STRING + type: Sequelize.STRING(255) }, workload: { field: 'workload', - type: Sequelize.STRING + type: Sequelize.STRING(45) }, skills: { type: Sequelize.JSONB, allowNull: false }, status: { - type: Sequelize.STRING, + type: Sequelize.STRING(255), allowNull: false }, createdAt: { diff --git a/src/models/JobCandidate.js b/src/models/JobCandidate.js index 20d0831c..70632b66 100644 --- a/src/models/JobCandidate.js +++ b/src/models/JobCandidate.js @@ -53,15 +53,15 @@ module.exports = (sequelize) => { allowNull: false }, status: { - type: Sequelize.STRING, + type: Sequelize.STRING(255), allowNull: false }, externalId: { field: 'external_id', - type: Sequelize.STRING + type: Sequelize.STRING(255) }, resume: { - type: Sequelize.STRING + type: Sequelize.STRING(2048) }, createdAt: { field: 'created_at', diff --git a/src/models/ResourceBooking.js b/src/models/ResourceBooking.js index 93a62210..63557904 100644 --- a/src/models/ResourceBooking.js +++ b/src/models/ResourceBooking.js @@ -56,7 +56,7 @@ module.exports = (sequelize) => { type: Sequelize.UUID }, status: { - type: Sequelize.STRING, + type: Sequelize.STRING(255), allowNull: false }, startDate: { @@ -77,7 +77,7 @@ module.exports = (sequelize) => { }, rateType: { field: 'rate_type', - type: Sequelize.STRING, + type: Sequelize.STRING(255), allowNull: false }, createdAt: {