2026-07-22 00:31:10 -04:00
|
|
|
import { mysqlTable, varchar, text, int, boolean, timestamp, json } from 'drizzle-orm/mysql-core'
|
|
|
|
|
|
2026-07-22 04:26:58 -04:00
|
|
|
export const users = mysqlTable('users', {
|
|
|
|
|
id: int('id').primaryKey().autoincrement(),
|
|
|
|
|
name: varchar('name', { length: 200 }),
|
|
|
|
|
email: varchar('email', { length: 255 }).notNull().unique(),
|
|
|
|
|
password: varchar('password', { length: 255 }).notNull(),
|
|
|
|
|
role: varchar('role', { length: 50 }).notNull().default('user'),
|
|
|
|
|
avatar: text('avatar'),
|
2026-07-23 11:00:05 -04:00
|
|
|
resetToken: varchar('reset_token', { length: 255 }),
|
|
|
|
|
resetTokenExpires: timestamp('reset_token_expires'),
|
2026-07-22 04:26:58 -04:00
|
|
|
active: boolean('active').notNull().default(true),
|
|
|
|
|
createdAt: timestamp('created_at').notNull().defaultNow(),
|
|
|
|
|
updatedAt: timestamp('updated_at').notNull().defaultNow().onUpdateNow(),
|
|
|
|
|
})
|
|
|
|
|
|
2026-07-22 00:31:10 -04:00
|
|
|
export const movies = mysqlTable('movies', {
|
|
|
|
|
id: int('id').primaryKey().autoincrement(),
|
|
|
|
|
source: varchar('source', { length: 50 }).notNull(),
|
|
|
|
|
slug: varchar('slug', { length: 500 }).notNull(),
|
|
|
|
|
name: varchar('name', { length: 500 }).notNull(),
|
|
|
|
|
originName: varchar('origin_name', { length: 500 }),
|
|
|
|
|
thumb: text('thumb'),
|
|
|
|
|
poster: text('poster'),
|
|
|
|
|
year: int('year'),
|
|
|
|
|
time: varchar('time', { length: 100 }),
|
|
|
|
|
episode: varchar('episode', { length: 100 }),
|
2026-07-23 02:56:24 -04:00
|
|
|
episodeTotal: varchar('episode_total', { length: 100 }),
|
2026-07-22 00:31:10 -04:00
|
|
|
quality: varchar('quality', { length: 50 }),
|
|
|
|
|
lang: varchar('lang', { length: 50 }),
|
|
|
|
|
type: varchar('type', { length: 50 }),
|
|
|
|
|
rating: int('rating'),
|
2026-07-22 11:43:14 -04:00
|
|
|
views: int('views').notNull().default(0),
|
2026-07-22 00:31:10 -04:00
|
|
|
content: text('content'),
|
|
|
|
|
categories: json('categories').$type<string[]>(),
|
|
|
|
|
countries: json('countries').$type<string[]>(),
|
|
|
|
|
sources: json('sources').$type<{ source: string, slug: string, name?: string }[]>(),
|
|
|
|
|
customPoster: text('custom_poster'),
|
|
|
|
|
customThumb: text('custom_thumb'),
|
|
|
|
|
customContent: text('custom_content'),
|
|
|
|
|
customEpisodes: json('custom_episodes').$type<{ name: string, linkEmbed?: string, linkM3u8?: string }[]>(),
|
|
|
|
|
active: boolean('active').notNull().default(false),
|
2026-07-22 04:26:58 -04:00
|
|
|
apiUpdatedAt: timestamp('api_updated_at'),
|
2026-07-22 00:31:10 -04:00
|
|
|
syncedAt: timestamp('synced_at').notNull().defaultNow(),
|
|
|
|
|
createdAt: timestamp('created_at').notNull().defaultNow(),
|
|
|
|
|
updatedAt: timestamp('updated_at').notNull().defaultNow().onUpdateNow(),
|
|
|
|
|
})
|
|
|
|
|
|
2026-07-22 04:26:58 -04:00
|
|
|
export type User = typeof users.$inferSelect
|
|
|
|
|
export type NewUser = typeof users.$inferInsert
|
2026-07-22 00:31:10 -04:00
|
|
|
export type Movie = typeof movies.$inferSelect
|
|
|
|
|
export type NewMovie = typeof movies.$inferInsert
|