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

studio not querying bools correctly #541

Open
Ribeiro-Tiago opened this issue Aug 12, 2024 · 0 comments
Open

studio not querying bools correctly #541

Ribeiro-Tiago opened this issue Aug 12, 2024 · 0 comments

Comments

@Ribeiro-Tiago
Copy link

Ribeiro-Tiago commented Aug 12, 2024

I have the following schema

export const users = pgTable(
  "users",
  {
    id: uuid("id").primaryKey().unique().notNull().defaultRandom(),
    email: text("email").unique().notNull(),
    password: text("password").notNull(),

    createdAt: timestamp("created_at").defaultNow(),
    verified: boolean("verified").default(false),
    type: text("type").$type<UserType>().default("user"),

    name: text("name"),
    gender: varchar("gender", { length: 15 }).$type<UserGender>().default("prefer_not_say"),
    birthday: date("birthday"),
    token: varchar("token", { length: 128 }),
    bio: text("bio"),
    interests: text("locations").array().$type<string[]>(),
    hobbies: text("hobbies").array().$type<string[]>(),
    city: varchar("city", { length: 256 }),
    picUrl: text("pic_url"),
    picThumbnailUrl: text("pic_thumbnail_url"),
  },
  (users) => ({
    idIdx: uniqueIndex("user_id_idx").on(users.id),
    emailIdx: uniqueIndex("user_email_idx").on(users.email),
    interestsIdx: index("user_interests_idx").on(users.interests),
    hobbiesIdx: index("user_hobbies_idx").on(users.hobbies),
  }),
);

I have these 5 items

Screenshot 2024-08-12 at 22 38 06

and when i try to query the verified field in the studio i get wrong results whether i do verified equals true or false i only get this one item

Screenshot 2024-08-12 at 22 37 25

and if I open in sql with the Open in SQL button, i can see that the value is being converted to string

Screenshot 2024-08-12 at 22 40 14

if i remove the quotes from the sql code, it works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant