Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update old migrations preventing DB initialization #1312

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ gem 'aws-sdk-s3'
gem 'filesize'

# Image processing
gem 'paperclip' # TODO: we want to migrate off this game to ActiveStorage
gem 'kt-paperclip' # TODO: we want to migrate off this game to ActiveStorage
gem 'rmagick'
gem 'image_processing'
gem 'active_storage_validations'
Expand Down
17 changes: 7 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,12 @@ GEM
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
kt-paperclip (7.2.1)
activemodel (>= 4.2.0)
activesupport (>= 4.2.0)
marcel (~> 1.0.1)
mime-types
terrapin (~> 0.6.0)
language_filter (0.3.01)
libv8-node (16.10.0.0)
libv8-node (16.10.0.0-x86_64-linux)
Expand Down Expand Up @@ -1454,9 +1460,6 @@ GEM
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0704)
mimemagic (0.3.10)
nokogiri (~> 1)
rake
mini_magick (4.11.0)
mini_mime (1.1.2)
mini_portile2 (2.8.1)
Expand Down Expand Up @@ -1487,12 +1490,6 @@ GEM
opus-ruby (1.0.1)
ffi
orm_adapter (0.5.0)
paperclip (6.1.0)
activemodel (>= 4.2.0)
activesupport (>= 4.2.0)
mime-types
mimemagic (~> 0.3.0)
terrapin (~> 0.6.0)
paranoia (2.6.1)
activerecord (>= 5.1, < 7.1)
paypal-checkout-sdk (1.0.4)
Expand Down Expand Up @@ -1718,6 +1715,7 @@ DEPENDENCIES
htmlentities
ibm_watson
image_processing
kt-paperclip
language_filter
listen
material_icons
Expand All @@ -1727,7 +1725,6 @@ DEPENDENCIES
mini_racer (~> 0.6.3)
newrelic_rpm
onebox!
paperclip
paranoia
paypal-checkout-sdk
paypal_client
Expand Down
4 changes: 0 additions & 4 deletions app/models/page_types/location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
class Location < ApplicationRecord
acts_as_paranoid

# todo: clear these -- not used anymore
has_attached_file :map, styles: { original: '1920x1080>', thumb: '200x200>' }
validates_attachment_content_type :map, content_type: %r{\Aimage\/.*\Z}

validates :name, presence: true

belongs_to :user
Expand Down
3 changes: 0 additions & 3 deletions db/migrate/20140713043535_create_models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ def change
t.string :type_of
t.text :description

# Map
t.attachment :map

# Culture
t.string :population
t.string :language
Expand Down
4 changes: 2 additions & 2 deletions db/migrate/20180110200009_upgrade_thredded_v0_14_to_v0_15.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def change # rubocop:disable Metrics/MethodLength
private

def remove_string_limit(table, column, type: :text, indices: [])
indices.each { |(_, options)| remove_index table, name: options[:name] }
indices.each { |(index_args, options)| remove_index table, name: options[:name] }
change_column table, column, type, limit: nil
indices.each { |args| add_index table, *args }
indices.each { |(index_args, options)| add_index table, index_args, **options }
end
end
17 changes: 17 additions & 0 deletions db/migrate/20180930063614_upgrade_thredded_v0_15_to_v0_16.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@

class UpgradeThreddedV015ToV016 < Thredded::BaseMigration
def up
# Add the deleted_at column and index if they don't already exist
unless column_exists?(:thredded_topics, :deleted_at)
add_column :thredded_topics, :deleted_at, :datetime
add_index :thredded_topics, :deleted_at

add_index :thredded_topics, [:deleted_at, :messageboard_id]
add_index :thredded_topics, [:deleted_at, :user_id]
end

unless column_exists?(:thredded_posts, :deleted_at)
add_column :thredded_posts, :deleted_at, :datetime
add_index :thredded_posts, :deleted_at
add_index :thredded_posts, [:deleted_at, :messageboard_id]
add_index :thredded_posts, [:deleted_at, :postable_id]
add_index :thredded_posts, [:deleted_at, :user_id]
end

%i[thredded_user_topic_read_states thredded_user_private_topic_read_states].each do |table_name|
add_column table_name, :unread_posts_count, :integer, default: 0, null: false
add_column table_name, :read_posts_count, :integer, default: 0, null: false
Expand Down

This file was deleted.

6 changes: 1 addition & 5 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
create_table "basil_feedbacks", force: :cascade do |t|
t.integer "basil_commission_id", null: false
t.integer "user_id", null: false
t.integer "score_adjustment"
t.integer "score_adjustment", default: 0
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["basil_commission_id"], name: "index_basil_feedbacks_on_basil_commission_id"
Expand Down Expand Up @@ -1941,10 +1941,6 @@
t.string "name", null: false
t.string "type_of"
t.text "description"
t.string "map_file_name"
t.string "map_content_type"
t.integer "map_file_size"
t.datetime "map_updated_at"
t.string "population"
t.string "language"
t.string "currency"
Expand Down
Loading