Add "added_to_mailing_list" column on signups table
This commit is contained in:
parent
0b0fe91545
commit
4436ec48eb
3 changed files with 8 additions and 2 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE "signups"
|
||||||
|
ADD "added_to_mailing_list" BOOLEAN NOT NULL DEFAULT FALSE;
|
|
@ -390,10 +390,11 @@ impl Db<sqlx::Postgres> {
|
||||||
platform_unknown,
|
platform_unknown,
|
||||||
editor_features,
|
editor_features,
|
||||||
programming_languages,
|
programming_languages,
|
||||||
device_id
|
device_id,
|
||||||
|
added_to_mailing_list
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
($1, $2, FALSE, $3, $4, $5, FALSE, $6, $7, $8)
|
($1, $2, FALSE, $3, $4, $5, FALSE, $6, $7, $8, $9)
|
||||||
ON CONFLICT (email_address) DO UPDATE SET
|
ON CONFLICT (email_address) DO UPDATE SET
|
||||||
email_address = excluded.email_address
|
email_address = excluded.email_address
|
||||||
RETURNING id
|
RETURNING id
|
||||||
|
@ -407,6 +408,7 @@ impl Db<sqlx::Postgres> {
|
||||||
.bind(&signup.editor_features)
|
.bind(&signup.editor_features)
|
||||||
.bind(&signup.programming_languages)
|
.bind(&signup.programming_languages)
|
||||||
.bind(&signup.device_id)
|
.bind(&signup.device_id)
|
||||||
|
.bind(&signup.added_to_mailing_list)
|
||||||
.execute(&self.pool)
|
.execute(&self.pool)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -1270,6 +1272,7 @@ pub struct Signup {
|
||||||
pub editor_features: Vec<String>,
|
pub editor_features: Vec<String>,
|
||||||
pub programming_languages: Vec<String>,
|
pub programming_languages: Vec<String>,
|
||||||
pub device_id: Option<String>,
|
pub device_id: Option<String>,
|
||||||
|
pub added_to_mailing_list: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, FromRow)]
|
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, FromRow)]
|
||||||
|
|
|
@ -657,6 +657,7 @@ async fn test_signups() {
|
||||||
editor_features: vec!["speed".into()],
|
editor_features: vec!["speed".into()],
|
||||||
programming_languages: vec!["rust".into(), "c".into()],
|
programming_languages: vec!["rust".into(), "c".into()],
|
||||||
device_id: Some(format!("device_id_{i}")),
|
device_id: Some(format!("device_id_{i}")),
|
||||||
|
added_to_mailing_list: i != 0, // One user failed to subscribe
|
||||||
})
|
})
|
||||||
.collect::<Vec<Signup>>();
|
.collect::<Vec<Signup>>();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue