Skip to content

Commit

Permalink
Specify rails version in migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
dsander committed Feb 24, 2017
1 parent c7d1369 commit 4227058
Show file tree
Hide file tree
Showing 61 changed files with 65 additions and 65 deletions.
2 changes: 1 addition & 1 deletion db/migrate/20120728210244_devise_create_users.rb
@@ -1,4 +1,4 @@
class DeviseCreateUsers < ActiveRecord::Migration
class DeviseCreateUsers < ActiveRecord::Migration[4.2]
def change
create_table(:users) do |t|
## Database authenticatable
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20120728215449_add_admin_to_users.rb
@@ -1,4 +1,4 @@
class AddAdminToUsers < ActiveRecord::Migration
class AddAdminToUsers < ActiveRecord::Migration[4.2]
def change
add_column :users, :admin, :boolean, :default => false, :null => false
end
Expand Down
@@ -1,4 +1,4 @@
class EnableLockableStrategyForDevise < ActiveRecord::Migration
class EnableLockableStrategyForDevise < ActiveRecord::Migration[4.2]
def up
add_column :users, :failed_attempts, :integer, :default => 0
add_column :users, :unlock_token, :string
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20120919063304_add_username_to_users.rb
@@ -1,4 +1,4 @@
class AddUsernameToUsers < ActiveRecord::Migration
class AddUsernameToUsers < ActiveRecord::Migration[4.2]
class User < ActiveRecord::Base
end

Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20121216025930_create_events.rb
@@ -1,4 +1,4 @@
class CreateEvents < ActiveRecord::Migration
class CreateEvents < ActiveRecord::Migration[4.2]
def change
create_table :events do |t|
t.integer :user_id
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20121220053905_create_agents.rb
@@ -1,4 +1,4 @@
class CreateAgents < ActiveRecord::Migration
class CreateAgents < ActiveRecord::Migration[4.2]
def change
create_table :agents do |t|
t.integer :user_id
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20121222074732_create_links.rb
@@ -1,4 +1,4 @@
class CreateLinks < ActiveRecord::Migration
class CreateLinks < ActiveRecord::Migration[4.2]
def change
create_table :links do |t|
t.integer :source_id
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20121223203701_create_delayed_jobs.rb
@@ -1,4 +1,4 @@
class CreateDelayedJobs < ActiveRecord::Migration
class CreateDelayedJobs < ActiveRecord::Migration[4.2]
def self.up
create_table :delayed_jobs, :force => true do |table|
table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20121231170705_add_memory_to_agents.rb
@@ -1,4 +1,4 @@
class AddMemoryToAgents < ActiveRecord::Migration
class AddMemoryToAgents < ActiveRecord::Migration[4.2]
def change
add_column :agents, :memory, :text
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20130107050049_add_invitation_code_to_users.rb
@@ -1,4 +1,4 @@
class AddInvitationCodeToUsers < ActiveRecord::Migration
class AddInvitationCodeToUsers < ActiveRecord::Migration[4.2]
def change
add_column :users, :invitation_code, :string
change_column :users, :invitation_code, :string, :null => false
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20130124050117_add_indexes.rb
@@ -1,4 +1,4 @@
class AddIndexes < ActiveRecord::Migration
class AddIndexes < ActiveRecord::Migration[4.2]
def change
add_index :links, [:receiver_id, :source_id]
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20130126080736_change_memory_to_long_text.rb
@@ -1,6 +1,6 @@
# PG allows arbitrarily long text fields but MySQL has default limits. Make those limits larger if we're using MySQL.

class ChangeMemoryToLongText < ActiveRecord::Migration
class ChangeMemoryToLongText < ActiveRecord::Migration[4.2]
def up
if mysql?
change_column :agents, :memory, :text, :limit => 4294967295
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20130509053743_add_last_webhook_at_to_agents.rb
@@ -1,4 +1,4 @@
class AddLastWebhookAtToAgents < ActiveRecord::Migration
class AddLastWebhookAtToAgents < ActiveRecord::Migration[4.2]
def change
add_column :agents, :last_webhook_at, :datetime
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20130819160603_create_agent_logs.rb
@@ -1,4 +1,4 @@
class CreateAgentLogs < ActiveRecord::Migration
class CreateAgentLogs < ActiveRecord::Migration[4.2]
def change
create_table :agent_logs do |t|
t.integer :agent_id, :null => false
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20131105063248_add_expires_at_to_events.rb
@@ -1,4 +1,4 @@
class AddExpiresAtToEvents < ActiveRecord::Migration
class AddExpiresAtToEvents < ActiveRecord::Migration[4.2]
def change
add_column :events, :expires_at, :datetime
add_index :events, :expires_at
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20131222211558_add_keep_events_for_to_agents.rb
@@ -1,4 +1,4 @@
class AddKeepEventsForToAgents < ActiveRecord::Migration
class AddKeepEventsForToAgents < ActiveRecord::Migration[4.2]
def change
add_column :agents, :keep_events_for, :integer, :null => false, :default => 0
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20131223032112_switch_to_json_serialization.rb
@@ -1,4 +1,4 @@
class SwitchToJsonSerialization < ActiveRecord::Migration
class SwitchToJsonSerialization < ActiveRecord::Migration[4.2]
FIELDS = {
:agents => [:options, :memory],
:events => [:payload]
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20131227000021_add_cached_dates_to_agent.rb
@@ -1,4 +1,4 @@
class AddCachedDatesToAgent < ActiveRecord::Migration
class AddCachedDatesToAgent < ActiveRecord::Migration[4.2]
def up
add_column :agents, :last_event_at, :datetime
execute "UPDATE agents SET last_event_at = (SELECT created_at FROM events WHERE events.agent_id = agents.id ORDER BY id DESC LIMIT 1)"
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140121075418_create_user_credentials.rb
@@ -1,4 +1,4 @@
class CreateUserCredentials < ActiveRecord::Migration
class CreateUserCredentials < ActiveRecord::Migration[4.2]
def change
create_table :user_credentials do |t|
t.integer :user_id, :null => false
Expand Down
4 changes: 2 additions & 2 deletions db/migrate/20140127164931_change_handler_to_medium_text.rb
@@ -1,6 +1,6 @@
# Increase handler size to 16MB (consistent with events.payload)

class ChangeHandlerToMediumText < ActiveRecord::Migration
class ChangeHandlerToMediumText < ActiveRecord::Migration[4.2]
def up
if mysql?
change_column :delayed_jobs, :handler, :text, :limit => 16777215
Expand All @@ -16,4 +16,4 @@ def down
def mysql?
ActiveRecord::Base.connection.adapter_name =~ /mysql/i
end
end
end
2 changes: 1 addition & 1 deletion db/migrate/20140210062747_add_mode_to_user_credentials.rb
@@ -1,4 +1,4 @@
class AddModeToUserCredentials < ActiveRecord::Migration
class AddModeToUserCredentials < ActiveRecord::Migration[4.2]
def change
add_column :user_credentials, :mode, :string, :default => 'text', :null => false
end
Expand Down
@@ -1,4 +1,4 @@
class AddEventIdAtCreationToLinks < ActiveRecord::Migration
class AddEventIdAtCreationToLinks < ActiveRecord::Migration[4.2]
class Link < ActiveRecord::Base; end
class Event < ActiveRecord::Base; end

Expand Down
@@ -1,4 +1,4 @@
class AddPropagateImmediatelyToAgent < ActiveRecord::Migration
class AddPropagateImmediatelyToAgent < ActiveRecord::Migration[4.2]
def up
add_column :agents, :propagate_immediately, :boolean, :default => false, :null => false
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140403043556_add_disabled_to_agent.rb
@@ -1,4 +1,4 @@
class AddDisabledToAgent < ActiveRecord::Migration
class AddDisabledToAgent < ActiveRecord::Migration[4.2]
def change
add_column :agents, :disabled, :boolean, :default => false, :null => false
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140408150825_rename_webhook_to_web_request.rb
@@ -1,4 +1,4 @@
class RenameWebhookToWebRequest < ActiveRecord::Migration
class RenameWebhookToWebRequest < ActiveRecord::Migration[4.2]
def up
rename_column :agents, :last_webhook_at, :last_web_request_at
end
Expand Down
@@ -1,6 +1,6 @@
require 'liquid_migrator'

class MigrateAgentsToLiquidTemplating < ActiveRecord::Migration
class MigrateAgentsToLiquidTemplating < ActiveRecord::Migration[4.2]
class Agent < ActiveRecord::Base
include JSONSerializedField
json_serialize :options, :memory
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140509170420_create_scenarios.rb
@@ -1,4 +1,4 @@
class CreateScenarios < ActiveRecord::Migration
class CreateScenarios < ActiveRecord::Migration[4.2]
def change
create_table :scenarios do |t|
t.string :name, :null => false
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140509170443_create_scenario_memberships.rb
@@ -1,4 +1,4 @@
class CreateScenarioMemberships < ActiveRecord::Migration
class CreateScenarioMemberships < ActiveRecord::Migration[4.2]
def change
create_table :scenario_memberships do |t|
t.integer :agent_id, :null => false
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140515211100_create_services.rb
@@ -1,4 +1,4 @@
class CreateServices < ActiveRecord::Migration
class CreateServices < ActiveRecord::Migration[4.2]
def change
create_table :services do |t|
t.integer :user_id, null: false
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140525150040_add_service_id_to_agents.rb
@@ -1,4 +1,4 @@
class AddServiceIdToAgents < ActiveRecord::Migration
class AddServiceIdToAgents < ActiveRecord::Migration[4.2]
def change
add_column :agents, :service_id, :integer
end
Expand Down
@@ -1,4 +1,4 @@
class MigrateAgentsToServiceAuthentication < ActiveRecord::Migration
class MigrateAgentsToServiceAuthentication < ActiveRecord::Migration[4.2]
def twitter_consumer_key(agent)
agent.options['consumer_key'].presence || agent.credential('twitter_consumer_key')
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140531232016_add_fields_to_scenarios.rb
@@ -1,4 +1,4 @@
class AddFieldsToScenarios < ActiveRecord::Migration
class AddFieldsToScenarios < ActiveRecord::Migration[4.2]
def change
add_column :scenarios, :description, :text
add_column :scenarios, :public, :boolean, :default => false, :null => false
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140602014917_add_indices_to_scenarios.rb
@@ -1,4 +1,4 @@
class AddIndicesToScenarios < ActiveRecord::Migration
class AddIndicesToScenarios < ActiveRecord::Migration[4.2]
def change
add_index :scenarios, [:user_id, :guid], :unique => true
add_index :scenario_memberships, :agent_id
Expand Down
@@ -1,4 +1,4 @@
class RenameDigestEmailToEmailDigest < ActiveRecord::Migration
class RenameDigestEmailToEmailDigest < ActiveRecord::Migration[4.2]
def up
sql = <<-SQL
UPDATE #{ActiveRecord::Base.connection.quote_table_name('agents')}
Expand Down
4 changes: 2 additions & 2 deletions db/migrate/20140605032822_add_guid_to_agents.rb
@@ -1,4 +1,4 @@
class AddGuidToAgents < ActiveRecord::Migration
class AddGuidToAgents < ActiveRecord::Migration[4.2]
class Agent < ActiveRecord::Base; end

def change
Expand All @@ -12,4 +12,4 @@ def change

add_index :agents, :guid
end
end
end
2 changes: 1 addition & 1 deletion db/migrate/20140722131220_convert_efa_skip_agent.rb
@@ -1,4 +1,4 @@
class ConvertEfaSkipAgent < ActiveRecord::Migration
class ConvertEfaSkipAgent < ActiveRecord::Migration[4.2]
def up
Agent.where(type: 'Agents::EventFormattingAgent').each do |agent|
agent.options_will_change!
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140723110551_adopt_xpath_in_website_agent.rb
@@ -1,4 +1,4 @@
class AdoptXpathInWebsiteAgent < ActiveRecord::Migration
class AdoptXpathInWebsiteAgent < ActiveRecord::Migration[4.2]
class Agent < ActiveRecord::Base
include JSONSerializedField
json_serialize :options
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140730005210_convert_efa_skip_created_at.rb
@@ -1,4 +1,4 @@
class ConvertEfaSkipCreatedAt < ActiveRecord::Migration
class ConvertEfaSkipCreatedAt < ActiveRecord::Migration[4.2]
def up
Agent.where(type: 'Agents::EventFormattingAgent').each do |agent|
agent.options_will_change!
Expand Down
@@ -1,4 +1,4 @@
class RemoveServiceIndexOnUserId < ActiveRecord::Migration
class RemoveServiceIndexOnUserId < ActiveRecord::Migration[4.2]
def change
remove_index :services, :user_id
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140811200922_add_uid_column_to_services.rb
@@ -1,4 +1,4 @@
class AddUidColumnToServices < ActiveRecord::Migration
class AddUidColumnToServices < ActiveRecord::Migration[4.2]
def change
add_column :services, :uid, :string
add_index :services, :uid
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140813110107_set_charset_for_mysql.rb
@@ -1,4 +1,4 @@
class SetCharsetForMysql < ActiveRecord::Migration
class SetCharsetForMysql < ActiveRecord::Migration[4.2]
def all_models
@all_models ||= [
Agent,
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140820003139_add_tag_color_to_scenarios.rb
@@ -1,4 +1,4 @@
class AddTagColorToScenarios < ActiveRecord::Migration
class AddTagColorToScenarios < ActiveRecord::Migration[4.2]
def change
add_column :scenarios, :tag_bg_color, :string
add_column :scenarios, :tag_fg_color, :string
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140901143732_add_control_links.rb
@@ -1,4 +1,4 @@
class AddControlLinks < ActiveRecord::Migration
class AddControlLinks < ActiveRecord::Migration[4.2]
def change
create_table :control_links do |t|
t.integer :controller_id, null: false
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140906030139_set_events_count_default.rb
@@ -1,4 +1,4 @@
class SetEventsCountDefault < ActiveRecord::Migration
class SetEventsCountDefault < ActiveRecord::Migration[4.2]
def up
change_column_default(:agents, :events_count, 0)
change_column_null(:agents, :events_count, false, 0)
Expand Down
@@ -1,4 +1,4 @@
class AddTypeOptionAttributeToPushbulletAgents < ActiveRecord::Migration
class AddTypeOptionAttributeToPushbulletAgents < ActiveRecord::Migration[4.2]
def up
Agents::PushbulletAgent.find_each do |agent|
if agent.options['type'].nil?
Expand Down
@@ -1,4 +1,4 @@
class UpdateKeepEventsForToBeInSeconds < ActiveRecord::Migration
class UpdateKeepEventsForToBeInSeconds < ActiveRecord::Migration[4.2]
class Agent < ActiveRecord::Base; end

SECONDS_IN_DAY = 60 * 60 * 24
Expand All @@ -10,4 +10,4 @@ def up
def down
Agent.update_all ['keep_events_for = keep_events_for / ?', SECONDS_IN_DAY]
end
end
end
@@ -1,4 +1,4 @@
class RemoveRequirementFromUsersInvitationCode < ActiveRecord::Migration
class RemoveRequirementFromUsersInvitationCode < ActiveRecord::Migration[4.2]
def change
change_column_null :users, :invitation_code, true, ENV['INVITATION_CODE'].presence || 'try-huginn'
end
Expand Down
@@ -1,4 +1,4 @@
class WebsiteAgentDoesNotUseEventUrl < ActiveRecord::Migration
class WebsiteAgentDoesNotUseEventUrl < ActiveRecord::Migration[4.2]
def up
# Until this migration, if a WebsiteAgent received Events and did not have a `url_from_event` option set,
# it would use the `url` from the Event's payload. If the Event did not have a `url` in its payload, the
Expand Down
@@ -1,4 +1,4 @@
class AddModeOptionToFtpsiteAgents < ActiveRecord::Migration
class AddModeOptionToFtpsiteAgents < ActiveRecord::Migration[4.2]
def up
Agents::FtpsiteAgent.find_each do |agent|
agent.options['mode'] = 'read'
Expand Down
@@ -1,4 +1,4 @@
class AddConfirmableAttributesToUsers < ActiveRecord::Migration
class AddConfirmableAttributesToUsers < ActiveRecord::Migration[4.2]
def change
change_table(:users) do |t|
## Confirmable
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160302095413_add_deactivated_at_to_users.rb
@@ -1,4 +1,4 @@
class AddDeactivatedAtToUsers < ActiveRecord::Migration
class AddDeactivatedAtToUsers < ActiveRecord::Migration[4.2]
def change
add_column :users, :deactivated_at, :datetime

Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160307084729_add_deactivated_to_agents.rb
@@ -1,4 +1,4 @@
class AddDeactivatedToAgents < ActiveRecord::Migration
class AddDeactivatedToAgents < ActiveRecord::Migration[4.2]
def change
add_column :agents, :deactivated, :boolean, default: false
add_index :agents, [:disabled, :deactivated]
Expand Down
@@ -1,4 +1,4 @@
class WarnAboutDuplicateUsernames < ActiveRecord::Migration
class WarnAboutDuplicateUsernames < ActiveRecord::Migration[4.2]
def up
names = User.group('LOWER(username)').having('count(*) > 1').pluck('LOWER(username)')
if names.length > 0
Expand Down
@@ -1,4 +1,4 @@
class PostAgentSetEventHeaderStyle < ActiveRecord::Migration
class PostAgentSetEventHeaderStyle < ActiveRecord::Migration[4.2]
def up
Agent.of_type("Agents::PostAgent").each do |post_agent|
if post_agent.send(:boolify, post_agent.options['emit_events']) &&
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20160419150930_add_icon_to_scenarios.rb
@@ -1,4 +1,4 @@
class AddIconToScenarios < ActiveRecord::Migration
class AddIconToScenarios < ActiveRecord::Migration[4.2]
def change
add_column :scenarios, :icon, :string
end
Expand Down
@@ -1,4 +1,4 @@
class AddXmlNamespaceOptionToDataOutputAgents < ActiveRecord::Migration
class AddXmlNamespaceOptionToDataOutputAgents < ActiveRecord::Migration[4.2]
def up
Agents::DataOutputAgent.find_each do |agent|
agent.options['ns_media'] = 'true'
Expand All @@ -14,4 +14,4 @@ def down
agent.save!(validate: false)
end
end
end
end
@@ -1,4 +1,4 @@
class ChangeEventsOrderToEventsListOrder < ActiveRecord::Migration
class ChangeEventsOrderToEventsListOrder < ActiveRecord::Migration[4.2]
def up
Agents::DataOutputAgent.find_each do |agent|
if value = agent.options.delete('events_order')
Expand Down
@@ -1,4 +1,4 @@
class RemoveQueueFromEmailDigestAgentMemory < ActiveRecord::Migration
class RemoveQueueFromEmailDigestAgentMemory < ActiveRecord::Migration[4.2]
def up
Agents::EmailDigestAgent.find_each do |agent|
agent.memory.delete("queue")
Expand Down
@@ -1,4 +1,4 @@
class SetEmitErrorEventForTwitterActionAgents < ActiveRecord::Migration
class SetEmitErrorEventForTwitterActionAgents < ActiveRecord::Migration[4.2]
def up
Agents::TwitterActionAgent.find_each do |agent|
agent.options['emit_error_events'] = 'true'
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20161004120214_update_pushover_agent_options.rb
@@ -1,4 +1,4 @@
class UpdatePushoverAgentOptions < ActiveRecord::Migration
class UpdatePushoverAgentOptions < ActiveRecord::Migration[4.2]
DEFAULT_OPTIONS = {
'message' => '{{ message | default: text }}',
'device' => '{{ device }}',
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20161007030910_reset_data_output_agents.rb
@@ -1,4 +1,4 @@
class ResetDataOutputAgents < ActiveRecord::Migration
class ResetDataOutputAgents < ActiveRecord::Migration[4.2]
def up
Agents::DataOutputAgent.find_each do |agent|
agent.memory = {}
Expand Down

0 comments on commit 4227058

Please sign in to comment.