Skip to content

Commit

Permalink
feat: db table changes for churn email column
Browse files Browse the repository at this point in the history
  • Loading branch information
mansaj committed Jan 9, 2025
1 parent 8b97f7c commit 66ee7bf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
export function up (knex) {
return knex.schema.table("subscribers", table => {
table.boolean("churn_prevention_email_sent").defaultTo(false);
table.index("churn_prevention_email_sent");
});
}

/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
export function down (knex) {
return knex.schema.table("subscribers", table => {
table.dropIndex("churn_prevention_email_sent")
table.dropColumn("churn_prevention_email_sent");
});
}
2 changes: 2 additions & 0 deletions src/knex-tables.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ declare module "knex/types/tables" {
sign_in_count: null | number;
email_addresses: SubscriberEmail[];
first_broker_removal_email_sent: boolean;
churn_prevention_email_sent: boolean;
}
type SubscriberOptionalColumns = Extract<
keyof SubscriberRow,
Expand All @@ -174,6 +175,7 @@ declare module "knex/types/tables" {
| "onerep_profile_id"
| "email_addresses"
| "first_broker_removal_email_sent"
| "churn_prevention_email_sent"
>;
type SubscriberAutoInsertedColumns = Extract<
keyof SubscriberRow,
Expand Down

0 comments on commit 66ee7bf

Please sign in to comment.