Add Rails version to the migrations.

This commit is contained in:
Steven R. Baker 2019-05-13 18:42:57 +02:00
parent 820f5b5f8f
commit 6fb6cac89c
65 changed files with 68 additions and 68 deletions

View file

@ -1,5 +1,5 @@
# Verision 1.0.3 database # Verision 1.0.3 database
class CreateTracksDb < ActiveRecord::Migration class CreateTracksDb < ActiveRecord::Migration[5.2]
def self.up def self.up
create_table :contexts do |t| create_table :contexts do |t|
t.column :name, :string, :null => false t.column :name, :string, :null => false

View file

@ -1,4 +1,4 @@
class AddUserId < ActiveRecord::Migration class AddUserId < ActiveRecord::Migration[5.2]
class Project < ActiveRecord::Base; end class Project < ActiveRecord::Base; end
class Context < ActiveRecord::Base; end class Context < ActiveRecord::Base; end

View file

@ -1,4 +1,4 @@
class CreatedAt < ActiveRecord::Migration class CreatedAt < ActiveRecord::Migration[5.2]
# Current bug in Rails that prevents rename_column working in SQLite # Current bug in Rails that prevents rename_column working in SQLite
# if the column names use symbols instead of strings. # if the column names use symbols instead of strings.
# <http://dev.rubyonrails.org/changeset/2731> # <http://dev.rubyonrails.org/changeset/2731>

View file

@ -1,4 +1,4 @@
class Notes < ActiveRecord::Migration class Notes < ActiveRecord::Migration[5.2]
def self.up def self.up
create_table :notes do |t| create_table :notes do |t|
t.column :user_id, :integer, :null => false t.column :user_id, :integer, :null => false

View file

@ -1,4 +1,4 @@
class AddProjectDescription < ActiveRecord::Migration class AddProjectDescription < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :projects, :description, :text add_column :projects, :description, :text
end end

View file

@ -1,4 +1,4 @@
class AddPreferencesToUserTable < ActiveRecord::Migration class AddPreferencesToUserTable < ActiveRecord::Migration[5.2]
class User < ActiveRecord::Base; end class User < ActiveRecord::Base; end

View file

@ -1,4 +1,4 @@
class AddSessionsTable < ActiveRecord::Migration class AddSessionsTable < ActiveRecord::Migration[5.2]
def self.up def self.up
create_table :sessions do |t| create_table :sessions do |t|
t.column :session_id, :string t.column :session_id, :string

View file

@ -1,4 +1,4 @@
class AddSubclassAttrToTodos < ActiveRecord::Migration class AddSubclassAttrToTodos < ActiveRecord::Migration[5.2]
class Todo < ActiveRecord::Base; end class Todo < ActiveRecord::Base; end
class Immediate < Todo; end class Immediate < Todo; end

View file

@ -1,4 +1,4 @@
class AddUserPrefRefresh < ActiveRecord::Migration class AddUserPrefRefresh < ActiveRecord::Migration[5.2]
class User < ActiveRecord::Base; serialize :preferences; end class User < ActiveRecord::Base; serialize :preferences; end

View file

@ -1,4 +1,4 @@
class AddFirstAndLastNameToUser < ActiveRecord::Migration class AddFirstAndLastNameToUser < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :users, :first_name, :string add_column :users, :first_name, :string
add_column :users, :last_name, :string add_column :users, :last_name, :string

View file

@ -1,4 +1,4 @@
class PrefToShowHideSidebarItems < ActiveRecord::Migration class PrefToShowHideSidebarItems < ActiveRecord::Migration[5.2]
class User < ActiveRecord::Base; serialize :preferences; end class User < ActiveRecord::Base; serialize :preferences; end

View file

@ -1,4 +1,4 @@
class AddPreferencesModel < ActiveRecord::Migration class AddPreferencesModel < ActiveRecord::Migration[5.2]
class User < ActiveRecord::Base; serialize :preferences; end class User < ActiveRecord::Base; serialize :preferences; end

View file

@ -1,4 +1,4 @@
class ConvertPreferences < ActiveRecord::Migration class ConvertPreferences < ActiveRecord::Migration[5.2]
class User < ActiveRecord::Base; has_one :preference; serialize :preferences; end class User < ActiveRecord::Base; has_one :preference; serialize :preferences; end

View file

@ -1,4 +1,4 @@
class ConvertProjectToStateMachine < ActiveRecord::Migration class ConvertProjectToStateMachine < ActiveRecord::Migration[5.2]
class Project < ActiveRecord::Base; end class Project < ActiveRecord::Base; end

View file

@ -1,4 +1,4 @@
class AddVerboseActionDescriptorsPreference < ActiveRecord::Migration class AddVerboseActionDescriptorsPreference < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :preferences, :verbose_action_descriptors, :boolean, :default => false, :null => false add_column :preferences, :verbose_action_descriptors, :boolean, :default => false, :null => false
end end

View file

@ -1,4 +1,4 @@
class AddUserAuthType < ActiveRecord::Migration class AddUserAuthType < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :users, :auth_type, :string, :default => 'database', :null => false add_column :users, :auth_type, :string, :default => 'database', :null => false
end end

View file

@ -15,7 +15,7 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
class AddOpenIdTables < ActiveRecord::Migration class AddOpenIdTables < ActiveRecord::Migration[5.2]
def self.up def self.up
create_table "open_id_associations", :force => true do |t| create_table "open_id_associations", :force => true do |t|
t.column "server_url", :binary t.column "server_url", :binary

View file

@ -1,4 +1,4 @@
class AddUserOpenIdUrl < ActiveRecord::Migration class AddUserOpenIdUrl < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :users, :open_id_url, :string add_column :users, :open_id_url, :string
end end

View file

@ -1,4 +1,4 @@
class ConvertTodoToStateMachine < ActiveRecord::Migration class ConvertTodoToStateMachine < ActiveRecord::Migration[5.2]
class Todo < ActiveRecord::Base; belongs_to :project; end class Todo < ActiveRecord::Base; belongs_to :project; end
class Immediate < Todo; end class Immediate < Todo; end

View file

@ -1,4 +1,4 @@
class PrefToShowHiddenProjectsInSidebar < ActiveRecord::Migration class PrefToShowHiddenProjectsInSidebar < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :preferences, :show_hidden_projects_in_sidebar, :boolean, :default => true, :null => false add_column :preferences, :show_hidden_projects_in_sidebar, :boolean, :default => true, :null => false

View file

@ -1,4 +1,4 @@
class AddTimeZonePreference < ActiveRecord::Migration class AddTimeZonePreference < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :preferences, :time_zone, :string, :limit => 255, :default => 'London', :null => false add_column :preferences, :time_zone, :string, :limit => 255, :default => 'London', :null => false

View file

@ -1,4 +1,4 @@
class AddIndices < ActiveRecord::Migration class AddIndices < ActiveRecord::Migration[5.2]
def self.up def self.up
add_index :todos, [:user_id, :state] add_index :todos, [:user_id, :state]
add_index :todos, [:user_id, :project_id] add_index :todos, [:user_id, :project_id]

View file

@ -1,4 +1,4 @@
class IndexOnUserLogin < ActiveRecord::Migration class IndexOnUserLogin < ActiveRecord::Migration[5.2]
def self.up def self.up
add_index :users, :login add_index :users, :login
end end

View file

@ -1,4 +1,4 @@
class AddFindByNameIndices < ActiveRecord::Migration class AddFindByNameIndices < ActiveRecord::Migration[5.2]
def self.up def self.up
add_index :projects, [:user_id, :name] add_index :projects, [:user_id, :name]
add_index :contexts, [:user_id, :name] add_index :contexts, [:user_id, :name]

View file

@ -1,4 +1,4 @@
class AddTagSupport < ActiveRecord::Migration class AddTagSupport < ActiveRecord::Migration[5.2]
def self.up def self.up
create_table :taggings do |t| create_table :taggings do |t|
t.column :taggable_id, :integer t.column :taggable_id, :integer

View file

@ -1,4 +1,4 @@
class AddProjectTimestamps < ActiveRecord::Migration class AddProjectTimestamps < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :projects, :created_at, :timestamp add_column :projects, :created_at, :timestamp
add_column :projects, :updated_at, :timestamp add_column :projects, :updated_at, :timestamp

View file

@ -1,4 +1,4 @@
class AddContextTimestamps < ActiveRecord::Migration class AddContextTimestamps < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :contexts, :created_at, :timestamp add_column :contexts, :created_at, :timestamp

View file

@ -1,4 +1,4 @@
class AddShowProjectOnTodoDonePreference < ActiveRecord::Migration class AddShowProjectOnTodoDonePreference < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :preferences, :show_project_on_todo_done, :boolean, :default => false, :null => false add_column :preferences, :show_project_on_todo_done, :boolean, :default => false, :null => false
end end

View file

@ -1,4 +1,4 @@
class AddTitleDateFormatPreference < ActiveRecord::Migration class AddTitleDateFormatPreference < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :preferences, :title_date_format, :string, :limit => 255, :default => '%A, %d %B %Y', :null => false add_column :preferences, :title_date_format, :string, :limit => 255, :default => '%A, %d %B %Y', :null => false
end end

View file

@ -1,4 +1,4 @@
class SetNilTimestamps < ActiveRecord::Migration class SetNilTimestamps < ActiveRecord::Migration[5.2]
class Project < ActiveRecord::Base; end class Project < ActiveRecord::Base; end

View file

@ -1,4 +1,4 @@
class AddDefaultContextToProject < ActiveRecord::Migration class AddDefaultContextToProject < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :projects, :default_context_id, :integer add_column :projects, :default_context_id, :integer
end end

View file

@ -1,4 +1,4 @@
class AddMobileTodosPerPagePreference < ActiveRecord::Migration class AddMobileTodosPerPagePreference < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :preferences, :mobile_todos_per_page, :integer, :null => false, :default => 6 add_column :preferences, :mobile_todos_per_page, :integer, :null => false, :default => 6
end end

View file

@ -1,4 +1,4 @@
class AddRememberMeToUser < ActiveRecord::Migration class AddRememberMeToUser < ActiveRecord::Migration[5.2]
def self.up def self.up
rename_column :users, 'password', 'crypted_password' #bug in sqlite requires column names as strings 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, :string

View file

@ -1,4 +1,4 @@
class RenameWordToToken < ActiveRecord::Migration class RenameWordToToken < ActiveRecord::Migration[5.2]
def self.up def self.up
rename_column :users, 'word', 'token' #bug in sqlite requires column names as strings rename_column :users, 'word', 'token' #bug in sqlite requires column names as strings
end end

View file

@ -1,4 +1,4 @@
class UpdateOpenIdUrls < ActiveRecord::Migration class UpdateOpenIdUrls < ActiveRecord::Migration[5.2]
class User < ActiveRecord::Base class User < ActiveRecord::Base

View file

@ -1,4 +1,4 @@
class AddProjectCompletedAtColumn < ActiveRecord::Migration class AddProjectCompletedAtColumn < ActiveRecord::Migration[5.2]
class Project < ActiveRecord::Base; end class Project < ActiveRecord::Base; end

View file

@ -1,4 +1,4 @@
class AddIndexToNotes < ActiveRecord::Migration class AddIndexToNotes < ActiveRecord::Migration[5.2]
def self.up def self.up
add_index :notes, [:project_id] add_index :notes, [:project_id]
add_index :notes, [:user_id] add_index :notes, [:user_id]

View file

@ -1,4 +1,4 @@
class ProjectsContextsRemoveNotNullFromPosition < ActiveRecord::Migration class ProjectsContextsRemoveNotNullFromPosition < ActiveRecord::Migration[5.2]
def self.up def self.up
change_column :projects, :position, :integer, {:null => true, :default => nil} change_column :projects, :position, :integer, {:null => true, :default => nil}
change_column :contexts, :position, :integer, {:null => true, :default => nil} change_column :contexts, :position, :integer, {:null => true, :default => nil}

View file

@ -1,4 +1,4 @@
class CreateRecurringTodos < ActiveRecord::Migration class CreateRecurringTodos < ActiveRecord::Migration[5.2]
def self.up def self.up
create_table :recurring_todos do |t| create_table :recurring_todos do |t|
# todo data # todo data

View file

@ -1,4 +1,4 @@
class AddSeveralIndexes < ActiveRecord::Migration class AddSeveralIndexes < ActiveRecord::Migration[5.2]
def self.up def self.up
add_index :taggings, [:taggable_id, :taggable_type] add_index :taggings, [:taggable_id, :taggable_type]
add_index :taggings, :tag_id add_index :taggings, :tag_id

View file

@ -1,4 +1,4 @@
class AddSmsToPreference < ActiveRecord::Migration class AddSmsToPreference < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :preferences, :sms_email, :string add_column :preferences, :sms_email, :string
add_column :preferences, :sms_context_id, :integer add_column :preferences, :sms_context_id, :integer

View file

@ -1,4 +1,4 @@
class ChangeDatesToDatetimes < ActiveRecord::Migration class ChangeDatesToDatetimes < ActiveRecord::Migration[5.2]
def self.up def self.up
change_column :todos, :show_from, :datetime change_column :todos, :show_from, :datetime
change_column :todos, :due, :datetime change_column :todos, :due, :datetime

View file

@ -1,4 +1,4 @@
class AddUpdatedAtToTodos < ActiveRecord::Migration class AddUpdatedAtToTodos < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :todos, :updated_at, :timestamp add_column :todos, :updated_at, :timestamp
execute 'update todos set updated_at = created_at where completed_at IS NULL' execute 'update todos set updated_at = created_at where completed_at IS NULL'

View file

@ -1,4 +1,4 @@
class UpgradeOpenId < ActiveRecord::Migration class UpgradeOpenId < ActiveRecord::Migration[5.2]
def self.up def self.up
create_table :open_id_authentication_associations, :force => true do |t| create_table :open_id_authentication_associations, :force => true do |t|
t.integer :issued, :lifetime t.integer :issued, :lifetime

View file

@ -1,4 +1,4 @@
class RemoveUserFromTaggings < ActiveRecord::Migration class RemoveUserFromTaggings < ActiveRecord::Migration[5.2]
def self.up def self.up
remove_index :taggings, [:tag_id, :taggable_id, :taggable_type] remove_index :taggings, [:tag_id, :taggable_id, :taggable_type]
remove_index :tags, :name remove_index :tags, :name

View file

@ -1,4 +1,4 @@
class FixIncorrectlyHiddenTodos < ActiveRecord::Migration class FixIncorrectlyHiddenTodos < ActiveRecord::Migration[5.2]
def self.up def self.up
hidden_todos_without_project = hidden_todos_without_project =
Todo.where(:state => 'project_hidden', :project_id => nil) Todo.where(:state => 'project_hidden', :project_id => nil)

View file

@ -1,4 +1,4 @@
class AddDefaultTagsToProject < ActiveRecord::Migration class AddDefaultTagsToProject < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :projects, :default_tags, :string add_column :projects, :default_tags, :string
end end

View file

@ -1,4 +1,4 @@
class AddTodoDependencies < ActiveRecord::Migration class AddTodoDependencies < ActiveRecord::Migration[5.2]
def self.up def self.up
create_table :dependencies do |t| create_table :dependencies do |t|
t.integer :successor_id, :null => false t.integer :successor_id, :null => false

View file

@ -1,4 +1,4 @@
class AddShowAlwaysToRecurringTodo < ActiveRecord::Migration class AddShowAlwaysToRecurringTodo < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :recurring_todos, :show_always, :boolean add_column :recurring_todos, :show_always, :boolean
recurring_todos = RecurringTodo.all recurring_todos = RecurringTodo.all

View file

@ -1,4 +1,4 @@
class AddIndexToTodoState < ActiveRecord::Migration class AddIndexToTodoState < ActiveRecord::Migration[5.2]
def self.up def self.up
add_index :todos, :state add_index :todos, :state
end end
@ -6,4 +6,4 @@ class AddIndexToTodoState < ActiveRecord::Migration
def self.down def self.down
remove_index :todos, :state remove_index :todos, :state
end end
end end

View file

@ -1,4 +1,4 @@
class AddLocaleToPreference < ActiveRecord::Migration class AddLocaleToPreference < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :preferences, :locale, :string add_column :preferences, :locale, :string
end end

View file

@ -1,4 +1,4 @@
class AdaptToNewAasm < ActiveRecord::Migration class AdaptToNewAasm < ActiveRecord::Migration[5.2]
def self.up def self.up
change_column_default :todos, :state, nil change_column_default :todos, :state, nil
change_column_default :projects, :state, nil change_column_default :projects, :state, nil

View file

@ -1,4 +1,4 @@
class MakeOldRecurringTodosValidate < ActiveRecord::Migration class MakeOldRecurringTodosValidate < ActiveRecord::Migration[5.2]
def self.up def self.up
RecurringTodo.all.each do |rt| RecurringTodo.all.each do |rt|
# show_always may not be nil # show_always may not be nil

View file

@ -1,4 +1,4 @@
class ChangeCryptedPasswordLength < ActiveRecord::Migration class ChangeCryptedPasswordLength < ActiveRecord::Migration[5.2]
def self.up def self.up
change_column 'users', 'crypted_password', :string, :limit => 60 change_column 'users', 'crypted_password', :string, :limit => 60
end end

View file

@ -1,4 +1,4 @@
class AddLastReviewedToProject < ActiveRecord::Migration class AddLastReviewedToProject < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :projects, :last_reviewed, :timestamp add_column :projects, :last_reviewed, :timestamp

View file

@ -1,4 +1,4 @@
class AddNextReviewPreferences < ActiveRecord::Migration class AddNextReviewPreferences < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :preferences, :review_period, :integer, :default => 14, :null => false add_column :preferences, :review_period, :integer, :default => 14, :null => false

View file

@ -1,4 +1,4 @@
class AddIndicesToDependencyTable < ActiveRecord::Migration class AddIndicesToDependencyTable < ActiveRecord::Migration[5.2]
def self.up def self.up
add_index :dependencies, :successor_id add_index :dependencies, :successor_id
add_index :dependencies, :predecessor_id add_index :dependencies, :predecessor_id

View file

@ -1,4 +1,4 @@
class AddRenderedNotes < ActiveRecord::Migration class AddRenderedNotes < ActiveRecord::Migration[5.2]
def self.up def self.up
add_column :todos, 'rendered_notes', :text add_column :todos, 'rendered_notes', :text

View file

@ -1,4 +1,4 @@
class CreateTolkTables < ActiveRecord::Migration class CreateTolkTables < ActiveRecord::Migration[5.2]
def self.up def self.up
create_table :tolk_locales do |t| create_table :tolk_locales do |t|
t.string :name t.string :name
@ -35,4 +35,4 @@ class CreateTolkTables < ActiveRecord::Migration
drop_table :tolk_phrases drop_table :tolk_phrases
drop_table :tolk_locales drop_table :tolk_locales
end end
end end

View file

@ -1,4 +1,4 @@
class NoDefaultAdminEmail < ActiveRecord::Migration class NoDefaultAdminEmail < ActiveRecord::Migration[5.2]
def up def up
remove_column :preferences, :admin_email remove_column :preferences, :admin_email
end end

View file

@ -1,4 +1,4 @@
class AddStateToContext < ActiveRecord::Migration class AddStateToContext < ActiveRecord::Migration[5.2]
class Context < ActiveRecord::Base class Context < ActiveRecord::Base
end end

View file

@ -1,4 +1,4 @@
class RenameOccurencesToOccurrences < ActiveRecord::Migration class RenameOccurencesToOccurrences < ActiveRecord::Migration[5.2]
def change def change
rename_column :recurring_todos, :number_of_occurences, :number_of_occurrences rename_column :recurring_todos, :number_of_occurences, :number_of_occurrences
rename_column :recurring_todos, :occurences_count, :occurrences_count rename_column :recurring_todos, :occurences_count, :occurrences_count

View file

@ -1,4 +1,4 @@
class RemoveRenderedNotes < ActiveRecord::Migration class RemoveRenderedNotes < ActiveRecord::Migration[5.2]
def self.up def self.up
remove_column :todos, 'rendered_notes' remove_column :todos, 'rendered_notes'
end end

View file

@ -1,4 +1,4 @@
class CreateAttachments < ActiveRecord::Migration class CreateAttachments < ActiveRecord::Migration[5.2]
def change def change
create_table :attachments do |t| create_table :attachments do |t|
t.references :todo, index: true t.references :todo, index: true

View file

@ -1,4 +1,4 @@
class RemoveProjectHiddenStateFromTodos < ActiveRecord::Migration class RemoveProjectHiddenStateFromTodos < ActiveRecord::Migration[5.2]
class Todo < ActiveRecord::Base class Todo < ActiveRecord::Base
has_many :successor_dependencies, :foreign_key => 'successor_id', :class_name => 'Dependency' has_many :successor_dependencies, :foreign_key => 'successor_id', :class_name => 'Dependency'
belongs_to :project belongs_to :project
@ -39,4 +39,4 @@ class RemoveProjectHiddenStateFromTodos < ActiveRecord::Migration
end end
false false
end end
end end