Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INT-177] Remove username from user #140

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/(authenticated)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export default async function AuthenticatedLayout({

Sentry.setUser({
id: user.user_id,
username: user.username,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double-check in the Sentry docs that it isn't required, then go ahead and merge

email: user.email,
});

Expand Down
1 change: 0 additions & 1 deletion components/UserContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export function UserProvider(props: {
useEffect(() => {
Sentry.setUser({
id: props.user.user_id,
username: props.user.username,
email: props.user.email,
});
}, [props.user]);
Expand Down
1 change: 0 additions & 1 deletion lib/auth/google/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export async function findOrCreateUserFromGoogleToken(rawToken: string) {
first_name: claims.given_name!,
last_name: claims.family_name!,
email: claims.email!,
username: claims.email!.split("@")[0],
avatar: claims.picture,
identities: {
create: {
Expand Down
1 change: 0 additions & 1 deletion lib/auth/slack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export async function findOrCreateUserFromSlackToken(userInfo: SlackTokenJson) {
first_name: userInfo.given_name!,
last_name: userInfo.family_name!,
email: userInfo.email!,
username: userInfo.email!.split("@")[0],
avatar: userInfo.picture!,
identities: {
create: {
Expand Down
11 changes: 11 additions & 0 deletions lib/db/migrations/20240904143009_remove_username/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Warnings:

- You are about to drop the column `username` on the `users` table. All the data in the column will be lost.

*/
-- DropIndex
DROP INDEX "users_username_key";

-- AlterTable
ALTER TABLE "users" DROP COLUMN "username";
1 change: 0 additions & 1 deletion lib/db/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ model Role {
/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model User {
user_id Int @id @default(autoincrement())
username String @unique
email String @unique
first_name String
last_name String
Expand Down
1 change: 0 additions & 1 deletion lib/db/types/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.arr

export const _UserModel = z.object({
user_id: z.number().int(),
username: z.string(),
email: z.string(),
first_name: z.string(),
last_name: z.string(),
Expand Down
Loading