diff --git a/package.json b/package.json index eaa108d24..8fad5b14b 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "db:create": "npm run db:create:dev && npm run db:create:test", "db:create:dev": "node script/create-db.js --env development", "db:create:test": "node script/drop-db.js --env test && node script/create-db.js --env test", - "db:migrate:create": "knex migrate:make --name", + "db:migrate:create": "knex migrate:make", "db:migrate": "npm run db:migrate:dev && npm run db:migrate:test", "db:migrate:dev": "knex migrate:latest --verbose --env development", "db:migrate:test": "knex migrate:latest --verbose --env test", diff --git a/server/db/migrations/20240528021821_add_letter_merge_vars.js b/server/db/migrations/20240528021821_add_letter_merge_vars.js new file mode 100644 index 000000000..01c4ec6d4 --- /dev/null +++ b/server/db/migrations/20240528021821_add_letter_merge_vars.js @@ -0,0 +1,13 @@ +module.exports = { + async up(knex) { + await knex.schema.alterTable('letters', (table) => { + table.jsonb('merge_variables').nullable() + }) + }, + + async down(knex) { + await knex.schema.alterTable('letters', (table) => { + table.dropColumn('merge_variables') + }) + } +} diff --git a/src/components/DonateMoney.vue b/src/components/DonateMoney.vue index 83f25d830..b901bab45 100644 --- a/src/components/DonateMoney.vue +++ b/src/components/DonateMoney.vue @@ -104,6 +104,7 @@ export default { const letterId = this.$store.state.letterId const letterVersion = this.$store.state.letterVersion const returnAddressId = this.$store.state.lobReturnAddressId + const mergeVariables = this.$store.state.mergeVariables return { letterTemplate: letterId, @@ -114,7 +115,8 @@ export default { state: rep.address_state, city: rep.address_city, zip: rep.address_zip, - returnAddress: returnAddressId + returnAddress: returnAddressId, + mergeVariables } }, styledCustomDonation() { diff --git a/src/store/index.js b/src/store/index.js index 21679573a..64c214e22 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -33,7 +33,8 @@ export default new Vuex.Store({ state: '', zip: '', email: '' - } + }, + mergeVariables: {} }, mutations: { // TODO: Do we really need two setters here?