| 1 | import { |
| 2 | boolean, |
| 3 | index, |
| 4 | int, |
| 5 | mysqlTable, |
| 6 | text, |
| 7 | timestamp, |
| 8 | varchar, |
| 9 | } from "drizzle-orm/mysql-core"; |
| 10 | import { servers } |
| 11 | |
| 12 | export const schedules = |
| 13 | "schedules", |
| 14 | { |
| 15 | id: varchar("id |
| 16 | serverId: varchar("server_id |
| 17 | .notNull() |
| 18 | .references(() => |
| 19 | name: varchar("name |
| 20 | cronSecond: varchar("cron_second |
| 21 | cronMinute: varchar("cron_minute |
| 22 | cronHour: varchar("cron_hour |
| 23 | cronDayOfWeek: varchar("cron_day_of_week |
| 24 | cronDayOfMonth: varchar("cron_day_of_month |
| 25 | isActive: boolean("is_active |
| 26 | isProcessing: boolean("is_processing |
| 27 | timezoneOffset: varchar("timezone_offset |
| 28 | lastRunAt: timestamp("last_run_at |
| 29 | nextRunAt: timestamp("next_run_at |
| 30 | createdAt: timestamp("created_at |
| 31 | updatedAt: timestamp("updated_at |
| 32 | .defaultNow() |
| 33 | .$onUpdate(() => |
| 34 | .notNull(), |
| 35 | }, |
| 36 | (table) => |
| 37 | ); |
| 38 | |
| 39 | export const scheduleTasks = |
| 40 | "schedule_tasks", |
| 41 | { |
| 42 | id: varchar("id |
| 43 | scheduleId: varchar("schedule_id |
| 44 | .notNull() |
| 45 | .references(() => |
| 46 | sequenceId: int("sequence_id |
| 47 | action: varchar("action |
| 48 | payload: text("payload |
| 49 | timeOffset: int("time_offset |
| 50 | isQueued: boolean("is_queued |
| 51 | continueOnFailure: boolean("continue_on_failure |
| 52 | createdAt: timestamp("created_at |
| 53 | updatedAt: timestamp("updated_at |
| 54 | .defaultNow() |
| 55 | .$onUpdate(() => |
| 56 | .notNull(), |
| 57 | }, |
| 58 | (table) => |
| 59 | ); |