20190215115310_customlocations.js 734 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { migrate as logger } from "../logger.js";
  2. const migrateName = "custom_locations";
  3. /**
  4. * Migrate
  5. * Extends proxy_host table with locations field
  6. *
  7. * @see http://knexjs.org/#Schema
  8. *
  9. * @param {Object} knex
  10. * @returns {Promise}
  11. */
  12. const up = (knex) => {
  13. logger.info(`[${migrateName}] Migrating Up...`);
  14. return knex.schema
  15. .table("proxy_host", (proxy_host) => {
  16. proxy_host.json("locations");
  17. })
  18. .then(() => {
  19. logger.info(`[${migrateName}] proxy_host Table altered`);
  20. });
  21. };
  22. /**
  23. * Undo Migrate
  24. *
  25. * @param {Object} knex
  26. * @returns {Promise}
  27. */
  28. const down = (_knex) => {
  29. logger.warn(`[${migrateName}] You can't migrate down this one.`);
  30. return Promise.resolve(true);
  31. };
  32. export { up, down };