diff --git a/server/index.js b/server/index.js index 417d95d..e7582b6 100644 --- a/server/index.js +++ b/server/index.js @@ -114,6 +114,9 @@ let pledgeSchema = function(t) { t.string('referral_code', 256) t.string('referrer', 128) + + t.boolean('backed_out').defaultTo(false) + t.boolean('unsubscribed').defaultTo(false) } // function to make sure referral columns exist @@ -140,13 +143,40 @@ function ensureReferralColumns(table) { }) } +// likewise for backed_out and unsubscribed columns +function ensureBackoutColumns(table) { + knex.schema.hasColumn(table, 'backed_out').then(function(exists) { + if (!exists) { + console.debug(`No backed_out column in ${table}! Adding now...`) + knex.schema.alterTable(table, t => { + t.boolean('backed_out').defaultTo(false) + }).then(r => console.debug(`backed_out column added to ${table}`, r)) + } + }) + + knex.schema.hasColumn(table, 'unsubscribed').then(function(exists) { + if (!exists) { + console.debug(`No unsubscribed column in ${table}! Adding now...`) + knex.schema.alterTable(table, t => { + t.boolean('unsubscribed').defaultTo(false) + }).then(r => console.debug(`unsubscribed column added to ${table}`, r)) + } + }) +} + +// meta-function to ensure all the columns are there! +function ensureColumns(table) { + ensureReferralColumns(table) + ensureBackoutColumns(table) +} + // make sure pledges table exists knex.schema.hasTable('pledges').then(function(exists) { if (!exists) { if (DEBUG) console.debug('No pledge table exists! Creating one now...') return knex.schema.createTable('pledges', pledgeSchema) } else { - ensureReferralColumns('pledges') + ensureColumns('pledges') } }) @@ -156,7 +186,7 @@ knex.schema.hasTable('unverified_pledges').then(function(exists) { if (DEBUG) console.debug('No unverified pledge table exists! Creating one now...') return knex.schema.createTable('unverified_pledges', pledgeSchema) } else { - ensureReferralColumns('unverified_pledges') + ensureColumns('unverified_pledges') } }) diff --git a/src/bye.htm.twig b/src/bye.htm.twig new file mode 100644 index 0000000..6e29225 --- /dev/null +++ b/src/bye.htm.twig @@ -0,0 +1,11 @@ +{% extends "base.htm.twig" %} + +{% block title %}Snipette Crowdfunding: Unsubscribed{% endblock %} +{% block heading %}Adios!{% endblock %} +{% block message %} +

We're sorry to see you back out, but we respect your decision. We have removed you from our crowdfunders list, and will stop contacting you about payments. Please check your inbox for a receipt.

+

+We know our crowdfunding campaign didn't go as well as we expected. However, all is not lost and we have made some progress since last year. We hope you'll continue to be part of the Snipette journey, even if it's an stroll rather than a marathon. But either way, before signing off, we'd like to say thanks for being with us thus far! +

+

Continue to Snipette

+{% endblock %}