You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pdfy/migrations/20150322001330_persist-more...

34 lines
756 B
CoffeeScript

rfr = require "rfr"
persist = rfr "lib/persist"
initializeVariable = (name, type, initialValue) ->
Promise.all [
persist.addListItem "variableTypes",
name: name
type: type
persist.setItem "var:#{name}", initialValue
]
removeVariable = (name) ->
Promise.all [
persist.removeListItemByFilter "variableTypes", (item) ->
return (item.name == name)
persist.removeItem "var:#{name}"
]
exports.up = (knex, Promise) ->
Promise.all [
initializeVariable "donationGoal", "number", 500
initializeVariable "donationTotal", "number", 0
initializeVariable "showNotice", "boolean", false
]
exports.down = (knex, Promise) ->
Promise.all [
removeVariable "donationGoal"
removeVariable "donationTotal"
removeVariable "showNotice"
]