问题描述
我想能够创建一个可以根据固定日期执行的日程表,每天重复,每周特定日期重复,每年特定月份重复,每年特定日期重复,并在一天的特定时间重复。
请问如何建立这个问题的数据库表?
编辑#1
基本上,我正在编写一个应用程序,允许用户安排预先配置的问候语,各种预配置时间。我知道我需要一个存储有关时间表的信息的表(例如圣诞节,营销一,...,以及计划运行时间)。然后另一张表来记录什么时间表已经运行,发送什么问候,给谁和什么电子邮件;基本上是一个交易表。
我的问题是设计Schedule表,因为我想允许用户在一个特定的日期(一周的特定日期)运行日程表每个月的特定日子,每天的特定时间,以及特定的日/月(25/12),每年。
如何我可以创建一组表,以便以灵活的方式处理这些输入吗?
这是表结构我想出了
计划
/ pre>
- ScheduleName
- ScheduleTypeId(每日,每周,每月,每年) ,具体)
- StartDate
- IntervalInDays
- 频率
- FrequencyCounter
ScheduleDaily
- ScheduleDailyId
- ScheduleId
- TimeOfDay
- StartDate
- EndDate
ScheduleMonthly
- ScheduleMonthlyId
- ScheduleId
- DayOfMonth
- StartDate
- EndDate
ScheduleSpecific
- ScheduleSpecificId
- ScheduleId
- SpecificDate
- StartDate
...
ScheduleJob
- ScheduleJobId
- ScheduleId
- ScheduleTypeId
- RunDate
- ScheduleStatusId
I want to be able to create schedules that can be executed based on a fixed date, repeated daily, repeated on a particular day of the week, repeated on a particular month of the year, repeated on a particular date every year, and repeated at a particular time of the day.
Please how do i go about building the database tables for this problem?
Edit #1
Basically, i'm writing an application that allows users to schedule pre-configured greetings to be sent at various pre-configured times. I know i need a table that stores information about a schedule (ex. Christmas, Marketing One, ... | and when the schedule should run). Then another table to record what schedule has ran, what greeting it sent, to who, and what email; basically a transactions table.
My problem is designing the Schedule table because, i want to allow users run the schedule at a specific date, on a particular day of the week (recurring), on a particular day of every month, on a particular time everyday, and on a particular day/month (ex. 25/12) every year.
How can i create a set of tables for schedule that will take care of these inputs in flexible way?
解决方案This is the table structure i came up with;
Schedule - ScheduleName - ScheduleTypeId (Daily, Weekly, Monthly, Yearly, Specific) - StartDate - IntervalInDays - Frequency - FrequencyCounter ScheduleDaily - ScheduleDailyId - ScheduleId - TimeOfDay - StartDate - EndDate ScheduleMonthly - ScheduleMonthlyId - ScheduleId - DayOfMonth - StartDate - EndDate ScheduleSpecific - ScheduleSpecificId - ScheduleId - SpecificDate - StartDate ... ScheduleJob - ScheduleJobId - ScheduleId - ScheduleTypeId - RunDate - ScheduleStatusId
这篇关于调度任务的数据库表设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!