How to create a variable with the same name as the table name?

I have my schema defined like this.
schema.ts
import { pgTable, serial, text, varchar } from "drizzle-orm/pg-core";

export const users = pgTable("users", {
  id: serial("id").primaryKey(),
  fullName: text("full_name"),
  phone: varchar("phone", { length: 256 }),
});

export type User = typeof users.$inferSelect;


And then I have this file, where I'm trying to query the users.
page.tsx
import db from "@/db";
import { users, User } from "@/db/schema";

export default async function Home() {
  const usrs: Array<User> = await db.select().from(users);

  console.log("hello");
  console.log("users: ", users);

  return (
    <div>
      {usrs.map((usr) => (
        <p key={usr.id}>{usr.fullName}</p>
      ))}
    </div>
  );
}

Is there anyway I can reuse the name of the table? For example, const users?

Also, I'm new to Postgres and JS ORMs in general, coming from Entity Framework, is there a way to define the model/schema in singular terms and then the ORM rename the table to a plural form? I mean, my schema would be User and then in the database, it will be Users.

Thanks!
Was this page helpful?