mirror of
https://github.com/kristoferssolo/zero2prod.git
synced 2025-10-21 20:10:40 +00:00
feat: add subscibtion status
This commit is contained in:
parent
677ae8aca1
commit
0ba5f0c77d
@ -1,7 +1,8 @@
|
||||
-- Add migration script here
|
||||
CREATE TABLE SUBSCRIPTIONS (
|
||||
"id" UUID PRIMARY KEY NOT NULL,
|
||||
"email" TEXT NOT NULL UNIQUE,
|
||||
"name" TEXT NOT NULL,
|
||||
"subscribed_at" TIMESTAMPTZ NOT NULL
|
||||
"id" uuid PRIMARY KEY NOT NULL,
|
||||
"email" text NOT NULL UNIQUE,
|
||||
"name" text NOT NULL,
|
||||
"subscribed_at" timestamptz NOT NULL
|
||||
);
|
||||
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
-- Add migration script here
|
||||
ALTER TABLE subscriptions
|
||||
ADD COLUMN status TEXT NULL;
|
||||
|
||||
@ -46,8 +46,9 @@ pub async fn insert_subscriber(
|
||||
) -> Result<(), sqlx::Error> {
|
||||
sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO subscriptions(id, email, name, subscribed_at)
|
||||
VALUES ($1, $2, $3, $4)
|
||||
INSERT INTO subscriptions(
|
||||
id, email, name, subscribed_at, status)
|
||||
VALUES ($1, $2, $3, $4, 'confirmed')
|
||||
"#,
|
||||
Uuid::new_v4(),
|
||||
new_subscriber.email.as_ref(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user