set-sequence.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // ███████╗███████╗████████╗ ███████╗███████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗ ██████╗███████╗
  2. // ██╔════╝██╔════╝╚══██╔══╝ ██╔════╝██╔════╝██╔═══██╗██║ ██║██╔════╝████╗ ██║██╔════╝██╔════╝
  3. // ███████╗█████╗ ██║ ███████╗█████╗ ██║ ██║██║ ██║█████╗ ██╔██╗ ██║██║ █████╗
  4. // ╚════██║██╔══╝ ██║ ╚════██║██╔══╝ ██║▄▄ ██║██║ ██║██╔══╝ ██║╚██╗██║██║ ██╔══╝
  5. // ███████║███████╗ ██║ ███████║███████╗╚██████╔╝╚██████╔╝███████╗██║ ╚████║╚██████╗███████╗
  6. // ╚══════╝╚══════╝ ╚═╝ ╚══════╝╚══════╝ ╚══▀▀═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═════╝╚══════╝
  7. //
  8. module.exports = require('machine').build({
  9. friendlyName: 'Set Sequence',
  10. description: 'Sets the current version of a sequence from a migration.',
  11. inputs: {
  12. datastore: {
  13. description: 'The datastore to use for connections.',
  14. extendedDescription: 'Datastores represent the config and manager required to obtain an active database connection.',
  15. required: true,
  16. readOnly: true,
  17. example: '==='
  18. },
  19. sequenceName: {
  20. description: 'The name of the sequence to set the value for.',
  21. required: true,
  22. example: 'user_id_seq'
  23. },
  24. sequenceValue: {
  25. description: 'The value to set the sequence to.',
  26. required: true,
  27. example: 123
  28. },
  29. meta: {
  30. friendlyName: 'Meta (custom)',
  31. description: 'Additional stuff to pass to the driver.',
  32. extendedDescription: 'This is reserved for custom driver-specific extensions.',
  33. example: '==='
  34. }
  35. },
  36. exits: {
  37. success: {
  38. description: 'The sequence was set successfully.'
  39. },
  40. badConnection: {
  41. friendlyName: 'Bad connection',
  42. description: 'A connection either could not be obtained or there was an error using the connection.'
  43. }
  44. },
  45. fn: function select(inputs, exits) {
  46. // Return a no-op.
  47. setImmediate(function ensureAsync() {
  48. return exits.success();
  49. });
  50. }
  51. });