source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/models/comment/callbacks.rb
Ruby
mit
84
main
4,262
# frozen_string_literal: true # see app/models/comment.rb module Comment::Callbacks # Callback called after creation. Lots of people potentially can receive # an email whenever a Comment is posted: # # 1. the owner of the object # 2. users who already commented on the same object # 3. users who have expre...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/models/abstract_model/ordering_scopes.rb
Ruby
mit
84
main
10,302
# frozen_string_literal: true # == Scopes # # Ordering Scopes # # order_by(method):: Dispatcher for Query's :order_by param. # order_by_set:: Special order called by the :id_in_set scope # module AbstractModel::OrderingScopes # This is using Concern so we can define the scopes in this included module. ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/models/abstract_model/scopes.rb
Ruby
mit
84
main
19,332
# frozen_string_literal: true # == Scopes # # Examples: # Observation.created_at("2006-09-01", "2012-09-01") # Name.updated_at("2016-12-01") # returns names updated after # # Filtering scopes # # id_in_set:: # by_users:: # by_editor:: # created_at:: # updated_at:: # date:: # has_comments:: # comments_...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/models/occurrence/logging.rb
Ruby
mit
84
main
2,810
# frozen_string_literal: true # RSS logging, email notifications, and primary-touch methods # for occurrence lifecycle events. module Occurrence::Logging extend ActiveSupport::Concern class_methods do # Log and notify when observations are added to an occurrence. def log_observation_added(obs_list, user =...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/models/occurrence/project_gaps.rb
Ruby
mit
84
main
1,845
# frozen_string_literal: true # Detects and resolves project/species_list membership gaps # when the primary observation is not in sibling projects. module Occurrence::ProjectGaps extend ActiveSupport::Concern # Projects where any observation in the occurrence is a member # but not all observations are members....
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/models/image/url.rb
Ruby
mit
84
main
2,448
# frozen_string_literal: true class Image class URL SUBDIRECTORIES = { full_size: "orig", huge: "1280", large: "960", medium: "640", small: "320", thumbnail: "thumb" }.freeze SUBDIRECTORY_TO_SIZE = { "orig" => :full_size, "1280" => :huge, "960" => :l...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/models/image/scopes.rb
Ruby
mit
84
main
4,710
# frozen_string_literal: true module Image::Scopes # This is using Concern so we can define the scopes in this included module. extend ActiveSupport::Concern # NOTE: To improve Coveralls display, avoid one-line stabby lambda scopes. # Two line stabby lambdas are OK, it's just the declaration line that will ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/models/project/date.rb
Ruby
mit
84
main
508
# frozen_string_literal: true module Project::Date def current? !future? && !past? end # convenience method for date range display def date_range(format = "%Y-%m-%d") return :form_projects_any.l unless start_date.present? && end_date.present? "#{start_date.strftime(format)} to #{end_date.strftime...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/models/rss_log/scopes.rb
Ruby
mit
84
main
4,559
# frozen_string_literal: true module RssLog::Scopes # This is using Concern so we can define the scopes in this included module. extend ActiveSupport::Concern # NOTE: To improve Coveralls display, avoid one-line stabby lambda scopes. # Two line stabby lambdas are OK, it's just the declaration line that will ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/models/location/scopes.rb
Ruby
mit
84
main
8,154
# frozen_string_literal: true module Location::Scopes # This is using Concern so we can define the scopes in this included module. extend ActiveSupport::Concern # NOTE: To improve Coveralls display, avoid one-line stabby lambda scopes. # Two line stabby lambdas are OK, it's just the declaration line that will...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
app/models/naming/name_resolver.rb
Ruby
mit
84
main
6,158
# frozen_string_literal: true # Resolves the name using these heuristics: # First time through: # Only 'what' will be filled in. # Prompts the user if not found. # Gives user a list of options if matches more than one. ('names') # Gives user a list of options if deprecated. ('valid_names') # Second...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/routes.rb
Ruby
mit
84
main
41,761
# frozen_string_literal: true # Nested hash of permissible controllers and actions. Each entry as follows, # with missing element meaning use default: # # controller: { # hash of controller actions # action_name: { # hash of attributes for this action # methods: (array), # allowed HTML methods, as symbol...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/puma.rb
Ruby
mit
84
main
1,547
# frozen_string_literal: true rails_env = ENV.fetch("RAILS_ENV", "development") case rails_env when "development" app_path = ENV.fetch("PWD", ".") port(3000) workers(0) threads(1, 1) when "test" app_path = ENV.fetch("PWD", ".") workers(0) threads(1, 1) when "production" app_path = "/var/web/mushroom-o...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/unicorn_dev.rb
Ruby
mit
84
main
677
# frozen_string_literal: true APP_PATH = "/vagrant/mo" worker_processes(4) working_directory(APP_PATH) listen("/tmp/unicorn.sock", backlog: 64) listen(8080, tcp_nopush: true) timeout(300) pid("/tmp/unicorn.pid") stderr_path("#{APP_PATH}/log/unicorn.stderr.log") stdout_path("#{APP_PATH}/log/unicorn.stdout.log") preload...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/importmap.rb
Ruby
mit
84
main
1,482
# frozen_string_literal: true # Pin npm packages by running ./bin/importmap package-name # If string literal error, it means the importmap is not functioning # check it with bin/importmap json # jQuery is tricky with importmap: must use cdn.jsdelivr.net, NOT jspm # (which is for React and similar), or else `$` will n...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/consts.rb
Ruby
mit
84
main
12,163
# frozen_string_literal: true require("yaml") class ImageConfigData def initialize root = File.expand_path("..", __dir__) @env = ENV.fetch("RAILS_ENV", "development") @base_config = YAML.load_file("#{root}/config/image_config.yml")[@env] @worker_config_cache = {} @cache_mutex = Mutex.new end ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/unicorn.rb
Ruby
mit
84
main
712
# frozen_string_literal: true APP_PATH = "/var/web/mo" worker_processes(3) working_directory(APP_PATH) listen("#{APP_PATH}/tmp/sockets/unicorn.sock", backlog: 64) listen(8080, tcp_nopush: true) timeout(300) pid("#{APP_PATH}/tmp/pids/unicorn.pid") stderr_path("#{APP_PATH}/log/unicorn.stderr.log") stdout_path("#{APP_PAT...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/application.rb
Ruby
mit
84
main
4,597
# frozen_string_literal: true require_relative("boot") # To load all of Rails: # require("rails/rails") # To choose what Rails frameworks to load, and skip others: # NOTE: Be sure this list reflects the same choices made in the Gemfile require("rails") # NOTE: not "rails/rails" require("active_model/railtie") requir...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/boot.rb
Ruby
mit
84
main
354
# frozen_string_literal: true # Set up gems listed in the Gemfile. ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require("bundler/setup") if File.exist?(ENV["BUNDLE_GEMFILE"]) # Strict Ivars raises a NameError when you read an undefined instance varaible # Reduces sneaky view errors from unexpect...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/mail_delivery_error_logging.rb
Ruby
mit
84
main
750
# frozen_string_literal: true # Log email delivery failures to email-debug.log, then re-raise # so Solid Queue can track the failure. This ensures we notice # delivery errors instead of silently swallowing them. Rails.application.config.after_initialize do ActionMailer::MailDeliveryJob.rescue_from( StandardError...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/mail_patch.rb
Ruby
mit
84
main
490
# frozen_string_literal: true # Resolves an issue in mail 2.7.1 and above, where newlines are inserted # in mail body every x characters. This allows tests to pass module Mail module Utilities def self.safe_for_line_ending_conversion?(string) string.ascii_only? end end # module Encodings # clas...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/phlex.rb
Ruby
mit
84
main
689
# frozen_string_literal: true module Views end # Views and Components namespaces bootstrapped together in this initializer module Components # rubocop:disable Style/OneClassPerFile extend Phlex::Kit end # Register app/views and app/components with Zeitwerk under their # respective namespaces. These push_dir calls ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/extensions.rb
Ruby
mit
84
main
281
# frozen_string_literal: true # NOTE: These don't auto-load because the class (presumably) already exists. # # Rake tasks, depending on their environment, might need to require this file # explicitly. # Rails.root.glob("app/extensions/**/*.rb").each do |file| require(file) end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/mission_control_jobs.rb
Ruby
mit
84
main
263
# frozen_string_literal: true # Limit /jobs to admins # https://github.com/rails/mission_control-jobs?tab=readme-ov-file#authentication-and-base-controller-class Rails.application.configure do MissionControl::Jobs.base_controller_class = "AdminController" end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/new_framework_defaults_7_0.rb
Ruby
mit
84
main
7,663
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # # This file eases your Rails 7.0 framework defaults upgrade. # # Uncomment each configuration one by one to switch to the new default. # Once your application is ready to run with all new defaults, you can remove # this file an...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/wrap_parameters.rb
Ruby
mit
84
main
550
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. # You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_c...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/new_framework_defaults_7_1.rb
Ruby
mit
84
main
12,179
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # # This file eases your Rails 7.1 framework defaults upgrade. # # Uncomment each configuration one by one to switch to the new default. # Once your application is ready to run with all new defaults, you can remove # this file an...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/content_security_policy.rb
Ruby
mit
84
main
1,085
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Define an application-wide content security policy. # See the Securing Rails Applications Guide for more information: # https://guides.rubyonrails.org/security.html#content-security-policy-header # Rails.application.configure...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/google_cloud_storage.rb
Ruby
mit
84
main
490
# frozen_string_literal: true require("google/cloud/storage") require("json") file = Rails.root.join( "config/credentials/mo-image-archive-service-account.json" ) # For some reason the autotester on github will still try to load this file # even though it should presumably be in test mode. if File.exist?(file) && !...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/turbo_stream_actions.rb
Ruby
mit
84
main
503
# frozen_string_literal: true # https://stackoverflow.com/a/77434363/3357635 # this is optional but makes it much cleaner module CustomTurboStreamActions def close_modal(id) action(:close_modal, "#", id) end def update_input(id, value) action(:update_input, id, value) end def add_class(id, class_na...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/assets.rb
Ruby
mit
84
main
568
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = "1.0" # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets fo...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/monkey_patches.rb
Ruby
mit
84
main
649
# frozen_string_literal: true # https://dev.to/ayushn21/applying-monkey-patches-in-rails-1bj1 # https://binarysolo.chapter24.blog/applying-monkey-patches-in-rails/ # https://www.justinweiss.com/articles/3-ways-to-monkey-patch-without-making-a-mess/ require("action_view/log_subscriber") # Require all Ruby files in the...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/session_store.rb
Ruby
mit
84
main
222
# frozen_string_literal: true # Be sure to restart your server when you modify this file. MushroomObserver::Application.config.session_store( :cookie_store, key: "_mushroom-observer_session_3.1", same_site: :lax )
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/filter_parameter_logging.rb
Ruby
mit
84
main
447
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. # Use this to limit dissemination of sensitive information. # See the ActiveSupport::ParameterFilter documentation for supported notations # and behavior...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/zeitwerk.rb
Ruby
mit
84
main
583
# frozen_string_literal: true Rails.autoloaders.main.inflector.inflect( { "gmap" => "GMap", "verify_api_key_email" => "VerifyAPIKeyMailer" } ) Rails.autoloaders.main.ignore( "app/assets", "app/classes/api", "app/javascripts" ) # These subdirs are for organization only, should not create new namespaces FL...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/inflections.rb
Ruby
mit
84
main
1,339
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflec...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/initializers/backtrace_silencers.rb
Ruby
mit
84
main
439
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but # don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/environments/development.rb
Ruby
mit
84
main
7,948
# frozen_string_literal: true MushroomObserver::Application.configure do # Settings specified here will take precedence over those in # config/application.rb. # https://guides.rubyonrails.org/configuring.html#actiondispatch-hostauthorization config.hosts = [ IPAddr.new("0.0.0.0/0"), # All IPv4 addr...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/environments/test.rb
Ruby
mit
84
main
6,327
# frozen_string_literal: true MushroomObserver::Application.configure do # Settings specified here take precedence over those in config/application.rb # ---------------------------- # MO configuration. # ---------------------------- config.domain = "mushroomobserver.org" config.http_domain = "http...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
config/environments/production.rb
Ruby
mit
84
main
7,809
# frozen_string_literal: true MushroomObserver::Application.configure do # Settings specified here take precedence over those in config/application.rb # ---------------------------- # MO configuration. # ---------------------------- config.domain = "mushroomobserver.org" config.http_domain = "https...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/seeds.rb
Ruby
mit
84
main
650
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) # Mayor.create(:name =>...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/cache_schema.rb
Ruby
mit
84
main
1,366
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/schema.rb
Ruby
mit
84
main
41,494
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20231017220931_create_project_members.rb
Ruby
mit
84
main
330
# frozen_string_literal: true class CreateProjectMembers < ActiveRecord::Migration[6.1] def change create_table(:project_members) do |t| t.integer(:project_id, foreign_key: true) t.integer(:user_id, foreign_key: true) t.boolean(:trusted, default: false, null: false) t.timestamps end ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20150127220000_remove_transactions.rb
Ruby
mit
84
main
848
class RemoveTransactions < ActiveRecord::Migration def self.up drop_table :transactions remove_column :comments, :sync_id remove_column :images, :sync_id remove_column :interests, :sync_id remove_column :licenses, :sync_id remove_column :location_descriptions, :sync_id remove_column :locat...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20241130141445_create_banners.rb
Ruby
mit
84
main
216
# frozen_string_literal: true class CreateBanners < ActiveRecord::Migration[7.1] def change create_table(:banners) do |t| t.text(:message) t.integer(:version) t.timestamps end end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20130901115749_revised_terms.rb
Ruby
mit
84
main
1,171
class RevisedTerms < ActiveRecord::Migration def self.up drop_table :terms create_table :terms, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: true do |t| t.integer "version" t.integer "user_id" t.string "name", limit: 1024 t.integer "thumb_image_id" t.text "description" ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20260426000001_add_classification_to_name_versions.rb
Ruby
mit
84
main
488
# frozen_string_literal: true # Move classification versioning from name_descriptions onto Name itself. # `acts_as_versioned` snapshots versioned columns into `name_versions`, # so the column has to exist on both tables. The corresponding # `non_versioned_columns` exclusion + `if_changed:` add land in the same # commi...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20240126071823_add_naming_index_to_votes.rb
Ruby
mit
84
main
207
class AddNamingIndexToVotes < ActiveRecord::Migration[7.1] def up add_index :votes, :naming_id, name: :naming_index end def down remove_index :votes, :naming_id, name: :naming_index end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20130813215219_modified_to_updated_at.rb
Ruby
mit
84
main
4,533
class ModifiedToUpdatedAt < ActiveRecord::Migration def self.up rename_column :comments, :modified, :updated_at rename_column :copyright_changes, :modified, :updated_at rename_column :images, :modified, :updated_at rename_column :interests, :modified, :updated_at rename_column :licenses, :modified...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20161229143700_external_links.rb
Ruby
mit
84
main
700
class ExternalLinks < ActiveRecord::Migration def self.up create_table :external_sites, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: true do |t| t.string "name", limit: 100 t.integer "project_id", limit: 4 end create_table :external_links, options: "ENGINE=InnoDB DEFAULT CHA...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20100425015719_location_changes.rb
Ruby
mit
84
main
1,550
# encoding: utf-8 class LocationChanges < ActiveRecord::Migration def self.up add_column :locations_versions, :name, :string, limit: 200 Location.connection.update %( UPDATE locations_versions SET name = display_name ) remove_column :locations_versions, :display_name add_column :locations, :...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20240307020000_add_language_to_trans_str_versions.rb
Ruby
mit
84
main
442
class AddLanguageToTransStrVersions < ActiveRecord::Migration[7.1] def up add_column :translation_string_versions, :language_id, :integer TranslationString.connection.execute %( UPDATE translation_string_versions tsv JOIN translation_strings ts ON tsv.translation_string_id = ts.id SET tsv.la...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20171208172500_strip_genus_from_classifications.rb
Ruby
mit
84
main
1,454
class StripGenusFromClassifications < ActiveRecord::Migration def up strip_pattern = /\s*(Genus|Species|Subspecies|Variety|Form):.*\z/m # Stripping names... Name.connection.select_rows(%( SELECT id, classification FROM names WHERE classification REGEXP "(Genus|Species|Subspecies|Variety...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20140910105700_add_herarium_personal_user_id.rb
Ruby
mit
84
main
253
# encoding: utf-8 class AddHerariumPersonalUserId < ActiveRecord::Migration def self.up add_column(:herbaria, :personal_user_id, :integer, default: nil, null: true) end def self.down remove_column(:herbaria, :personal_user_id) end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20210228220153_create_contest_entries.rb
Ruby
mit
84
main
309
# frozen_string_literal: true class CreateContestEntries < ActiveRecord::Migration[5.2] def change create_table(:contest_entries, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8") do |t| t.integer(:image_id) t.integer(:alternate_image_id) t.timestamps end end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20120519120239_conference_registration_note.rb
Ruby
mit
84
main
224
class ConferenceRegistrationNote < ActiveRecord::Migration def self.up add_column :conference_events, :registration_note, :text end def self.down remove_column :conference_events, :registration_note end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20110214110100_object_to_target.rb
Ruby
mit
84
main
644
# encoding: utf-8 class ObjectToTarget < ActiveRecord::Migration def self.up # It is unsafe to override the "object_id" method starting in ruby 1.9. rename_column(:comments, :object_id, :target_id) rename_column(:comments, :object_type, :target_type) rename_column(:interests, :object_id, :target...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20240916224214_change_search_term_date_translation_tags.rb
Ruby
mit
84
main
393
class ChangeSearchTermDateTranslationTags < ActiveRecord::Migration[7.1] def up TranslationString.rename_tags( { search_term_date: :search_term_when, observation_term_date: :observation_term_when } ) end def down TranslationString.rename_tags( { search_term_when: :search_term_date,...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20220721063448_remove_merge_source_from_descriptions.rb
Ruby
mit
84
main
228
class RemoveMergeSourceFromDescriptions < ActiveRecord::Migration[6.1] def change remove_column :location_descriptions, :merge_source_id, :integer remove_column :name_descriptions, :merge_source_id, :integer end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20240126081715_add_login_index_to_users.rb
Ruby
mit
84
main
220
class AddLoginIndexToUsers < ActiveRecord::Migration[7.1] def up add_index :users, :login, name: :login_index, if_not_exists: true end def down remove_index :users, :login_id, name: :login_index end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20120405175300_observation_altitude_and_user_last_activity.rb
Ruby
mit
84
main
289
class ObservationAltitudeAndUserLastActivity < ActiveRecord::Migration def self.up add_column :observations, :alt, :float add_column :users, :last_activity, :datetime end def self.down remove_column :observations, :alt remove_column :users, :last_activity end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20150601014738_simplify_layout.rb
Ruby
mit
84
main
1,062
class SimplifyLayout < ActiveRecord::Migration def up add_column :users, :layout_count, :integer User.connection.update %( UPDATE users SET layout_count = rows*columns ) # for u in User.all() # u.layout_count = u.rows * u.columns # u.save # end remove_column :users, :rows ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20260404172939_add_unique_index_to_occurrences_field_slip_id.rb
Ruby
mit
84
main
235
# frozen_string_literal: true class AddUniqueIndexToOccurrencesFieldSlipId < ActiveRecord::Migration[7.2] def change remove_index(:occurrences, :field_slip_id) add_index(:occurrences, :field_slip_id, unique: true) end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20140324102552_mysql56.rb
Ruby
mit
84
main
3,241
class Mysql56 < ActiveRecord::Migration def self.change_column(table, column, type, options = {}) tmp_column = "#{column}_tmp" add_column(table, tmp_column, type, options) Name.connection.update("update #{table} set #{tmp_column}=#{column}") remove_column(table, column) rename_column(table, tmp_co...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20171119190100_rename_specimen_to_herbarium_record.rb
Ruby
mit
84
main
4,253
class RenameSpecimenToHerbariumRecord < ActiveRecord::Migration TAG_PAIRS = [ [ :SPECIMEN, :HERBARIUM_RECORD ], [ :specimen, :herbarium_record ], [ :SPECIMENS, :HERBARIUM_RECORDS ], [ :specimens, :herbarium_records ], [ :log_specimen_added, :log_herbarium_record_added ], [ :form_observations_...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20220614003806_add_primary_key_to_herbaria_curators.rb
Ruby
mit
84
main
207
class AddPrimaryKeyToHerbariaCurators < ActiveRecord::Migration[6.1] def change rename_table("herbaria_curators", "herbarium_curators") add_column(:herbarium_curators, :id, :primary_key) end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20210417194852_drop_contest_vote_and_content_entry.rb
Ruby
mit
84
main
527
class DropContestVoteAndContentEntry < ActiveRecord::Migration[5.2] def change drop_table(:contest_entries, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8") do |t| t.integer(:image_id) t.integer(:alternate_image_id) t.timestamps end drop_table(:contest_votes, ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20120701222900_add_verified_to_api_keys.rb
Ruby
mit
84
main
287
# encoding: utf-8 class AddVerifiedToApiKeys < ActiveRecord::Migration def self.up add_column(:api_keys, :verified, :datetime) ApiKey.connection.update %( UPDATE api_keys SET verified = NOW() ) end def self.down remove_column :api_keys, :verified end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20120331122300_create_conference_tables.rb
Ruby
mit
84
main
731
class CreateConferenceTables < ActiveRecord::Migration def self.up create_table :conference_events, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: true do |t| t.column "name", :string, limit: 1024 t.column "location", :string, limit: 1024 t.column "start", :date t.column "end", :dat...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20231019202655_update_project_users.rb
Ruby
mit
84
main
353
# frozen_string_literal: true class UpdateProjectUsers < ActiveRecord::Migration[6.1] def up Project.find_each do |project| project.user_group.users.each do |user| trusted = (project.user_id == user.id) || !project.open_membership ProjectMember.create(project:, user:, trusted:) end ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20240126075657_add_index_to_observation_views.rb
Ruby
mit
84
main
321
class AddIndexToObservationViews < ActiveRecord::Migration[7.1] def up add_index :observation_views, [:observation_id, :user_id], name: :user_observation_index end def down remove_index :observation_views, [:observation_id, :user_id], name: :user_observation_index end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20250714142904_add_unique_index_to_herbaria_code.rb
Ruby
mit
84
main
518
# frozen_string_literal: true class AddUniqueIndexToHerbariaCode < ActiveRecord::Migration[7.2] def up change_column(:herbaria, :code, :string, limit: 8, null: true, default: nil) execute("UPDATE herbaria SET code = NULL WHERE code = ''") add_index(:herbaria, :code, unique: true, where: "code IS NOT NULL...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20260426000004_backfill_latest_name_version_classification.rb
Ruby
mit
84
main
2,287
# frozen_string_literal: true # One-shot backfill: copy `names.classification` into the latest # version row of each Name. Older versions keep their NULL classification # — they pre-date `acts_as_versioned` capturing the column (#4163) and # the smart version browser (Phase 3 of the classification roadmap) # will infe...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20220614004020_add_primary_key_to_collection_numbers_observations.rb
Ruby
mit
84
main
270
class AddPrimaryKeyToCollectionNumbersObservations < ActiveRecord::Migration[6.1] def change rename_table( "collection_numbers_observations", "observation_collection_numbers" ) add_column(:observation_collection_numbers, :id, :primary_key) end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20120524000700_fix_species_list_where_length.rb
Ruby
mit
84
main
230
class FixSpeciesListWhereLength < ActiveRecord::Migration def self.up change_column :species_lists, :where, :string, limit: 1024 end def self.down change_column :species_lists, :where, :string, limit: 100 end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20221226160800_add_approved_to_name_trackers.rb
Ruby
mit
84
main
507
# frozen_string_literal: true class AddApprovedToNameTrackers < ActiveRecord::Migration[6.1] def up rename_column(:name_trackers, :obj_id, :name_id) add_column(:name_trackers, :approved, :boolean, default: true, null: false) NameTracker.where(note_template: "").update_all(note_template: nil) NameTrac...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20121021145904_create_specimens_and_herbaria.rb
Ruby
mit
84
main
1,247
class CreateSpecimensAndHerbaria < ActiveRecord::Migration def self.up create_table :specimens, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| t.integer :herbarium_id, null: false t.string :label, limit: 80, default: "", null: false t.date :when, null: false t.text :notes t.tim...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20240312231729_add_field_slip_prefix_to_projects.rb
Ruby
mit
84
main
202
class AddFieldSlipPrefixToProjects < ActiveRecord::Migration[7.1] def change add_column :projects, :field_slip_prefix, :string add_index(:projects, :field_slip_prefix, unique: true) end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20190205170400_add_hidden_column.rb
Ruby
mit
84
main
216
class AddHiddenColumn < ActiveRecord::Migration[4.2] def up add_column :observations, :gps_hidden, :boolean, default: false, null: false end def down remove_column :observations, :gps_hidden end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20260427180000_add_indexes_for_slow_queries.rb
Ruby
mit
84
main
1,357
# frozen_string_literal: true # Three indexes that close gaps surfaced by the slow query log during # the 2026-04-27 outage. All three drive frequently-hit queries that # were doing full table scans of tables with 1.8M+ rows. # # - `observation_images.image_id` (#4175): touch propagation from an # Image to its assoc...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20220128202651_change_column_null_rss_logs_created_at.rb
Ruby
mit
84
main
206
class ChangeColumnNullRssLogsCreatedAt < ActiveRecord::Migration[5.2] def change change_column_null(:rss_logs, :created_at, false, Time.now) RssLog.update_all("created_at = updated_at") end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20240916211404_change_image_upload_translation_tags.rb
Ruby
mit
84
main
430
class ChangeImageUploadTranslationTags < ActiveRecord::Migration[7.1] def up TranslationString.rename_tags( { profile_copyright_holder: :image_copyright_holder, profile_copyright_warning: :image_copyright_warning } ) end def down TranslationString.rename_tags( { image_copyright_hol...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20260306194750_create_occurrences.rb
Ruby
mit
84
main
508
# frozen_string_literal: true class CreateOccurrences < ActiveRecord::Migration[7.2] def change create_table(:occurrences, id: :integer) do |t| t.integer(:user_id) t.integer(:default_observation_id) t.boolean(:has_specimen, default: false, null: false) t.timestamps end add_index(...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20190220232900_add_gps_stripped_column.rb
Ruby
mit
84
main
213
class AddGpsStrippedColumn < ActiveRecord::Migration[4.2] def up add_column :images, :gps_stripped, :boolean, default: false, null: false end def down remove_column :images, :gps_stripped end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20170615205453_adjust_name_limits.rb
Ruby
mit
84
main
1,058
class AdjustNameLimits < ActiveRecord::Migration # define up & down because change method doesn't support change_column def up # These numbers explained in name.rb, Limits section change_column :names, :display_name, :string, limit: 204 change_column :names, :search_name, :string, lim...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20111105210213_create_triples.rb
Ruby
mit
84
main
829
class CreateTriples < ActiveRecord::Migration def self.up create_table :triples, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: true do |t| t.column "subject", :string, limit: 1024 t.column "predicate", :string, limit: 1024 t.column "object", :string, limit: 1024 end lichen_list =...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20171208190100_unbold_all_deprecated_names.rb
Ruby
mit
84
main
481
class UnboldAllDeprecatedNames < ActiveRecord::Migration def up Name.connection.select_rows(%( SELECT id, display_name FROM names WHERE deprecated IS TRUE AND display_name LIKE "%*%" )).each do |id, str| puts "Fixing #{id} #{str}" str.gsub!(/\*\*([^*]+)\*\*/, '\1') str = Name.con...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20250302213447_remove_email_all_from_user.rb
Ruby
mit
84
main
309
class RemoveEmailAllFromUser < ActiveRecord::Migration[7.2] def change remove_column :users, :email_comments_all, :boolean remove_column :users, :email_locations_all, :boolean remove_column :users, :email_names_all, :boolean remove_column :users, :email_observations_all, :boolean end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20201011132400_create_observation_views.rb
Ruby
mit
84
main
268
class CreateObservationViews < ActiveRecord::Migration[5.2] def change create_table :observation_views, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| t.integer :observation_id t.integer :user_id t.datetime :last_view end end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20120508143700_add_keep_image_filenames_pref.rb
Ruby
mit
84
main
224
class AddKeepImageFilenamesPref < ActiveRecord::Migration def self.up add_column :users, :keep_filenames, :boolean, default: true, null: false end def self.down remove_column :users, :keep_filenames end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20240117180824_latin1_to_utf8.rb
Ruby
mit
84
main
280
class Latin1ToUtf8 < ActiveRecord::Migration[7.1] def up Article.connection. execute("ALTER TABLE articles CONVERT TO CHARACTER SET utf8mb4;") Sequence.connection. execute("ALTER TABLE sequences CONVERT TO CHARACTER SET utf8mb4;") end def down; end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20240401235355_add_next_field_slip_to_projects.rb
Ruby
mit
84
main
506
# frozen_string_literal: true class AddNextFieldSlipToProjects < ActiveRecord::Migration[7.1] def up add_column(:projects, :next_field_slip, :integer, default: 0, null: false) # 48 Field Slips were created for the Alpha Test Project # before we were tracking the next_field_slip. project = Project.fi...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/201105170000_remove_old_tables.rb
Ruby
mit
84
main
520
# encoding: utf-8 class RemoveOldTables < ActiveRecord::Migration def self.up for old_table in %w( authors_descriptions authors_locations authors_names editors_descriptions editors_locations editors_names descriptions draft_names past_descriptions past_d...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20260407193041_create_project_target_names.rb
Ruby
mit
84
main
426
# frozen_string_literal: true class CreateProjectTargetNames < ActiveRecord::Migration[7.2] def change create_table(:project_target_names) do |t| t.integer(:project_id, null: false) t.integer(:name_id, null: false) end add_index(:project_target_names, :project_id) add_index(:project_targ...
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20240126082516_add_synonym_index_to_names.rb
Ruby
mit
84
main
212
class AddSynonymIndexToNames < ActiveRecord::Migration[7.1] def up add_index :names, :synonym_id, name: :synonym_index end def down remove_index :names, :synonym_id, name: :synonym_index end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20190722171600_readd_index_to_images_observations.rb
Ruby
mit
84
main
212
class ReaddIndexToImagesObservations < ActiveRecord::Migration[4.2] def up add_index :images_observations, :observation_id end def down remove_index :images_observations, :observation_id end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20260316133012_rename_default_observation_to_primary_observation.rb
Ruby
mit
84
main
236
# frozen_string_literal: true class RenameDefaultObservationToPrimaryObservation < ActiveRecord::Migration[7.2] def change rename_column(:occurrences, :default_observation_id, :primary_observation_id) end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20120426005425_add_registration_verified.rb
Ruby
mit
84
main
221
class AddRegistrationVerified < ActiveRecord::Migration def self.up add_column :conference_registrations, :verified, :datetime end def self.down remove_column :conference_registrations, :verified end end
github
MushroomObserver/mushroom-observer
https://github.com/MushroomObserver/mushroom-observer
db/migrate/20170827000729_remove_conferences.rb
Ruby
mit
84
main
1,111
class RemoveConferences < ActiveRecord::Migration def up drop_table :conference_registrations drop_table :conference_events end def down create_table :conference_events, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: true do |t| t.column "name", :string,...