mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
Merge branch 'master' into lore-page-types
This commit is contained in:
commit
23f71f0922
144
Gemfile.lock
144
Gemfile.lock
@ -41,64 +41,64 @@ GIT
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
actioncable (6.0.2.2)
|
||||
actionpack (= 6.0.2.2)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
activejob (= 6.0.2.1)
|
||||
activerecord (= 6.0.2.1)
|
||||
activestorage (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
actionmailbox (6.0.2.2)
|
||||
actionpack (= 6.0.2.2)
|
||||
activejob (= 6.0.2.2)
|
||||
activerecord (= 6.0.2.2)
|
||||
activestorage (= 6.0.2.2)
|
||||
activesupport (= 6.0.2.2)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
actionview (= 6.0.2.1)
|
||||
activejob (= 6.0.2.1)
|
||||
actionmailer (6.0.2.2)
|
||||
actionpack (= 6.0.2.2)
|
||||
actionview (= 6.0.2.2)
|
||||
activejob (= 6.0.2.2)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.0.2.1)
|
||||
actionview (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
actionpack (6.0.2.2)
|
||||
actionview (= 6.0.2.2)
|
||||
activesupport (= 6.0.2.2)
|
||||
rack (~> 2.0, >= 2.0.8)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
activerecord (= 6.0.2.1)
|
||||
activestorage (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
actiontext (6.0.2.2)
|
||||
actionpack (= 6.0.2.2)
|
||||
activerecord (= 6.0.2.2)
|
||||
activestorage (= 6.0.2.2)
|
||||
activesupport (= 6.0.2.2)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
actionview (6.0.2.2)
|
||||
activesupport (= 6.0.2.2)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
active_record_union (1.3.0)
|
||||
activerecord (>= 4.0)
|
||||
active_storage_validations (0.8.7)
|
||||
active_storage_validations (0.8.8)
|
||||
rails (>= 5.2.0)
|
||||
activejob (6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
activejob (6.0.2.2)
|
||||
activesupport (= 6.0.2.2)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
activemodel (6.0.2.2)
|
||||
activesupport (= 6.0.2.2)
|
||||
activemodel-serializers-xml (1.0.2)
|
||||
activemodel (> 5.x)
|
||||
activesupport (> 5.x)
|
||||
builder (~> 3.1)
|
||||
activerecord (6.0.2.1)
|
||||
activemodel (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
activestorage (6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
activejob (= 6.0.2.1)
|
||||
activerecord (= 6.0.2.1)
|
||||
activerecord (6.0.2.2)
|
||||
activemodel (= 6.0.2.2)
|
||||
activesupport (= 6.0.2.2)
|
||||
activestorage (6.0.2.2)
|
||||
actionpack (= 6.0.2.2)
|
||||
activejob (= 6.0.2.2)
|
||||
activerecord (= 6.0.2.2)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (6.0.2.1)
|
||||
activesupport (6.0.2.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
@ -116,7 +116,7 @@ GEM
|
||||
autoprefixer-rails (9.7.4)
|
||||
execjs
|
||||
aws-eventstream (1.0.3)
|
||||
aws-partitions (1.283.0)
|
||||
aws-partitions (1.294.0)
|
||||
aws-sdk (3.0.1)
|
||||
aws-sdk-resources (~> 3)
|
||||
aws-sdk-accessanalyzer (1.1.0)
|
||||
@ -275,7 +275,7 @@ GEM
|
||||
aws-sdk-connectparticipant (1.0.0)
|
||||
aws-sdk-core (~> 3, >= 3.71.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-core (3.91.1)
|
||||
aws-sdk-core (3.92.0)
|
||||
aws-eventstream (~> 1.0, >= 1.0.2)
|
||||
aws-partitions (~> 1, >= 1.239.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
@ -875,7 +875,7 @@ GEM
|
||||
aws-sdk-route53resolver (1.11.0)
|
||||
aws-sdk-core (~> 3, >= 3.71.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-s3 (1.61.1)
|
||||
aws-sdk-s3 (1.61.2)
|
||||
aws-sdk-core (~> 3, >= 3.83.0)
|
||||
aws-sdk-kms (~> 1)
|
||||
aws-sigv4 (~> 1.1)
|
||||
@ -1028,7 +1028,7 @@ GEM
|
||||
bundler-audit (0.6.1)
|
||||
bundler (>= 1.2.0, < 3)
|
||||
thor (~> 0.18)
|
||||
capybara (3.31.0)
|
||||
capybara (3.32.1)
|
||||
addressable
|
||||
mini_mime (>= 0.1.3)
|
||||
nokogiri (~> 1.8)
|
||||
@ -1080,7 +1080,7 @@ GEM
|
||||
cucumber-wire (0.0.1)
|
||||
d3-rails (5.9.2)
|
||||
railties (>= 3.1)
|
||||
database_cleaner (1.8.3)
|
||||
database_cleaner (1.8.4)
|
||||
dateslices (0.0.4)
|
||||
rails (> 4)
|
||||
db_text_search (0.3.1)
|
||||
@ -1127,7 +1127,7 @@ GEM
|
||||
gherkin (5.1.0)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
guard (2.16.1)
|
||||
guard (2.16.2)
|
||||
formatador (>= 0.2.4)
|
||||
listen (>= 2.7, < 4.0)
|
||||
lumberjack (>= 1.0.12, < 2.0)
|
||||
@ -1158,7 +1158,7 @@ GEM
|
||||
http_parser.rb (~> 0.6.0)
|
||||
http-cookie (1.0.3)
|
||||
domain_name (~> 0.5)
|
||||
http-form_data (2.2.0)
|
||||
http-form_data (2.3.0)
|
||||
http_parser.rb (0.6.0)
|
||||
i18n (1.8.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
@ -1166,7 +1166,7 @@ GEM
|
||||
concurrent-ruby (~> 1.0)
|
||||
http (~> 4.1.0)
|
||||
jwt (~> 2.2.1)
|
||||
ibm_watson (1.3.0)
|
||||
ibm_watson (1.3.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
eventmachine (~> 1.2)
|
||||
faye-websocket (~> 0.10)
|
||||
@ -1208,10 +1208,10 @@ GEM
|
||||
listen (3.2.1)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
loofah (2.4.0)
|
||||
loofah (2.5.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
lumberjack (1.0.13)
|
||||
lumberjack (1.2.4)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
marcel (0.3.3)
|
||||
@ -1267,7 +1267,7 @@ GEM
|
||||
parallel (1.19.1)
|
||||
paranoia (2.4.2)
|
||||
activerecord (>= 4.0, < 6.1)
|
||||
parser (2.7.0.3)
|
||||
parser (2.7.0.5)
|
||||
ast (~> 2.4.0)
|
||||
paypal-checkout-sdk (1.0.3)
|
||||
paypalhttp (~> 1.0.0)
|
||||
@ -1276,11 +1276,11 @@ GEM
|
||||
faraday (~> 0.15)
|
||||
faraday_middleware (~> 0.12)
|
||||
paypalhttp (1.0.0)
|
||||
pg (1.2.2)
|
||||
pg (1.2.3)
|
||||
pry (0.13.0)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
public_suffix (4.0.3)
|
||||
public_suffix (4.0.4)
|
||||
puma (4.3.3)
|
||||
nio4r (~> 2.0)
|
||||
puma-heroku (1.1.0)
|
||||
@ -1299,20 +1299,20 @@ GEM
|
||||
rack
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (6.0.2.1)
|
||||
actioncable (= 6.0.2.1)
|
||||
actionmailbox (= 6.0.2.1)
|
||||
actionmailer (= 6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
actiontext (= 6.0.2.1)
|
||||
actionview (= 6.0.2.1)
|
||||
activejob (= 6.0.2.1)
|
||||
activemodel (= 6.0.2.1)
|
||||
activerecord (= 6.0.2.1)
|
||||
activestorage (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
rails (6.0.2.2)
|
||||
actioncable (= 6.0.2.2)
|
||||
actionmailbox (= 6.0.2.2)
|
||||
actionmailer (= 6.0.2.2)
|
||||
actionpack (= 6.0.2.2)
|
||||
actiontext (= 6.0.2.2)
|
||||
actionview (= 6.0.2.2)
|
||||
activejob (= 6.0.2.2)
|
||||
activemodel (= 6.0.2.2)
|
||||
activerecord (= 6.0.2.2)
|
||||
activestorage (= 6.0.2.2)
|
||||
activesupport (= 6.0.2.2)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 6.0.2.1)
|
||||
railties (= 6.0.2.2)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.4)
|
||||
actionpack (>= 5.0.1.x)
|
||||
@ -1345,9 +1345,9 @@ GEM
|
||||
sassc-rails (>= 1.3, < 3)
|
||||
rails_serve_static_assets (0.0.5)
|
||||
rails_stdout_logging (0.0.5)
|
||||
railties (6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
railties (6.0.2.2)
|
||||
actionpack (= 6.0.2.2)
|
||||
activesupport (= 6.0.2.2)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.20.3, < 2.0)
|
||||
@ -1355,7 +1355,7 @@ GEM
|
||||
rake (13.0.1)
|
||||
rb-fsevent (0.10.3)
|
||||
rb-gravatar (1.0.5)
|
||||
rb-inotify (0.10.0)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
react-rails (2.6.1)
|
||||
babel-transpiler (>= 0.7.0)
|
||||
@ -1365,14 +1365,14 @@ GEM
|
||||
tilt
|
||||
redcarpet (3.5.0)
|
||||
redis (4.1.3)
|
||||
regexp_parser (1.6.0)
|
||||
regexp_parser (1.7.0)
|
||||
remotipart (1.4.4)
|
||||
responders (3.0.0)
|
||||
actionpack (>= 5.0)
|
||||
railties (>= 5.0)
|
||||
rexml (3.2.4)
|
||||
rinku (2.0.6)
|
||||
rmagick (4.0.0)
|
||||
rmagick (4.1.1)
|
||||
rspec (3.9.0)
|
||||
rspec-core (~> 3.9.0)
|
||||
rspec-expectations (~> 3.9.0)
|
||||
@ -1397,14 +1397,14 @@ GEM
|
||||
rspec-mocks (~> 3.9)
|
||||
rspec-support (~> 3.9)
|
||||
rspec-support (3.9.2)
|
||||
rubocop (0.80.1)
|
||||
rubocop (0.81.0)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.7.0.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
rexml
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
ruby-prof (1.3.1)
|
||||
ruby-progressbar (1.10.1)
|
||||
ruby-vips (2.0.17)
|
||||
@ -1431,7 +1431,7 @@ GEM
|
||||
shellany (0.0.1)
|
||||
shoulda-matchers (4.3.0)
|
||||
activesupport (>= 4.2.0)
|
||||
sidekiq (6.0.5)
|
||||
sidekiq (6.0.6)
|
||||
connection_pool (>= 2.2.2)
|
||||
rack (~> 2.0)
|
||||
rack-protection (>= 2.0.0)
|
||||
@ -1468,7 +1468,7 @@ GEM
|
||||
tilt (2.0.10)
|
||||
timeago_js (3.0.2.2)
|
||||
tribute (3.6.0.0)
|
||||
tzinfo (1.2.6)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo-data (1.2019.3)
|
||||
tzinfo (>= 1.0.0)
|
||||
@ -1477,7 +1477,7 @@ GEM
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.6)
|
||||
unicode-display_width (1.6.1)
|
||||
unicode-display_width (1.7.0)
|
||||
uniform_notifier (1.13.0)
|
||||
warden (1.2.8)
|
||||
rack (>= 2.0.6)
|
||||
|
||||
@ -501,7 +501,7 @@ class ContentController < ApplicationController
|
||||
.downcase
|
||||
.to_sym
|
||||
|
||||
params.require(content_class).permit(content_param_list + [:deleted_at, :document_entity_id])
|
||||
params.require(content_class).except(:page_tags, :_destroy).permit(content_param_list + [:deleted_at, :document_entity_id])
|
||||
end
|
||||
|
||||
def page_tag_params
|
||||
|
||||
@ -12,8 +12,8 @@ class UsersController < ApplicationController
|
||||
@content = @user.public_content.select { |type, list| list.any? }
|
||||
@tabs = @content.keys
|
||||
|
||||
@accent_color = @user.favorite_page_type_color
|
||||
@accent_icon = @user.favorite_page_type_icon
|
||||
@accent_color = @user.favorite_page_type_color
|
||||
@accent_icon = @user.favorite_page_type_icon
|
||||
@favorite_content = @user.favorite_page_type? ? @user.send(@user.favorite_page_type.downcase.pluralize).is_public : []
|
||||
|
||||
# todo this is really bad and needs redone/improved
|
||||
|
||||
@ -123,7 +123,7 @@ module HasContent
|
||||
.first(limit)
|
||||
|
||||
@user_recent_content_list = recently_changed_attributes.map do |entity_type, entity_id|
|
||||
entity_type.constantize.find_by(id: entity_id)
|
||||
entity_type.constantize.find_by(id: entity_id) rescue nil
|
||||
end.compact
|
||||
end
|
||||
|
||||
|
||||
@ -15,6 +15,6 @@ class GroupAllyship < ApplicationRecord
|
||||
this_object = Group.find_by(id: self.group_id)
|
||||
other_object = Group.find_by(id: self.ally_id)
|
||||
|
||||
other_object.allies.delete this_object
|
||||
other_object.allies.delete(this_object) if other_object.present?
|
||||
end
|
||||
end
|
||||
|
||||
@ -15,6 +15,6 @@ class GroupEnemyship < ApplicationRecord
|
||||
this_object = Group.find_by(id: self.group_id)
|
||||
other_object = Group.find_by(id: self.enemy_id)
|
||||
|
||||
other_object.enemies.delete this_object
|
||||
other_object.enemies.delete(this_object) if other_object.present?
|
||||
end
|
||||
end
|
||||
|
||||
@ -15,6 +15,6 @@ class Sistergroupship < ApplicationRecord
|
||||
this_object = Group.find_by(id: self.group_id)
|
||||
other_object = Group.find_by(id: self.sistergroup_id)
|
||||
|
||||
other_object.sistergroups.delete this_object
|
||||
other_object.sistergroups.delete(this_object) if other_object.present?
|
||||
end
|
||||
end
|
||||
|
||||
@ -18,6 +18,6 @@ class Subgroupship < ApplicationRecord
|
||||
this_object = Group.find_by(id: self.group_id)
|
||||
other_object = Group.find_by(id: self.subgroup_id)
|
||||
|
||||
other_object.supergroups.delete(this_object)
|
||||
other_object.supergroups.delete(this_object) if other_object.present?
|
||||
end
|
||||
end
|
||||
|
||||
@ -18,6 +18,6 @@ class Supergroupship < ApplicationRecord
|
||||
this_object = Group.find_by(id: self.group_id)
|
||||
other_object = Group.find_by(id: self.supergroup_id)
|
||||
|
||||
other_object.subgroups.delete this_object
|
||||
other_object.subgroups.delete(this_object) if other_object.present?
|
||||
end
|
||||
end
|
||||
|
||||
@ -20,6 +20,6 @@ class TechnologyChildTechnology < ApplicationRecord
|
||||
this_object = Technology.find_by(id: self.technology_id)
|
||||
other_object = Technology.find_by(id: self.child_technology_id)
|
||||
|
||||
other_object.parent_technologies.delete(this_object)
|
||||
other_object.parent_technologies.delete(this_object) if other_object.present?
|
||||
end
|
||||
end
|
||||
|
||||
@ -20,6 +20,6 @@ class TechnologyParentTechnology < ApplicationRecord
|
||||
this_object = Technology.find_by(id: self.technology_id)
|
||||
other_object = Technology.find_by(id: self.parent_technology_id)
|
||||
|
||||
other_object.child_technologies.delete(this_object)
|
||||
other_object.child_technologies.delete(this_object) if other_object.present?
|
||||
end
|
||||
end
|
||||
|
||||
@ -14,6 +14,6 @@ class TechnologyRelatedTechnology < ApplicationRecord
|
||||
this_object = Technology.find_by(id: self.technology_id)
|
||||
other_object = Technology.find_by(id: self.related_technology_id)
|
||||
|
||||
other_object.related_technologies.delete(this_object)
|
||||
other_object.related_technologies.delete(this_object) if other_object.present?
|
||||
end
|
||||
end
|
||||
|
||||
@ -152,12 +152,18 @@ class User < ApplicationRecord
|
||||
Rails.application.routes.url_helpers.rails_representation_url(avatar.variant(resize_to_limit: [size, size]).processed, only_path: true)
|
||||
|
||||
else # otherwise, grab the default from Gravatar for this email address
|
||||
require 'digest/md5' # todo do we actually need to require this all the time?
|
||||
email_md5 = Digest::MD5.hexdigest(email.downcase)
|
||||
"https://www.gravatar.com/avatar/#{email_md5}?d=identicon&s=#{size}".html_safe
|
||||
gravatar_fallback_url(size)
|
||||
end
|
||||
|
||||
rescue ActiveStorage::FileNotFoundError
|
||||
gravatar_fallback_url(size)
|
||||
|
||||
rescue ImageProcessing::Error
|
||||
gravatar_fallback_url(size)
|
||||
end
|
||||
|
||||
def gravatar_fallback_url(size=80)
|
||||
require 'digest/md5' # todo do we actually need to require this all the time?
|
||||
email_md5 = Digest::MD5.hexdigest(email.downcase)
|
||||
"https://www.gravatar.com/avatar/#{email_md5}?d=identicon&s=#{size}".html_safe
|
||||
end
|
||||
|
||||
@ -2,16 +2,17 @@
|
||||
# to the new-style of having values in an associated Attribute model.
|
||||
# Once all data has been moved over, we can remove these old columns and delete this service.
|
||||
class TemporaryFieldMigrationService < Service
|
||||
def self.migrate_all_content_for_user(user)
|
||||
def self.migrate_all_content_for_user(user, force: false)
|
||||
user.content_list.each do |content|
|
||||
self.migrate_fields_for_content(content, user)
|
||||
self.migrate_fields_for_content(content, user, force: force)
|
||||
end
|
||||
end
|
||||
|
||||
def self.migrate_fields_for_content(content_model, user)
|
||||
def self.migrate_fields_for_content(content_model, user, force: false)
|
||||
return unless content_model.present? && user.present?
|
||||
return unless content_model.user == user
|
||||
return if content_model.persisted? && content_model.updated_at > 'May 1, 2018'.to_datetime
|
||||
return if !force && content_model.persisted? && content_model.created_at > 'May 1, 2018'.to_datetime
|
||||
return if !!content_model.columns_migrated_from_old_style?
|
||||
|
||||
# todo we might be able to do this in a single left outer join
|
||||
attribute_categories = content_model.class.attribute_categories(content_model.user)
|
||||
@ -44,6 +45,9 @@ class TemporaryFieldMigrationService < Service
|
||||
if existing_value && existing_value.created_at != existing_value.updated_at
|
||||
next
|
||||
end
|
||||
if existing_value.try(:value).present?
|
||||
next
|
||||
end
|
||||
|
||||
if content_model.respond_to?(attribute_field.old_column_source)
|
||||
value_from_model = content_model.send(attribute_field.old_column_source)
|
||||
@ -68,5 +72,7 @@ class TemporaryFieldMigrationService < Service
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
content_model.update_column(:columns_migrated_from_old_style, true)
|
||||
end
|
||||
end
|
||||
|
||||
@ -12,11 +12,19 @@
|
||||
<div id="associations_panel" class="row panel">
|
||||
<div class="row">
|
||||
<div class="col s12 m10 offset-m1">
|
||||
<div class="card-panel blue lighten-5">
|
||||
<i class="left material-icons grey-text">help</i>
|
||||
These associations are automatically created whenever you add another page to this universe.<br />
|
||||
Only you can see this message. <%= link_to 'Dismiss this message', '#' %>.
|
||||
</div>
|
||||
<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 7).none? %>
|
||||
<div class="col s12">
|
||||
<div class="hoverable card-panel blue lighten-5">
|
||||
<%= link_to prepay_path, class: 'black-text' do %>
|
||||
<i class="material-icons grey-text left">help</i>
|
||||
These associations are automatically created whenever you add another page to this universe.
|
||||
Only you can see this message.
|
||||
|
||||
<%= link_to 'Dismiss this notice.', notice_dismissal_dismiss_path(notice_id: 7), class: 'blue-text' %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% relations.each do |name, params| %>
|
||||
<%
|
||||
|
||||
@ -59,6 +59,12 @@
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<%= link_to @document, target: '_blank' do %>
|
||||
<i class="material-icons left <%= Document.color %>-text"><%= Document.icon %></i>
|
||||
View formatted document
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to analysis_document_path(@document) do %>
|
||||
<i class="material-icons left orange-text">bar_chart</i>
|
||||
@ -67,7 +73,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to '#', class: 'modal-trigger', data: { target: 'document-notes-modal' } do %>
|
||||
<i class="material-icons left <%= Document.color %>-text"><%= Document.icon %></i>
|
||||
<i class="material-icons left <%= Document.color %>-text">edit</i>
|
||||
Open document notes
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
class AddColumnMigrationFlagToAllContentModels < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column(:universes, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:characters, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:locations, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:items, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:buildings, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:conditions, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:continents, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:countries, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:creatures, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:deities, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:floras, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:foods, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:governments, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:groups, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:jobs, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:landmarks, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:languages, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:magics, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:planets, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:races, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:religions, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:scenes, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:schools, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:sports, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:technologies, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:towns, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:traditions, :columns_migrated_from_old_style, :boolean)
|
||||
add_column(:vehicles, :columns_migrated_from_old_style, :boolean)
|
||||
|
||||
change_column_default(:universes, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:characters, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:locations, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:items, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:buildings, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:conditions, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:continents, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:countries, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:creatures, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:deities, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:floras, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:foods, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:governments, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:groups, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:jobs, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:landmarks, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:languages, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:magics, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:planets, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:races, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:religions, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:scenes, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:schools, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:sports, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:technologies, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:towns, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:traditions, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
change_column_default(:vehicles, :columns_migrated_from_old_style, {:from=>nil, :to=>true})
|
||||
|
||||
end
|
||||
end
|
||||
65
db/schema.rb
65
db/schema.rb
@ -41,6 +41,24 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.index ["user_id"], name: "index_api_keys_on_user_id"
|
||||
end
|
||||
|
||||
create_table "application_integrations", force: :cascade do |t|
|
||||
t.integer "user_id", null: false
|
||||
t.string "name"
|
||||
t.string "description"
|
||||
t.string "organization_name"
|
||||
t.string "organization_url"
|
||||
t.string "website_url"
|
||||
t.string "privacy_policy_url"
|
||||
t.string "token"
|
||||
t.datetime "last_used_at"
|
||||
t.string "authorization_callback_url"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.string "event_ping_url"
|
||||
t.string "application_token"
|
||||
t.index ["user_id"], name: "index_application_integrations_on_user_id"
|
||||
end
|
||||
|
||||
create_table "archenemyships", force: :cascade do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "character_id"
|
||||
@ -185,6 +203,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["universe_id"], name: "index_buildings_on_universe_id"
|
||||
t.index ["user_id", "universe_id", "deleted_at"], name: "index_buildings_on_user_id_and_universe_id_and_deleted_at"
|
||||
t.index ["user_id"], name: "index_buildings_on_user_id"
|
||||
@ -338,6 +357,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Character"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_characters_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_characters_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_characters_on_deleted_at_and_user_id"
|
||||
@ -365,6 +385,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["universe_id"], name: "index_conditions_on_universe_id"
|
||||
t.index ["user_id", "universe_id", "deleted_at"], name: "index_conditions_on_user_id_and_universe_id_and_deleted_at"
|
||||
t.index ["user_id"], name: "index_conditions_on_user_id"
|
||||
@ -495,6 +516,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id", "universe_id"], name: "index_continents_on_deleted_at_and_id_and_universe_id"
|
||||
t.index ["deleted_at", "id", "user_id"], name: "index_continents_on_deleted_at_and_id_and_user_id"
|
||||
t.index ["deleted_at", "id"], name: "index_continents_on_deleted_at_and_id"
|
||||
@ -538,6 +560,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Country"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_countries_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_countries_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_countries_on_deleted_at_and_user_id"
|
||||
@ -695,6 +718,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Creature"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_creatures_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_creatures_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_creatures_on_deleted_at_and_user_id"
|
||||
@ -739,6 +763,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Deity"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_deities_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_deities_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_deities_on_deleted_at_and_user_id"
|
||||
@ -1032,6 +1057,11 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.integer "universe_id"
|
||||
t.boolean "favorite"
|
||||
t.text "notes_text"
|
||||
t.string "subtitle"
|
||||
t.string "format"
|
||||
t.string "genre"
|
||||
t.integer "word_count"
|
||||
t.string "status"
|
||||
t.index ["universe_id", "deleted_at"], name: "index_documents_on_universe_id_and_deleted_at"
|
||||
t.index ["universe_id"], name: "index_documents_on_universe_id"
|
||||
t.index ["user_id"], name: "index_documents_on_user_id"
|
||||
@ -1109,6 +1139,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Flora"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_floras_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_floras_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_floras_on_deleted_at_and_user_id"
|
||||
@ -1130,6 +1161,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["universe_id"], name: "index_foods_on_universe_id"
|
||||
t.index ["user_id", "universe_id", "deleted_at"], name: "index_foods_on_user_id_and_universe_id_and_deleted_at"
|
||||
t.index ["user_id"], name: "index_foods_on_user_id"
|
||||
@ -1248,6 +1280,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Government"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_governments_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_governments_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_governments_on_deleted_at_and_user_id"
|
||||
@ -1343,6 +1376,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Group"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_groups_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_groups_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_groups_on_deleted_at_and_user_id"
|
||||
@ -1374,6 +1408,17 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.index ["user_id"], name: "index_image_uploads_on_user_id"
|
||||
end
|
||||
|
||||
create_table "integration_authorizations", force: :cascade do |t|
|
||||
t.integer "user_id", null: false
|
||||
t.integer "application_integration_id", null: false
|
||||
t.string "referral_url"
|
||||
t.string "ip_address"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["application_integration_id"], name: "index_integration_authorizations_on_application_integration_id"
|
||||
t.index ["user_id"], name: "index_integration_authorizations_on_user_id"
|
||||
end
|
||||
|
||||
create_table "item_magics", force: :cascade do |t|
|
||||
t.integer "item_id"
|
||||
t.integer "magic_id"
|
||||
@ -1407,6 +1452,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Item"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_items_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_items_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_items_on_deleted_at_and_user_id"
|
||||
@ -1428,6 +1474,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["universe_id"], name: "index_jobs_on_universe_id"
|
||||
t.index ["user_id", "universe_id", "deleted_at"], name: "index_jobs_on_user_id_and_universe_id_and_deleted_at"
|
||||
t.index ["user_id"], name: "index_jobs_on_user_id"
|
||||
@ -1502,6 +1549,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Landmark"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_landmarks_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_landmarks_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_landmarks_on_deleted_at_and_user_id"
|
||||
@ -1533,6 +1581,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Language"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_languages_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_languages_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_languages_on_deleted_at_and_user_id"
|
||||
@ -1646,6 +1695,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Location"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_locations_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_locations_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_locations_on_deleted_at_and_user_id"
|
||||
@ -2005,6 +2055,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Magic"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_magics_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_magics_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_magics_on_deleted_at_and_user_id"
|
||||
@ -2300,6 +2351,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Planet"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_planets_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_planets_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_planets_on_deleted_at_and_user_id"
|
||||
@ -2353,6 +2405,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Race"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_races_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_races_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_races_on_deleted_at_and_user_id"
|
||||
@ -2426,6 +2479,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Religion"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_religions_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_religions_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_religions_on_deleted_at_and_user_id"
|
||||
@ -2491,6 +2545,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Scene"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_scenes_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_scenes_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_scenes_on_deleted_at_and_user_id"
|
||||
@ -2512,6 +2567,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["universe_id"], name: "index_schools_on_universe_id"
|
||||
t.index ["user_id", "universe_id", "deleted_at"], name: "index_schools_on_user_id_and_universe_id_and_deleted_at"
|
||||
t.index ["user_id"], name: "index_schools_on_user_id"
|
||||
@ -2549,6 +2605,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["universe_id"], name: "index_sports_on_universe_id"
|
||||
t.index ["user_id", "universe_id", "deleted_at"], name: "index_sports_on_user_id_and_universe_id_and_deleted_at"
|
||||
t.index ["user_id"], name: "index_sports_on_user_id"
|
||||
@ -2612,6 +2669,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Technology"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_technologies_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_technologies_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_technologies_on_deleted_at_and_user_id"
|
||||
@ -3050,6 +3108,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Town"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["deleted_at", "id"], name: "index_towns_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "universe_id"], name: "index_towns_on_deleted_at_and_universe_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_towns_on_deleted_at_and_user_id"
|
||||
@ -3070,6 +3129,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["universe_id"], name: "index_traditions_on_universe_id"
|
||||
t.index ["user_id", "universe_id", "deleted_at"], name: "index_traditions_on_user_id_and_universe_id_and_deleted_at"
|
||||
t.index ["user_id"], name: "index_traditions_on_user_id"
|
||||
@ -3093,6 +3153,8 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.string "page_type", default: "Universe"
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index "\"user_id\", \"universe_id\", \"deleted_at\"", name: "index_universes_on_user_id_and_universe_id_and_deleted_at"
|
||||
t.index ["deleted_at", "id"], name: "index_universes_on_deleted_at_and_id"
|
||||
t.index ["deleted_at", "user_id"], name: "index_universes_on_deleted_at_and_user_id"
|
||||
t.index ["deleted_at"], name: "index_universes_on_deleted_at"
|
||||
@ -3168,6 +3230,7 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "archived_at"
|
||||
t.boolean "favorite"
|
||||
t.boolean "columns_migrated_from_old_style", default: true
|
||||
t.index ["universe_id"], name: "index_vehicles_on_universe_id"
|
||||
t.index ["user_id", "universe_id", "deleted_at"], name: "index_vehicles_on_user_id_and_universe_id_and_deleted_at"
|
||||
t.index ["user_id"], name: "index_vehicles_on_user_id"
|
||||
@ -3353,6 +3416,8 @@ ActiveRecord::Schema.define(version: 2020_03_28_005343) do
|
||||
add_foreign_key "group_creatures", "groups"
|
||||
add_foreign_key "group_creatures", "users"
|
||||
add_foreign_key "image_uploads", "users"
|
||||
add_foreign_key "integration_authorizations", "application_integrations"
|
||||
add_foreign_key "integration_authorizations", "users"
|
||||
add_foreign_key "item_magics", "items"
|
||||
add_foreign_key "item_magics", "magics"
|
||||
add_foreign_key "item_magics", "users"
|
||||
|
||||
@ -52,12 +52,56 @@ namespace :data_integrity do
|
||||
page_type_data.each do |relation, relation_data|
|
||||
klass = relation_data[:related_class]
|
||||
reference_id = relation_data[:through_relation].to_s + '_id'
|
||||
puts "Klass is #{klass.name}"
|
||||
puts "Reference ID is #{reference_id}"
|
||||
|
||||
orphans = klass.where({"#{reference_id}": nil})
|
||||
puts "Orphans for relation #{relation_data[:with]}: #{orphans.count} -- deleting them all!"
|
||||
orphans.destroy_all!
|
||||
orphans.destroy_all
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Migrate old content and mark it as migrated once and for all"
|
||||
task migrate_old_content: :environment do
|
||||
RECORDS_TO_PROCESS = 300
|
||||
|
||||
old_logger = ActiveRecord::Base.logger
|
||||
ActiveRecord::Base.logger = nil
|
||||
|
||||
Rails.application.config.content_types[:all].each do |content_type|
|
||||
pages = content_type.where(columns_migrated_from_old_style: nil).limit(RECORDS_TO_PROCESS)
|
||||
puts "Migrating #{content_type.name} (#{pages.count} pages)"
|
||||
|
||||
pages.each do |page|
|
||||
puts "Hey, this page shouldn't be here!" if page.columns_migrated_from_old_style == true
|
||||
TemporaryFieldMigrationService.migrate_fields_for_content(page, page.user, force: true)
|
||||
|
||||
page.update_column(:columns_migrated_from_old_style, true) unless page.reload.columns_migrated_from_old_style == true
|
||||
end
|
||||
end
|
||||
|
||||
puts "Pages remaining to migrate: "
|
||||
Rails.application.config.content_types[:all].each do |content_type|
|
||||
count = content_type.where(columns_migrated_from_old_style: nil).count
|
||||
puts "#{content_type.name}: #{count} (#{content_type.where.not(columns_migrated_from_old_style: nil).count} migrated)"
|
||||
end
|
||||
|
||||
ActiveRecord::Base.logger = old_logger
|
||||
end
|
||||
|
||||
desc "Migrate old content per user"
|
||||
task migrate_old_content_per_user: :environment do
|
||||
START_ID = 1
|
||||
USERS_TO_PROCESS = 500
|
||||
|
||||
users = User.where(id: START_ID..(START_ID+USERS_TO_PROCESS))
|
||||
puts "Processing #{users.count} users"
|
||||
|
||||
users.each do |user|
|
||||
TemporaryFieldMigrationService.migrate_all_content_for_user(user)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
36
package-lock.json
generated
36
package-lock.json
generated
@ -1253,6 +1253,30 @@
|
||||
"@babel/runtime": "^7.4.4"
|
||||
}
|
||||
},
|
||||
"@material-ui/lab": {
|
||||
"version": "4.0.0-alpha.46",
|
||||
"resolved": "https://registry.npmjs.org/@material-ui/lab/-/lab-4.0.0-alpha.46.tgz",
|
||||
"integrity": "sha512-JGgZmj1UNP8bbYNAGvndipjXRK3x2+9mFBzbX7MyCj+WpfnJbeqTmJK2No9MXvPj/EZJ1piaKif46FdDc4U93A==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.4.4",
|
||||
"@material-ui/utils": "^4.9.6",
|
||||
"clsx": "^1.0.4",
|
||||
"prop-types": "^15.7.2",
|
||||
"react-is": "^16.8.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@material-ui/utils": {
|
||||
"version": "4.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@material-ui/utils/-/utils-4.9.6.tgz",
|
||||
"integrity": "sha512-gqlBn0JPPTUZeAktn1rgMcy9Iczrr74ecx31tyZLVGdBGGzsxzM6PP6zeS7FuoLS6vG4hoZP7hWnOoHtkR0Kvw==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.4.4",
|
||||
"prop-types": "^15.7.2",
|
||||
"react-is": "^16.8.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@material-ui/styles": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@material-ui/styles/-/styles-4.9.0.tgz",
|
||||
@ -2674,9 +2698,9 @@
|
||||
}
|
||||
},
|
||||
"acorn": {
|
||||
"version": "6.4.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz",
|
||||
"integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw=="
|
||||
"version": "6.4.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
|
||||
"integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA=="
|
||||
},
|
||||
"acorn-globals": {
|
||||
"version": "4.3.4",
|
||||
@ -8312,9 +8336,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": {
|
||||
"version": "5.7.3",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz",
|
||||
"integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==",
|
||||
"version": "5.7.4",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz",
|
||||
"integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==",
|
||||
"dev": true
|
||||
},
|
||||
"ws": {
|
||||
|
||||
@ -1855,9 +1855,9 @@ acorn-walk@^6.0.1:
|
||||
integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==
|
||||
|
||||
acorn@^5.5.3:
|
||||
version "5.7.3"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279"
|
||||
integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==
|
||||
version "5.7.4"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e"
|
||||
integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==
|
||||
|
||||
acorn@^6.0.1, acorn@^6.2.1:
|
||||
version "6.4.0"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user