Need help in connecting and referencing table in `neon_auth` schema
Recently started using stack auth with neon. The data for users is coming in
Here is my table structure in Drizzle,
I have tried to write the table as
users_syncusers_sync under neon_authneon_auth schema. I am having a problem while connecting to this schema. My Drizzle config defaults to publicpublic schema and creates a new table named users_sync users_sync. Here is my table structure in Drizzle,
import {
pgTable,
text,
timestamp,
pgEnum,
boolean,
integer,
date,
uuid,
} from "drizzle-orm/pg-core";
export const userRoleEnum = pgEnum("user_role", ["student", "mentor", "admin"]);
export const opportunityTypeEnum = pgEnum("opportunity_type", [
"hackathon",
"grant application",
"competition",
"ideathon",
]);
export const comments = pgTable("comments", {
id: uuid("id").primaryKey().defaultRandom(),
content: text("content").notNull(),
createdAt: timestamp("created_at").defaultNow(),
updatedAt: timestamp("updated_at").defaultNow(),
userId: text("user_id").references(() => users_sync.id),
opportunityId: uuid("opportunity_id").references(() => opportunities.id),
});
export const opportunities = pgTable("opportunities", {
id: uuid("id").primaryKey().defaultRandom(),
type: opportunityTypeEnum("type").array().default([]),
title: text("title").notNull(),
description: text("description").notNull(),
url: text("url").notNull(),
image: text("image"),
tags: text("tags").array().default([]),
location: text("location"),
organiserInfo: text("organiser_info"),
startDate: date("start_date"),
endDate: date("end_date"),
comments: text("comments").array().default([]),
isFlagged: boolean("is_flagged").default(false),
createdAt: timestamp("created_at").defaultNow(),
updatedAt: timestamp("updated_at").defaultNow(),
isVerified: boolean("is_verified").default(false),
isActive: boolean("is_active").default(true),
createdByUser: text("created_by_user").references(() => users_sync.id),
});import {
pgTable,
text,
timestamp,
pgEnum,
boolean,
integer,
date,
uuid,
} from "drizzle-orm/pg-core";
export const userRoleEnum = pgEnum("user_role", ["student", "mentor", "admin"]);
export const opportunityTypeEnum = pgEnum("opportunity_type", [
"hackathon",
"grant application",
"competition",
"ideathon",
]);
export const comments = pgTable("comments", {
id: uuid("id").primaryKey().defaultRandom(),
content: text("content").notNull(),
createdAt: timestamp("created_at").defaultNow(),
updatedAt: timestamp("updated_at").defaultNow(),
userId: text("user_id").references(() => users_sync.id),
opportunityId: uuid("opportunity_id").references(() => opportunities.id),
});
export const opportunities = pgTable("opportunities", {
id: uuid("id").primaryKey().defaultRandom(),
type: opportunityTypeEnum("type").array().default([]),
title: text("title").notNull(),
description: text("description").notNull(),
url: text("url").notNull(),
image: text("image"),
tags: text("tags").array().default([]),
location: text("location"),
organiserInfo: text("organiser_info"),
startDate: date("start_date"),
endDate: date("end_date"),
comments: text("comments").array().default([]),
isFlagged: boolean("is_flagged").default(false),
createdAt: timestamp("created_at").defaultNow(),
updatedAt: timestamp("updated_at").defaultNow(),
isVerified: boolean("is_verified").default(false),
isActive: boolean("is_active").default(true),
createdByUser: text("created_by_user").references(() => users_sync.id),
});I have tried to write the table as
neon_auth.users_syncneon_auth.users_sync but it doesn't work. Any idea how I can connect and reference users?