23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/tasku/database.rb', line 23
def self.migrate
db.create_table? :tasks do
primary_key :id
String :name, null: false
File :description
String :project
String :category
Date :start_day
Date :due_day
String :model_name
String :code
String :priority, default: "none"
String :status, default: "todo"
String :tags
Float :estimated_hours
DateTime :created_at, default: Sequel::CURRENT_TIMESTAMP
DateTime :updated_at, default: Sequel::CURRENT_TIMESTAMP
end
if db.table_exists?(:tasks) && !db.schema(:tasks).map(&:first).include?(:code)
db.alter_table(:tasks) { add_column :code, String }
end
end
|