bsag / tracks

Tracks is a GTD(TM) web application, built with Ruby on Rails

This URL has Read+Write access

tracks / db / migrate / 039_create_recurring_todos.rb
8bc41e2c » lrbalt 2008-07-19 add recurring todos to tracks 1 class CreateRecurringTodos < ActiveRecord::Migration
2 def self.up
3 create_table :recurring_todos do |t|
4 # todo data
5 t.column :user_id, :integer, :default => 1
6 t.column :context_id, :integer, :null => false
7 t.column :project_id, :integer
8 t.column :description, :string, :null => false
9 t.column :notes, :text
10 t.column :state, :string, :limit => 20, :default => "active", :null => false
11 # running time
12 t.column :start_from, :date
13 t.column :ends_on, :string # no_end_date, ends_on_number_of_times, ends_on_end_date
14 t.column :end_date, :date # end_date should be null when
15 # number_of_occurrences is not null
16 t.column :number_of_occurences, :integer
17 t.column :occurences_count, :integer, :default => 0 # current count
18 # target
19 t.column :target, :string # 'due_date' or 'show_from'
20 t.column :show_from_delta, :integer # number of days before due date
21 # recurring parameters
22 t.column :recurring_period, :string # daily, monthly, yearly
23 t.column :recurrence_selector, :integer # which recurrence is selected
24 t.column :every_other1, :integer # every 1 day, every 2nd week,
25 # every day 12 of the month
26 t.column :every_other2, :integer # for month: every 12th of
27 # every 2 (other) month and
28 # year: every 12th of 3 (march)
29 t.column :every_other3, :integer # for months and years
30 t.column :every_day, :string # for weekly: 'smtwtfs' for
31 # every week on all days or
32 # ' m w f ' for every week on
33 # every other day
34 t.column :only_work_days, :boolean, :default => false # for daily
35 t.column :every_count, :integer # monthly and yearly to describe
36 # the second monday of a month
37 t.column :weekday, :integer # monthly and yearly to describe
38 # day of week for every second
39 # saturday of the month
40 t.column :completed_at, :datetime
41 t.timestamps
42 end
43
44 add_column :todos, :recurring_todo_id, :integer
45
46 end
47
48 def self.down
49 remove_column :todos, :recurring_todo_id
50 drop_table :recurring_todos
51 end
52 end