Skip to content

Commit

Permalink
chore: profile表加上时间列
Browse files Browse the repository at this point in the history
  • Loading branch information
14790897 committed Mar 7, 2024
1 parent 559b401 commit a0e88d8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions utils/supabase/supabaseutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,29 @@ export async function insertUserProfile(data: any, supabase: SupabaseClient) {
} else {
user = data;
}

if (user) {
const currentTime = new Date().toISOString(); // 生成ISO格式的时间字符串

const { data, error: profileError } = await supabase
.from("profiles")
.upsert([{ id: user.id, email: user.email }]);
.upsert([
{
id: user.id,
email: user.email,
created_at: currentTime, // 添加创建时间
},
]);

if (profileError) {
console.error("Failed to create user profile:", profileError);
Sentry.captureException(profileError);
}
//sentry

Sentry.setUser({
email: user.email,
id: user.id,
ip_address: "{{auto}}}",
ip_address: "{{auto}}",
});
}
}

0 comments on commit a0e88d8

Please sign in to comment.