mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 15:44:31 +03:00
Preserve metrics_id from signup to user record
This commit is contained in:
parent
3dd8845bd8
commit
963ced1dd8
@ -4,3 +4,5 @@ ALTER TABLE users
|
||||
DROP COLUMN metrics_id;
|
||||
|
||||
DROP SEQUENCE metrics_id_seq;
|
||||
|
||||
DROP INDEX index_users_on_email_address;
|
@ -25,3 +25,6 @@ CREATE INDEX "index_signups_on_email_confirmation_sent" ON "signups" ("email_con
|
||||
|
||||
ALTER TABLE "users"
|
||||
ADD "metrics_id" INTEGER DEFAULT nextval('metrics_id_seq');
|
||||
|
||||
UPDATE users
|
||||
SET metrics_id = nextval('metrics_id_seq');
|
||||
|
@ -448,9 +448,9 @@ impl Db for PostgresDb {
|
||||
) -> Result<(UserId, Option<UserId>)> {
|
||||
let mut tx = self.pool.begin().await?;
|
||||
|
||||
let (signup_id, inviting_user_id): (i32, Option<UserId>) = sqlx::query_as(
|
||||
let (signup_id, metrics_id, inviting_user_id): (i32, i32, Option<UserId>) = sqlx::query_as(
|
||||
"
|
||||
SELECT id, inviting_user_id
|
||||
SELECT id, metrics_id, inviting_user_id
|
||||
FROM signups
|
||||
WHERE
|
||||
email_address = $1 AND
|
||||
@ -467,9 +467,9 @@ impl Db for PostgresDb {
|
||||
let user_id: UserId = sqlx::query_scalar(
|
||||
"
|
||||
INSERT INTO users
|
||||
(email_address, github_login, admin, invite_count, invite_code)
|
||||
(email_address, github_login, admin, invite_count, invite_code, metrics_id)
|
||||
VALUES
|
||||
($1, $2, 'f', $3, $4)
|
||||
($1, $2, 'f', $3, $4, $5)
|
||||
RETURNING id
|
||||
",
|
||||
)
|
||||
@ -477,6 +477,7 @@ impl Db for PostgresDb {
|
||||
.bind(&user.github_login)
|
||||
.bind(&user.invite_count)
|
||||
.bind(random_invite_code())
|
||||
.bind(metrics_id)
|
||||
.fetch_one(&mut tx)
|
||||
.await?;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user