mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-23 17:26:11 +01:00
Removed superfluous 'tracks' directory at the root of the repository.
Testing commits to github.
This commit is contained in:
parent
6a42901514
commit
4cbf5a34d3
2269 changed files with 0 additions and 0 deletions
41
db/migrate/001_create_tracks_db.rb
Normal file
41
db/migrate/001_create_tracks_db.rb
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# Verision 1.0.3 database
|
||||
class CreateTracksDb < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :contexts do |t|
|
||||
t.column :name, :string, :null => false
|
||||
t.column :position, :integer, :null => false
|
||||
t.column :hide, :boolean, :default => false
|
||||
end
|
||||
|
||||
create_table :projects do |t|
|
||||
t.column :name, :string, :null => false
|
||||
t.column :position, :integer, :null => false
|
||||
t.column :done, :boolean, :default => false
|
||||
end
|
||||
|
||||
create_table :todos do |t|
|
||||
t.column :context_id, :integer, :null => false
|
||||
t.column :project_id, :integer
|
||||
t.column :description, :string, :null => false
|
||||
t.column :notes, :text
|
||||
t.column :done, :boolean, :default => false, :null => false
|
||||
t.column :created, :datetime
|
||||
t.column :due, :date
|
||||
t.column :completed, :datetime
|
||||
end
|
||||
|
||||
create_table :users do |t|
|
||||
t.column :login, :string, :limit => 80, :null => false
|
||||
t.column :password, :string, :limit => 40, :null => false
|
||||
t.column :word, :string
|
||||
t.column :is_admin, :boolean, :default => false, :null => false
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :contexts
|
||||
drop_table :projects
|
||||
drop_table :todos
|
||||
drop_table :users
|
||||
end
|
||||
end
|
||||
21
db/migrate/002_add_user_id.rb
Normal file
21
db/migrate/002_add_user_id.rb
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
class AddUserId < ActiveRecord::Migration
|
||||
|
||||
class Project < ActiveRecord::Base; end
|
||||
class Context < ActiveRecord::Base; end
|
||||
class Todo < ActiveRecord::Base; end
|
||||
|
||||
def self.up
|
||||
add_column :contexts, :user_id, :integer, :default => 1
|
||||
add_column :projects, :user_id, :integer, :default => 1
|
||||
add_column :todos, :user_id, :integer, :default => 1
|
||||
Context.find(:all).each { |context| context.user_id = 1 }
|
||||
Project.find(:all).each { |project| project.user_id = 1 }
|
||||
Todo.find(:all).each { |todo| todo.user_id = 1 }
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :contexts, :user_id
|
||||
remove_column :projects, :user_id
|
||||
remove_column :todos, :user_id
|
||||
end
|
||||
end
|
||||
12
db/migrate/003_created_at.rb
Normal file
12
db/migrate/003_created_at.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
class CreatedAt < ActiveRecord::Migration
|
||||
# Current bug in Rails that prevents rename_column working in SQLite
|
||||
# if the column names use symbols instead of strings.
|
||||
# <http://dev.rubyonrails.org/changeset/2731>
|
||||
def self.up
|
||||
rename_column :todos, 'created', 'created_at'
|
||||
end
|
||||
|
||||
def self.down
|
||||
rename_column :todos, 'created_at', 'created'
|
||||
end
|
||||
end
|
||||
15
db/migrate/004_notes.rb
Normal file
15
db/migrate/004_notes.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
class Notes < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :notes do |t|
|
||||
t.column :user_id, :integer, :null => false
|
||||
t.column :project_id, :integer, :null => false
|
||||
t.column :body, :text
|
||||
t.column :created_at, :datetime
|
||||
t.column :updated_at, :datetime
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :notes
|
||||
end
|
||||
end
|
||||
9
db/migrate/005_add_project_description.rb
Normal file
9
db/migrate/005_add_project_description.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class AddProjectDescription < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :projects, :description, :text
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :projects, :description
|
||||
end
|
||||
end
|
||||
17
db/migrate/006_add_preferences_to_user_table.rb
Normal file
17
db/migrate/006_add_preferences_to_user_table.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class AddPreferencesToUserTable < ActiveRecord::Migration
|
||||
|
||||
class User < ActiveRecord::Base; end
|
||||
|
||||
def self.up
|
||||
add_column :users, :preferences, :text
|
||||
@users = User.find(:all)
|
||||
@users.each do |u|
|
||||
u.preferences = { "date_format" => "%d/%m/%Y", "week_starts" => "1", "no_completed" => "5", "staleness_starts" => "7", "due_style" => "1", "admin_email" => "butshesagirl@rousette.org.uk"}
|
||||
u.save
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :users, :preferences
|
||||
end
|
||||
end
|
||||
15
db/migrate/007_add_sessions_table.rb
Normal file
15
db/migrate/007_add_sessions_table.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
class AddSessionsTable < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :sessions do |t|
|
||||
t.column :session_id, :string
|
||||
t.column :data, :text
|
||||
t.column :updated_at, :datetime
|
||||
end
|
||||
|
||||
add_index :sessions, :session_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :sessions
|
||||
end
|
||||
end
|
||||
16
db/migrate/008_add_subclass_attr_to_todos.rb
Normal file
16
db/migrate/008_add_subclass_attr_to_todos.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
class AddSubclassAttrToTodos < ActiveRecord::Migration
|
||||
|
||||
class Todo < ActiveRecord::Base; end
|
||||
class Immediate < Todo; end
|
||||
|
||||
def self.up
|
||||
add_column :todos, :type, :string, :null => false, :default => "Immediate"
|
||||
add_column :todos, :show_from, :date
|
||||
Todo.find(:all).each { |todo| todo.type = "Immediate" }
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :todos, :type
|
||||
remove_column :todos, :show_from
|
||||
end
|
||||
end
|
||||
15
db/migrate/009_add_user_pref_refresh.rb
Normal file
15
db/migrate/009_add_user_pref_refresh.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
class AddUserPrefRefresh < ActiveRecord::Migration
|
||||
|
||||
class User < ActiveRecord::Base; serialize :preferences; end
|
||||
|
||||
def self.up
|
||||
@users = User.find(:all)
|
||||
@users.each do |user|
|
||||
user.preferences.merge!({"refresh" => "0"})
|
||||
user.save
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
end
|
||||
end
|
||||
11
db/migrate/010_add_first_and_last_name_to_user.rb
Normal file
11
db/migrate/010_add_first_and_last_name_to_user.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class AddFirstAndLastNameToUser < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :users, :first_name, :string
|
||||
add_column :users, :last_name, :string
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :users, :first_name
|
||||
remove_column :users, :last_name
|
||||
end
|
||||
end
|
||||
22
db/migrate/011_pref_to_show_hide_sidebar_items.rb
Normal file
22
db/migrate/011_pref_to_show_hide_sidebar_items.rb
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
class PrefToShowHideSidebarItems < ActiveRecord::Migration
|
||||
|
||||
class User < ActiveRecord::Base; serialize :preferences; end
|
||||
|
||||
def self.up
|
||||
@users = User.find(:all)
|
||||
@users.each do |user|
|
||||
user.preferences.merge!({"show_completed_projects_in_sidebar" => true})
|
||||
user.preferences.merge!({"show_hidden_contexts_in_sidebar" => true})
|
||||
user.save
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
@users = User.find(:all)
|
||||
@users.each do |user|
|
||||
user.preferences.delete("show_completed_projects_in_sidebar")
|
||||
user.preferences.delete("show_hidden_contexts_in_sidebar")
|
||||
user.save
|
||||
end
|
||||
end
|
||||
end
|
||||
23
db/migrate/012_add_preferences_model.rb
Normal file
23
db/migrate/012_add_preferences_model.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
class AddPreferencesModel < ActiveRecord::Migration
|
||||
|
||||
class User < ActiveRecord::Base; serialize :preferences; end
|
||||
|
||||
def self.up
|
||||
create_table :preferences do |t|
|
||||
t.column :user_id, :integer, :null => false
|
||||
t.column :date_format, :string, :limit => 40, :null => false, :default => '%d/%m/%Y'
|
||||
t.column :week_starts, :integer, :null => false, :default => 0
|
||||
t.column :show_number_completed, :integer, :null => false, :default => 5
|
||||
t.column :staleness_starts, :integer, :null => false, :default => 7
|
||||
t.column :show_completed_projects_in_sidebar, :boolean, :default => true, :null => false
|
||||
t.column :show_hidden_contexts_in_sidebar, :boolean, :default => true, :null => false
|
||||
t.column :due_style, :integer, :null => false, :default => 0
|
||||
t.column :admin_email, :string, :limit => 255, :null => false, :default => 'butshesagirl@rousette.org.uk'
|
||||
t.column :refresh, :integer, :null => false, :default => 0
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :preferences
|
||||
end
|
||||
end
|
||||
45
db/migrate/013_convert_preferences.rb
Normal file
45
db/migrate/013_convert_preferences.rb
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
class ConvertPreferences < ActiveRecord::Migration
|
||||
|
||||
class User < ActiveRecord::Base; has_one :preference; serialize :preferences; end
|
||||
|
||||
def self.up
|
||||
@users = User.find(:all)
|
||||
@users.each do |user|
|
||||
user.create_preference
|
||||
user.preference.date_format = user.preferences['date_format']
|
||||
user.preference.week_starts = user.preferences['week_starts']
|
||||
user.preference.show_number_completed = user.preferences['no_completed']
|
||||
user.preference.staleness_starts = user.preferences['staleness_starts']
|
||||
user.preference.show_completed_projects_in_sidebar = user.preferences['show_completed_projects_in_sidebar']
|
||||
user.preference.show_hidden_contexts_in_sidebar = user.preferences['show_hidden_contexts_in_sidebar']
|
||||
user.preference.due_style = user.preferences['due_style']
|
||||
user.preference.admin_email = user.preferences['admin_email']
|
||||
user.preference.refresh = user.preferences['refresh']
|
||||
|
||||
if user.preference.refresh.blank?
|
||||
user.preference.refresh = 0
|
||||
end
|
||||
|
||||
user.preference.save!
|
||||
end
|
||||
remove_column :users, :preferences
|
||||
end
|
||||
|
||||
def self.down
|
||||
add_column :users, :preferences, :text
|
||||
@users = User.find(:all)
|
||||
@users.each do |user|
|
||||
user.preferences = { "date_format" => "#{user.preference.date_format}",
|
||||
"week_starts" => "#{user.preference.week_starts}",
|
||||
"no_completed" => "#{user.preference.show_number_completed}",
|
||||
"staleness_starts" => "#{user.preference.staleness_starts}",
|
||||
"show_completed_projects_in_sidebar" => "#{user.preference.show_completed_projects_in_sidebar}",
|
||||
"show_hidden_contexts_in_sidebar" => "#{user.preference.show_hidden_contexts_in_sidebar}",
|
||||
"due_style" => "#{user.preference.due_style}",
|
||||
"admin_email" => "#{user.preference.admin_email}",
|
||||
"refresh" => "#{user.preference.refresh}"
|
||||
}
|
||||
user.save
|
||||
end
|
||||
end
|
||||
end
|
||||
24
db/migrate/014_convert_project_to_state_machine.rb
Normal file
24
db/migrate/014_convert_project_to_state_machine.rb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
class ConvertProjectToStateMachine < ActiveRecord::Migration
|
||||
|
||||
class Project < ActiveRecord::Base; end
|
||||
|
||||
def self.up
|
||||
add_column :projects, :state, :string, :limit => 20, :default => "active", :null => false
|
||||
@projects = Project.find(:all)
|
||||
@projects.each do |project|
|
||||
project.state = project.done? ? 'completed' : 'active'
|
||||
project.save
|
||||
end
|
||||
remove_column :projects, :done
|
||||
end
|
||||
|
||||
def self.down
|
||||
add_column :projects, :done, :integer, :limit => 4, :default => 0, :null => false
|
||||
@projects = Project.find(:all)
|
||||
@projects.each do |project|
|
||||
project.done = project.state == 'completed'
|
||||
project.save
|
||||
end
|
||||
remove_column :projects, :state
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
class AddVerboseActionDescriptorsPreference < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :preferences, :verbose_action_descriptors, :boolean, :default => false, :null => false
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :preferences, :verbose_action_descriptors
|
||||
end
|
||||
end
|
||||
9
db/migrate/016_add_user_auth_type.rb
Normal file
9
db/migrate/016_add_user_auth_type.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class AddUserAuthType < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :users, :auth_type, :string, :default => 'database', :null => false
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :users, :auth_type
|
||||
end
|
||||
end
|
||||
45
db/migrate/017_add_open_id_tables.rb
Normal file
45
db/migrate/017_add_open_id_tables.rb
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
class AddOpenIdTables < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table "open_id_associations", :force => true do |t|
|
||||
t.column "server_url", :binary
|
||||
t.column "handle", :string
|
||||
t.column "secret", :binary
|
||||
t.column "issued", :integer
|
||||
t.column "lifetime", :integer
|
||||
t.column "assoc_type", :string
|
||||
end
|
||||
|
||||
create_table "open_id_nonces", :force => true do |t|
|
||||
t.column "nonce", :string
|
||||
t.column "created", :integer
|
||||
end
|
||||
|
||||
create_table "open_id_settings", :force => true do |t|
|
||||
t.column "setting", :string
|
||||
t.column "value", :binary
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table "open_id_associations"
|
||||
drop_table "open_id_nonces"
|
||||
drop_table "open_id_settings"
|
||||
end
|
||||
end
|
||||
9
db/migrate/018_add_user_open_id_url.rb
Normal file
9
db/migrate/018_add_user_open_id_url.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class AddUserOpenIdUrl < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :users, :open_id_url, :string
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :users, :open_id_url
|
||||
end
|
||||
end
|
||||
40
db/migrate/019_convert_todo_to_state_machine.rb
Normal file
40
db/migrate/019_convert_todo_to_state_machine.rb
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
class ConvertTodoToStateMachine < ActiveRecord::Migration
|
||||
|
||||
class Todo < ActiveRecord::Base; belongs_to :project; end
|
||||
class Immediate < Todo; end
|
||||
class Deferred < Todo; end
|
||||
class Project < ActiveRecord::Base; end
|
||||
|
||||
def self.up
|
||||
add_column :todos, :state, :string, :limit => 20, :default => "immediate", :null => false
|
||||
@todos = Todo.find(:all)
|
||||
@todos.each do |todo|
|
||||
if todo.done?
|
||||
todo.state = 'completed'
|
||||
elsif todo.type == 'Deferred'
|
||||
todo.state = 'deferred'
|
||||
elsif !todo.project.nil? && todo.project.state == 'hidden'
|
||||
todo.state = 'project_hidden'
|
||||
else
|
||||
todo.state = 'active'
|
||||
end
|
||||
todo.save
|
||||
end
|
||||
rename_column :todos, 'completed', 'completed_at' #bug in sqlite requires column names as strings
|
||||
remove_column :todos, :done
|
||||
remove_column :todos, :type
|
||||
end
|
||||
|
||||
def self.down
|
||||
add_column :todos, :done, :integer, :limit => 4, :default => 0, :null => false
|
||||
add_column :todos, :type, :string, :default => "Immediate", :null => false
|
||||
rename_column :todos, 'completed_at', 'completed' #bug in sqlite requires column names as strings
|
||||
@todos = Todo.find(:all)
|
||||
@todos.each do |todo|
|
||||
todo.done = todo.state == 'completed'
|
||||
todo.type = todo.type == 'deferred' ? 'Deferred' : 'Immediate'
|
||||
todo.save
|
||||
end
|
||||
remove_column :todos, :state
|
||||
end
|
||||
end
|
||||
11
db/migrate/020_pref_to_show_hidden_projects_in_sidebar.rb
Normal file
11
db/migrate/020_pref_to_show_hidden_projects_in_sidebar.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class PrefToShowHiddenProjectsInSidebar < ActiveRecord::Migration
|
||||
|
||||
def self.up
|
||||
add_column :preferences, :show_hidden_projects_in_sidebar, :boolean, :default => true, :null => false
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :preferences, :show_hidden_projects_in_sidebar
|
||||
end
|
||||
|
||||
end
|
||||
11
db/migrate/021_add_time_zone_preference.rb
Normal file
11
db/migrate/021_add_time_zone_preference.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class AddTimeZonePreference < ActiveRecord::Migration
|
||||
|
||||
def self.up
|
||||
add_column :preferences, :time_zone, :string, :limit => 255, :default => 'London', :null => false
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :preferences, :time_zone
|
||||
end
|
||||
|
||||
end
|
||||
23
db/migrate/022_add_indices.rb
Normal file
23
db/migrate/022_add_indices.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
class AddIndices < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :todos, [:user_id, :state]
|
||||
add_index :todos, [:user_id, :project_id]
|
||||
add_index :todos, [:project_id]
|
||||
add_index :todos, [:context_id]
|
||||
add_index :todos, [:user_id, :context_id]
|
||||
add_index :preferences, :user_id
|
||||
add_index :projects, :user_id
|
||||
add_index :contexts, :user_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :contexts, :user_id
|
||||
remove_index :projects, :user_id
|
||||
remove_index :preferences, :user_id
|
||||
remove_index :todos, [:user_id, :context_id]
|
||||
remove_index :todos, [:project_id]
|
||||
remove_index :todos, [:context_id]
|
||||
remove_index :todos, [:user_id, :project_id]
|
||||
remove_index :todos, [:user_id, :state]
|
||||
end
|
||||
end
|
||||
9
db/migrate/023_index_on_user_login.rb
Normal file
9
db/migrate/023_index_on_user_login.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class IndexOnUserLogin < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :users, :login
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :users, :login
|
||||
end
|
||||
end
|
||||
11
db/migrate/024_add_find_by_name_indices.rb
Normal file
11
db/migrate/024_add_find_by_name_indices.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class AddFindByNameIndices < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :projects, [:user_id, :name]
|
||||
add_index :contexts, [:user_id, :name]
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :projects, [:user_id, :name]
|
||||
remove_index :contexts, [:user_id, :name]
|
||||
end
|
||||
end
|
||||
23
db/migrate/025_add_tag_support.rb
Normal file
23
db/migrate/025_add_tag_support.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
class AddTagSupport < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :taggings do |t|
|
||||
t.column :taggable_id, :integer
|
||||
t.column :tag_id, :integer
|
||||
t.column :taggable_type, :string
|
||||
t.column :user_id, :integer
|
||||
end
|
||||
create_table :tags do |t|
|
||||
t.column :name, :string
|
||||
t.column :created_at, :datetime
|
||||
t.column :updated_at, :datetime
|
||||
end
|
||||
|
||||
add_index :tags, :name
|
||||
add_index :taggings, [:tag_id, :taggable_id, :taggable_type]
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :taggings
|
||||
drop_table :tags
|
||||
end
|
||||
end
|
||||
12
db/migrate/026_add_project_timestamps.rb
Normal file
12
db/migrate/026_add_project_timestamps.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
class AddProjectTimestamps < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :projects, :created_at, :timestamp
|
||||
add_column :projects, :updated_at, :timestamp
|
||||
end
|
||||
|
||||
|
||||
def self.down
|
||||
remove_column :projects, :created_at
|
||||
remove_column :projects, :updated_at
|
||||
end
|
||||
end
|
||||
13
db/migrate/027_add_context_timestamps.rb
Normal file
13
db/migrate/027_add_context_timestamps.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class AddContextTimestamps < ActiveRecord::Migration
|
||||
|
||||
def self.up
|
||||
add_column :contexts, :created_at, :timestamp
|
||||
add_column :contexts, :updated_at, :timestamp
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :contexts, :created_at
|
||||
remove_column :contexts, :updated_at
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
class AddShowProjectOnTodoDonePreference < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :preferences, :show_project_on_todo_done, :boolean, :default => false, :null => false
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :preferences, :show_project_on_todo_done
|
||||
end
|
||||
end
|
||||
9
db/migrate/029_add_title_date_format_preference.rb
Normal file
9
db/migrate/029_add_title_date_format_preference.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class AddTitleDateFormatPreference < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :preferences, :title_date_format, :string, :limit => 255, :default => '%A, %d %B %Y', :null => false
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :preferences, :title_date_format
|
||||
end
|
||||
end
|
||||
25
db/migrate/030_set_nil_timestamps.rb
Normal file
25
db/migrate/030_set_nil_timestamps.rb
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
class SetNilTimestamps < ActiveRecord::Migration
|
||||
|
||||
class Project < ActiveRecord::Base; end
|
||||
class Context < ActiveRecord::Base; end
|
||||
|
||||
def self.up
|
||||
Project.find_all_by_created_at(nil).each do |p|
|
||||
Project.update( p.id, {:created_at => Time.now.utc} )
|
||||
end
|
||||
Project.find_all_by_updated_at(nil).each do |p|
|
||||
Project.update( p.id, {:updated_at => Time.now.utc} )
|
||||
end
|
||||
Context.find_all_by_created_at(nil).each do |p|
|
||||
Context.update( p.id, {:created_at => Time.now.utc} )
|
||||
end
|
||||
Context.find_all_by_updated_at(nil).each do |p|
|
||||
Context.update( p.id, {:updated_at => Time.now.utc} )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def self.down
|
||||
#nothing to do here...
|
||||
end
|
||||
end
|
||||
9
db/migrate/031_add_default_context_to_project.rb
Normal file
9
db/migrate/031_add_default_context_to_project.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class AddDefaultContextToProject < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :projects, :default_context_id, :integer
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :projects, :default_context_id
|
||||
end
|
||||
end
|
||||
9
db/migrate/032_add_mobile_todos_per_page_preference.rb
Normal file
9
db/migrate/032_add_mobile_todos_per_page_preference.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class AddMobileTodosPerPagePreference < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :preferences, :mobile_todos_per_page, :integer, :null => false, :default => 6
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :preferences, :mobile_todos_per_page
|
||||
end
|
||||
end
|
||||
13
db/migrate/033_add_remember_me_to_user.rb
Normal file
13
db/migrate/033_add_remember_me_to_user.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class AddRememberMeToUser < ActiveRecord::Migration
|
||||
def self.up
|
||||
rename_column :users, 'password', 'crypted_password' #bug in sqlite requires column names as strings
|
||||
add_column :users, :remember_token, :string
|
||||
add_column :users, :remember_token_expires_at, :datetime
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :users, :remember_token
|
||||
remove_column :users, :remember_token_expires_at
|
||||
rename_column :users, 'crypted_password', 'password' #bug in sqlite requires column names as strings
|
||||
end
|
||||
end
|
||||
9
db/migrate/034_rename_word_to_token.rb
Normal file
9
db/migrate/034_rename_word_to_token.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class RenameWordToToken < ActiveRecord::Migration
|
||||
def self.up
|
||||
rename_column :users, 'word', 'token' #bug in sqlite requires column names as strings
|
||||
end
|
||||
|
||||
def self.down
|
||||
rename_column :users, 'token', 'word' #bug in sqlite requires column names as strings
|
||||
end
|
||||
end
|
||||
29
db/migrate/035_update_open_id_urls.rb
Normal file
29
db/migrate/035_update_open_id_urls.rb
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
class UpdateOpenIdUrls < ActiveRecord::Migration
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
|
||||
def normalize_open_id_url
|
||||
return if open_id_url.nil?
|
||||
self.open_id_url = self.class.normalize_open_id_url(open_id_url)
|
||||
end
|
||||
|
||||
def self.normalize_open_id_url(raw_open_id_url)
|
||||
normalized = raw_open_id_url
|
||||
normalized = "http://#{raw_open_id_url}" unless raw_open_id_url =~ /\:\/\//
|
||||
normalized.downcase.chomp('/')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def self.up
|
||||
User.find(:all).each do |user|
|
||||
original = user.open_id_url
|
||||
user.normalize_open_id_url
|
||||
say "#{original} -> #{user.open_id_url}"
|
||||
user.save! unless user.open_id_url == original
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
end
|
||||
end
|
||||
17
db/migrate/036_add_project_completed_at_column.rb
Normal file
17
db/migrate/036_add_project_completed_at_column.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class AddProjectCompletedAtColumn < ActiveRecord::Migration
|
||||
|
||||
class Project < ActiveRecord::Base; end
|
||||
|
||||
def self.up
|
||||
add_column :projects, :completed_at, :datetime
|
||||
@projects = Project.find(:all)
|
||||
@projects.select{ |project| project.state == 'completed'}.each do |project|
|
||||
project.completed_at = project.updated_at
|
||||
project.save
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :projects, :completed_at
|
||||
end
|
||||
end
|
||||
11
db/migrate/037_add_index_to_notes.rb
Normal file
11
db/migrate/037_add_index_to_notes.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class AddIndexToNotes < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :notes, [:project_id]
|
||||
add_index :notes, [:user_id]
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :notes, [:user_id]
|
||||
remove_index :notes, [:project_id]
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
class ProjectsContextsRemoveNotNullFromPosition < ActiveRecord::Migration
|
||||
def self.up
|
||||
change_column :projects, :position, :integer, {:null => true, :default => nil}
|
||||
change_column :contexts, :position, :integer, {:null => true, :default => nil}
|
||||
end
|
||||
|
||||
def self.down
|
||||
@projects = Project.find(:all)
|
||||
@projects.each do |project|
|
||||
project.position = 0 if !project.position?
|
||||
project.save
|
||||
end
|
||||
change_column :projects, :position, :integer, {:null => false, :default => nil}
|
||||
|
||||
@contexts = Context.find(:all)
|
||||
@contexts.each do |context|
|
||||
context.position = 0 if !context.position?
|
||||
context.save
|
||||
end
|
||||
change_column :contexts, :position, :integer, {:null => false, :default => nil}
|
||||
end
|
||||
end
|
||||
151
db/schema.rb
Normal file
151
db/schema.rb
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
# This file is auto-generated from the current state of the database. Instead of editing this file,
|
||||
# please use the migrations feature of ActiveRecord to incrementally modify your database, and
|
||||
# then regenerate this schema definition.
|
||||
#
|
||||
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
|
||||
# to create the application database on another system, you should be using db:schema:load, not running
|
||||
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
||||
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 38) do
|
||||
|
||||
create_table "contexts", :force => true do |t|
|
||||
t.string "name", :default => "", :null => false
|
||||
t.integer "position"
|
||||
t.boolean "hide", :default => false
|
||||
t.integer "user_id", :default => 1
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "contexts", ["user_id"], :name => "index_contexts_on_user_id"
|
||||
add_index "contexts", ["user_id", "name"], :name => "index_contexts_on_user_id_and_name"
|
||||
|
||||
create_table "notes", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
t.integer "project_id", :null => false
|
||||
t.text "body"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "notes", ["project_id"], :name => "index_notes_on_project_id"
|
||||
add_index "notes", ["user_id"], :name => "index_notes_on_user_id"
|
||||
|
||||
create_table "open_id_associations", :force => true do |t|
|
||||
t.binary "server_url"
|
||||
t.string "handle"
|
||||
t.binary "secret"
|
||||
t.integer "issued"
|
||||
t.integer "lifetime"
|
||||
t.string "assoc_type"
|
||||
end
|
||||
|
||||
create_table "open_id_nonces", :force => true do |t|
|
||||
t.string "nonce"
|
||||
t.integer "created"
|
||||
end
|
||||
|
||||
create_table "open_id_settings", :force => true do |t|
|
||||
t.string "setting"
|
||||
t.binary "value"
|
||||
end
|
||||
|
||||
create_table "preferences", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
t.string "date_format", :limit => 40, :default => "%d/%m/%Y", :null => false
|
||||
t.integer "week_starts", :default => 0, :null => false
|
||||
t.integer "show_number_completed", :default => 5, :null => false
|
||||
t.integer "staleness_starts", :default => 7, :null => false
|
||||
t.boolean "show_completed_projects_in_sidebar", :default => true, :null => false
|
||||
t.boolean "show_hidden_contexts_in_sidebar", :default => true, :null => false
|
||||
t.integer "due_style", :default => 0, :null => false
|
||||
t.string "admin_email", :default => "butshesagirl@rousette.org.uk", :null => false
|
||||
t.integer "refresh", :default => 0, :null => false
|
||||
t.boolean "verbose_action_descriptors", :default => false, :null => false
|
||||
t.boolean "show_hidden_projects_in_sidebar", :default => true, :null => false
|
||||
t.string "time_zone", :default => "London", :null => false
|
||||
t.boolean "show_project_on_todo_done", :default => false, :null => false
|
||||
t.string "title_date_format", :default => "%A, %d %B %Y", :null => false
|
||||
t.integer "mobile_todos_per_page", :default => 6, :null => false
|
||||
end
|
||||
|
||||
add_index "preferences", ["user_id"], :name => "index_preferences_on_user_id"
|
||||
|
||||
create_table "projects", :force => true do |t|
|
||||
t.string "name", :default => "", :null => false
|
||||
t.integer "position"
|
||||
t.integer "user_id", :default => 1
|
||||
t.text "description"
|
||||
t.string "state", :limit => 20, :default => "active", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "default_context_id"
|
||||
t.datetime "completed_at"
|
||||
end
|
||||
|
||||
add_index "projects", ["user_id"], :name => "index_projects_on_user_id"
|
||||
add_index "projects", ["user_id", "name"], :name => "index_projects_on_user_id_and_name"
|
||||
|
||||
create_table "sessions", :force => true do |t|
|
||||
t.string "session_id"
|
||||
t.text "data"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
|
||||
|
||||
create_table "taggings", :force => true do |t|
|
||||
t.integer "taggable_id"
|
||||
t.integer "tag_id"
|
||||
t.string "taggable_type"
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
add_index "taggings", ["tag_id", "taggable_id", "taggable_type"], :name => "index_taggings_on_tag_id_and_taggable_id_and_taggable_type"
|
||||
|
||||
create_table "tags", :force => true do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "tags", ["name"], :name => "index_tags_on_name"
|
||||
|
||||
create_table "todos", :force => true do |t|
|
||||
t.integer "context_id", :null => false
|
||||
t.integer "project_id"
|
||||
t.string "description", :default => "", :null => false
|
||||
t.text "notes"
|
||||
t.datetime "created_at"
|
||||
t.date "due"
|
||||
t.datetime "completed_at"
|
||||
t.integer "user_id", :default => 1
|
||||
t.date "show_from"
|
||||
t.string "state", :limit => 20, :default => "immediate", :null => false
|
||||
end
|
||||
|
||||
add_index "todos", ["user_id", "state"], :name => "index_todos_on_user_id_and_state"
|
||||
add_index "todos", ["user_id", "project_id"], :name => "index_todos_on_user_id_and_project_id"
|
||||
add_index "todos", ["project_id"], :name => "index_todos_on_project_id"
|
||||
add_index "todos", ["context_id"], :name => "index_todos_on_context_id"
|
||||
add_index "todos", ["user_id", "context_id"], :name => "index_todos_on_user_id_and_context_id"
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "login", :limit => 80, :default => "", :null => false
|
||||
t.string "crypted_password", :limit => 40
|
||||
t.string "token"
|
||||
t.boolean "is_admin", :default => false, :null => false
|
||||
t.string "first_name"
|
||||
t.string "last_name"
|
||||
t.string "auth_type", :default => "database", :null => false
|
||||
t.string "open_id_url"
|
||||
t.string "remember_token"
|
||||
t.datetime "remember_token_expires_at"
|
||||
end
|
||||
|
||||
add_index "users", ["login"], :name => "index_users_on_login"
|
||||
|
||||
end
|
||||
BIN
db/tracks-15-blank.db
Normal file
BIN
db/tracks-15-blank.db
Normal file
Binary file not shown.
BIN
db/tracks-15-example.db
Normal file
BIN
db/tracks-15-example.db
Normal file
Binary file not shown.
57
db/tracks_1.5_content.sql
Normal file
57
db/tracks_1.5_content.sql
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
-- Dump of table contents
|
||||
-- Sample data to populate your database
|
||||
-- No data is included for users: create your own users via the http://YOURURL/signup page
|
||||
|
||||
-- Dump of table contexts
|
||||
-- ------------------------------------------------------------
|
||||
|
||||
INSERT INTO "contexts" VALUES(1,'agenda',1,'f',1,'2008-02-25 20:21:09','2008-02-25 20:21:09');
|
||||
INSERT INTO "contexts" VALUES(2,'call',2,'f',1,'2008-02-25 20:21:09','2008-02-25 20:21:09');
|
||||
INSERT INTO "contexts" VALUES(3,'email',3,'f',1,'2008-02-25 20:21:09','2008-02-25 20:21:09');
|
||||
INSERT INTO "contexts" VALUES(4,'errand',4,'f',1,'2008-02-25 20:21:09','2008-02-25 20:21:09');
|
||||
INSERT INTO "contexts" VALUES(5,'lab',5,'f',1,'2008-02-25 20:21:09','2008-02-25 20:21:09');
|
||||
INSERT INTO "contexts" VALUES(6,'library',6,'f',1,'2008-02-25 20:21:09','2008-02-25 20:21:09');
|
||||
INSERT INTO "contexts" VALUES(7,'freetime',7,'f',1,'2008-02-25 20:21:09','2008-02-25 20:21:09');
|
||||
INSERT INTO "contexts" VALUES(8,'office',8,'f',1,'2008-02-25 20:21:09','2008-02-25 20:21:09');
|
||||
INSERT INTO "contexts" VALUES(9,'waiting for',9,'f',1,'2008-02-25 20:21:09','2008-02-25 20:21:09');
|
||||
|
||||
-- Dump of table notes
|
||||
-- ------------------------------------------------------------
|
||||
|
||||
INSERT INTO "notes" VALUES(1,1,1,'Need to collect a catalogue from Time Machines R Us','2006-06-10 14:36:02','2006-06-10 14:36:02');
|
||||
INSERT INTO "notes" VALUES(2,1,1,'Should I go for a swirly effect or a whooshy one?','2006-06-10 14:36:02','2006-06-10 14:36:02');
|
||||
|
||||
|
||||
-- Dump of table projects
|
||||
-- ------------------------------------------------------------
|
||||
|
||||
INSERT INTO "projects" VALUES(1,'Build a working time machine',1,1,'','active','2008-02-25 20:21:09','2008-02-25 20:21:09',NULL,NULL);
|
||||
INSERT INTO "projects" VALUES(2,'Make more money than Billy Gates',2,1,'','active','2008-02-25 20:21:09','2008-02-25 20:21:09',NULL,NULL);
|
||||
INSERT INTO "projects" VALUES(3,'Evict dinosaurs from the garden',3,1,'','active','2008-02-25 20:21:09','2008-02-25 20:21:09',NULL,NULL);
|
||||
|
||||
|
||||
-- Dump of table schema_info
|
||||
-- ------------------------------------------------------------
|
||||
|
||||
INSERT INTO "schema_info" VALUES(37);
|
||||
|
||||
|
||||
-- Dump of table todos
|
||||
-- ------------------------------------------------------------
|
||||
|
||||
INSERT INTO "todos" VALUES(1,1,2,'Call Bill Gates to find out how much he makes per day',NULL,'2006-06-03 14:36:02','2006-06-24',NULL,1,NULL,'active');
|
||||
INSERT INTO "todos" VALUES(2,2,3,'Call dinosaur exterminator','Ask him if I need to hire a skip for the corpses.','2006-06-10 14:36:02','2006-06-24',NULL,1,NULL,'active');
|
||||
INSERT INTO "todos" VALUES(3,4,NULL,'Buy milk',NULL,'2006-06-10 14:36:02',NULL,NULL,1,NULL,'completed');
|
||||
INSERT INTO "todos" VALUES(4,4,NULL,'Buy bread',NULL,'2006-06-10 14:36:02',NULL,NULL,1,NULL,'completed');
|
||||
INSERT INTO "todos" VALUES(5,5,1,'Construct time dilation device',NULL,'2006-06-10 14:36:02',NULL,NULL,1,NULL,'active');
|
||||
INSERT INTO "todos" VALUES(6,2,1,'Phone Grandfather to ask about the paradox','Added some _notes_.','2006-06-10 14:36:02','2006-06-03',NULL,1,NULL,'active');
|
||||
INSERT INTO "todos" VALUES(7,6,3,'Get a book out of the library','Dinosaurs''R','2006-06-10 14:36:02',NULL,NULL,1,NULL,'active');
|
||||
INSERT INTO "todos" VALUES(8,4,NULL,'Upgrade to Rails 0.9.1',NULL,'2006-06-10 14:36:02','2006-06-10',NULL,1,NULL,'completed');
|
||||
INSERT INTO "todos" VALUES(9,1,NULL,'This should be due today',NULL,'2006-06-10 14:36:02','2006-06-10',NULL,1,NULL,'active');
|
||||
INSERT INTO "todos" VALUES(10,1,NULL,'foo',NULL,'2006-06-10 14:36:02','2005-01-05',NULL,1,NULL,'completed');
|
||||
INSERT INTO "todos" VALUES(11,1,2,'Buy shares',NULL,'2006-06-10 14:36:02','2005-02-01',NULL,1,NULL,'active');
|
||||
INSERT INTO "todos" VALUES(12,1,3,'Buy stegosaurus bait',NULL,'2006-06-10 14:36:02','2006-06-17',NULL,1,NULL,'active');
|
||||
INSERT INTO "todos" VALUES(13,1,3,'New action in context','Some notes','2006-06-10 14:36:02','2006-06-17',NULL,1,NULL,'active');
|
||||
INSERT INTO "todos" VALUES(14,2,2,'Call stock broker','tel: 12345','2006-06-03 14:36:02',NULL,NULL,1,NULL,'active');
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue