import { pgTable, timestamp, varchar, boolean, serial, integer, text } from 'drizzle-orm/pg-core';
import { relations } from 'drizzle-orm';

// src/auth/legacy/schema/index.ts
var legacyUsers = pgTable("users", {
  id: serial("id").primaryKey(),
  phone: varchar("phone", { length: 20 }).notNull().unique(),
  password: varchar("password", { length: 255 }).notNull(),
  name: varchar("name", { length: 100 }),
  email: varchar("email", { length: 255 }),
  isActive: boolean("is_active").notNull().default(true),
  role: varchar("role", { length: 20 }).notNull().default("user"),
  lastLoginAt: timestamp("last_login_at"),
  createdAt: timestamp("created_at").defaultNow().notNull(),
  updatedAt: timestamp("updated_at").defaultNow().notNull()
});
var legacyUserSessions = pgTable("user_sessions", {
  id: serial("id").primaryKey(),
  userId: integer("user_id").notNull().references(() => legacyUsers.id, { onDelete: "cascade" }),
  sessionToken: varchar("session_token", { length: 255 }).notNull().unique(),
  expiresAt: timestamp("expires_at").notNull(),
  createdAt: timestamp("created_at").defaultNow().notNull()
});
var legacyVerificationCodes = pgTable("verification_codes", {
  id: serial("id").primaryKey(),
  phone: text("phone").notNull(),
  code: text("code").notNull(),
  expiresAt: timestamp("expires_at").notNull(),
  createdAt: timestamp("created_at").defaultNow().notNull(),
  used: boolean("used").default(false).notNull()
});
var legacyUsersRelations = relations(legacyUsers, ({ many }) => ({
  sessions: many(legacyUserSessions)
}));
var legacyUserSessionsRelations = relations(legacyUserSessions, ({ one }) => ({
  user: one(legacyUsers, {
    fields: [legacyUserSessions.userId],
    references: [legacyUsers.id]
  })
}));

export { legacyUserSessions, legacyUserSessionsRelations, legacyUsers, legacyUsersRelations, legacyVerificationCodes };
//# sourceMappingURL=index.mjs.map
//# sourceMappingURL=index.mjs.map