"use strict"; const { changeCollection, addFields, changeFields, addIndex, decimal, required, defaultExistingTo, precision, defaultTo, withTimezone, unsigned } = require("../../../src/schema/methods/v1"); module.exports = [ changeCollection("users", [ addFields({ karmaScore: [ required, decimal, precision(4), defaultTo(0) ] }), changeFields({ // A migration default is mandatory when making a field `required` in a `changeFields` emailAddress: [ required, defaultExistingTo("INVALID@example.com") ], // TODO: To detect bugs early, disallow no-op changes in schema modifications? isActive: [ required ], // TODO: Changing to *without* a timezone should require an explicit allowDestructive modifier, as it would require normalizing all dates to UTC, losing the original timezone information in the process. Or maybe an `unsafe` wrapper? Like `unsafe(withoutTimezone)` or `destructive(withoutTimezone)`, but only for *modification* cases registrationDate: [ withTimezone ], invitesLeft: [ unsigned ] }), addIndex("karmaScore") ]) ];