card 1.105.6 → 1.106.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/config/initializers/02_patches/active_record.rb +2 -2
- data/db/schema.rb +5 -13
- data/lib/card/codename.rb +8 -0
- data/lib/card/director/store.rb +1 -1
- data/lib/card/model/save_helper/save_helper_helper.rb +6 -2
- data/lib/card/query/abstract_query/tie.rb +14 -0
- data/lib/card/query/card_query/interpretation.rb +26 -3
- data/lib/card/query/reference_query.rb +4 -4
- data/lib/card/set.rb +27 -0
- data/lib/cardio/generators/base.rb +1 -1
- data/lib/cardio/migration/assumption.rb +29 -0
- data/lib/cardio/migration/schema.rb +12 -0
- data/lib/cardio/migration/stamp.rb +31 -0
- data/lib/cardio/migration/transform.rb +44 -0
- data/lib/cardio/migration.rb +60 -74
- data/lib/cardio/mod/eat/edibles.rb +8 -2
- data/lib/cardio/mod/eat.rb +2 -1
- data/lib/cardio/mod/sow.rb +3 -1
- data/lib/cardio/mod.rb +5 -2
- data/lib/cardio/railtie.rb +6 -5
- data/lib/cardio/seed.rb +3 -6
- data/lib/generators/migration/USAGE +10 -11
- data/lib/generators/migration/migration_generator.rb +26 -24
- data/lib/generators/migration/templates/card_migration.erb +1 -3
- data/mod/core/data/fixtures/real/transform_migrations.yml +351 -0
- data/mod/core/data/recode.yml +7 -0
- data/{db/migrate → mod/core/data/schema}/20110511221913_require_earlier_migrations.rb +3 -3
- data/{db/migrate → mod/core/data/schema}/20120105203350_require_1_8_migrations.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20121111025347_require_1_10_migrations.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20121118114000_split_link_type.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20121118115000_update_link_type.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20130106052640_table_cleanup.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20130109015336_trunk_left.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20140822073704_create_new_revision_tables.rb +1 -1
- data/mod/core/data/schema/20141001105348_move_revisions_to_actions.rb +87 -0
- data/{db/migrate → mod/core/data/schema}/20141216053032_better_index_names.rb +10 -4
- data/{db/migrate → mod/core/data/schema}/20150724210803_add_comment_to_actions.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20151105225559_more_space_for_db_content.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20160122153608_new_indices.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20170908114442_create_delayed_jobs.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20170908114452_increase_text_size_for_delayed_jobs.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20180514152037_add_card_virtuals_table.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20190116170824_add_left_key_to_card_virtuals.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20190131223248_add_codename_index.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20190929202325_rename_present_in_reference_table.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20200718051236_compound_names_do_not_store_name_and_key.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20200805200729_add_unique_pair_indices.rb +1 -3
- data/{db/migrate → mod/core/data/schema}/20211128040849_virtuals_updated_at.rb +1 -1
- data/{db/migrate → mod/core/data/schema}/20221031182227_remove_referee_key_requirement.rb +1 -1
- data/mod/core/data/test.yml +4 -4
- data/{db/migrate_core_cards → mod/core/data/transform}/20120611203506_rails_inflection_updates.rb +10 -6
- data/mod/core/data/transform/20130411191151_renaming_for_menu.rb +17 -0
- data/mod/core/data/transform/20130920214038_jsonize_tinymce.rb +28 -0
- data/{db/migrate_core_cards → mod/core/data/transform}/20130920291703_update_stylesheets.rb +1 -1
- data/mod/core/data/transform/20140307231621_user_data_to_cards.rb +40 -0
- data/{db/migrate_core_cards → mod/core/data/transform}/20140317035504_account_requests_to_signups.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20141204061304_watchers_to_following.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20141208132416_partial_reference_type.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20150220134731_following_to_follow_rule.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20150429090551_search_card_context.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20150510031118_fix_skin_codenames.rb +2 -2
- data/{db/migrate_core_cards → mod/core/data/transform}/20150724123438_update_file_and_image_cards.rb +2 -2
- data/{db/migrate_core_cards → mod/core/data/transform}/20150807205221_create_references_for_search_cards.rb +1 -1
- data/mod/core/data/transform/20150824135418_update_file_history.rb +33 -0
- data/{db/migrate_core_cards → mod/core/data/transform}/20160811115836_rename_stats_to_admin.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20160914132636_fix_mod_files.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20161103154836_update_keys.rb +3 -3
- data/{db/migrate_core_cards → mod/core/data/transform}/20170830210517_correct_signup_success_message.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20180905061537_migrate_layouts.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20190125125150_add_script_rules_card.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20190320091257_upgrade_recaptcha_to_v3.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20190322095534_remove_toolbar_cards.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20190502130029_add_shark_and_help_desk_role.rb +2 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20190528131330_enabled_roles.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20190625153616_pointer_overhaul.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20190718140126_add_guides.rb +1 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20190822093633_move_help_text_to_code.rb +3 -1
- data/{db/migrate_core_cards → mod/core/data/transform}/20190829205148_remove_add_help.rb +1 -1
- data/mod/core/data/transform/20190902193208_input_type.rb +10 -0
- data/{db/migrate_core_cards → mod/core/data/transform}/20190904174403_token_upgrade.rb +2 -2
- data/{db/migrate_core_cards → mod/core/data/transform}/20190909104250_add_cardtype_input_types.rb +2 -2
- data/{db/migrate_core_cards → mod/core/data/transform}/20191115160748_history_cleanup.rb +1 -1
- data/mod/core/data/transform/20230502094848_repair_all_references.rb +7 -0
- data/mod/core/lib/tasks/card/migrate.rake +79 -114
- data/mod/core/lib/tasks/card.rake +2 -4
- metadata +67 -71
- data/db/migrate/20130411210957_update_codenames.rb +0 -15
- data/db/migrate/20141001105348_move_revisions_to_actions.rb +0 -70
- data/db/migrate/20141121172918_rename_card_migration_table.rb +0 -15
- data/db/migrate/20141208132159_remove_present_from_reference_table.rb +0 -9
- data/db/migrate_core_cards/20130411191151_renaming_for_menu.rb +0 -47
- data/db/migrate_core_cards/20130920214038_jsonize_tinymce.rb +0 -15
- data/db/migrate_core_cards/20140307231621_user_data_to_cards.rb +0 -28
- data/db/migrate_core_cards/20150824135418_update_file_history.rb +0 -24
- data/db/migrate_core_cards/20190902193208_input_type.rb +0 -15
- data/db/migrate_core_cards/20230502094848_repair_all_references.rb +0 -7
- data/lib/cardio/migration/core.rb +0 -11
- data/lib/cardio/migration/deck.rb +0 -0
- data/lib/cardio/migration/deck_structure.rb +0 -19
- data/lib/cardio/schema.rb +0 -96
- data/mod/core/data/fixtures/real/schema_migrations_core_cards.yml +0 -347
- data/mod/core/data/fixtures/real/schema_migrations_deck.yml +0 -1
- data/mod/core/data/fixtures/real/schema_migrations_deck_cards.yml +0 -5
@@ -1,148 +1,61 @@
|
|
1
|
-
def run_card_migration core_or_deck
|
2
|
-
prepare_migration
|
3
|
-
verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
|
4
|
-
Cardio::Schema.migrate core_or_deck, version, verbose
|
5
|
-
end
|
6
|
-
|
7
|
-
def prepare_migration
|
8
|
-
Card::Cache.reset_all
|
9
|
-
ENV["SCHEMA"] ||= "#{Cardio.gem_root}/db/schema.rb"
|
10
|
-
Card::Cache.reset_all
|
11
|
-
Card.config.action_mailer.perform_deliveries = false
|
12
|
-
Card.reset_column_information
|
13
|
-
# this is needed in production mode to insure core db
|
14
|
-
Card::Reference.reset_column_information
|
15
|
-
# structures are loaded before schema_mode is set
|
16
|
-
end
|
17
|
-
|
18
|
-
# @param mod [Boolean] if true reset column information for models defined in
|
19
|
-
# in mods in the deck
|
20
|
-
def reset_column_information mod=false
|
21
|
-
Rails.application.eager_load!
|
22
|
-
load_mod_lib if mod && !ENV["NO_CARD_LOAD"]
|
23
|
-
Cardio::Record.descendants.each(&:reset_column_information)
|
24
|
-
end
|
25
|
-
|
26
|
-
# FIXME: too general
|
27
|
-
# intent is to find Record classes; this gets a lot more.
|
28
|
-
def load_mod_lib
|
29
|
-
Dir.glob(Cardio.root.join("mod/*/lib/*.rb")).sort.each { |x| require x }
|
30
|
-
end
|
31
|
-
|
32
|
-
def without_dumping
|
33
|
-
ActiveRecord::Base.dump_schema_after_migration = false
|
34
|
-
yield
|
35
|
-
end
|
36
1
|
|
37
2
|
namespace :card do
|
38
3
|
desc "migrate structure and cards"
|
39
4
|
task migrate: :environment do
|
40
5
|
ENV["NO_RAILS_CACHE"] = "true"
|
41
|
-
ENV["SCHEMA"] ||= "#{Cardio.gem_root}/db/schema.rb"
|
42
|
-
|
43
|
-
stamp = ENV["STAMP_MIGRATIONS"]
|
44
|
-
|
45
|
-
puts "migrating structure"
|
46
|
-
Rake::Task["card:migrate:structure"].invoke
|
47
|
-
Rake::Task["card:migrate:stamp"].invoke :structure if stamp
|
48
|
-
|
49
|
-
puts "migrating deck structure"
|
50
|
-
Rake::Task["card:migrate:deck_structure"].execute
|
51
|
-
if stamp
|
52
|
-
Rake::Task["card:migrate:stamp"].reenable
|
53
|
-
Rake::Task["card:migrate:stamp"].invoke :core_cards
|
54
|
-
end
|
55
|
-
|
56
|
-
puts "migrating core cards"
|
57
|
-
Card::Cache.reset_all
|
58
|
-
# not invoke because we don't want to reload environment
|
59
|
-
Rake::Task["card:migrate:core_cards"].execute
|
60
|
-
if stamp
|
61
|
-
Rake::Task["card:migrate:stamp"].reenable
|
62
|
-
Rake::Task["card:migrate:stamp"].invoke :core_cards
|
63
|
-
end
|
64
|
-
|
65
|
-
puts "migrating deck cards"
|
66
|
-
# not invoke because we don't want to reload environment
|
67
|
-
Rake::Task["card:migrate:deck_cards"].execute
|
68
|
-
if stamp
|
69
|
-
Rake::Task["card:migrate:stamp"].reenable
|
70
|
-
Rake::Task["card:migrate:stamp"].invoke :deck_cards
|
71
|
-
end
|
72
6
|
|
7
|
+
Rake::Task["card:migrate:schema"].invoke
|
8
|
+
Rake::Task["card:migrate:transform"].execute
|
73
9
|
Card::Cache.reset_all
|
74
10
|
end
|
75
11
|
|
76
12
|
namespace :migrate do
|
77
|
-
desc "
|
78
|
-
task
|
13
|
+
desc "run structure migrations"
|
14
|
+
task schema: :environment do
|
15
|
+
puts "running schema migrations"
|
79
16
|
|
80
|
-
|
81
|
-
task structure: :environment do
|
82
|
-
ENV["SCHEMA"] ||= "#{Cardio.gem_root}/db/schema.rb"
|
17
|
+
interpret_env_schema
|
83
18
|
without_dumping do
|
84
|
-
|
19
|
+
run_migration :schema
|
85
20
|
end
|
86
|
-
end
|
87
|
-
|
88
|
-
desc "migrate core cards"
|
89
|
-
task core_cards: :environment do
|
90
|
-
without_dumping do
|
91
|
-
require "cardio/migration/core"
|
92
|
-
run_card_migration :core_cards
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
desc "migrate deck structure"
|
97
|
-
task deck_structure: :environment do
|
98
|
-
migrate_deck_structure
|
99
|
-
reset_column_information
|
100
|
-
end
|
101
|
-
|
102
|
-
def migrate_deck_structure
|
103
|
-
require "cardio/migration/deck_structure"
|
104
|
-
set_schema_path
|
105
|
-
Cardio::Schema.migrate :deck, version
|
106
21
|
Rake::Task["db:_dump"].invoke # write schema.rb
|
107
22
|
reset_column_information true
|
108
23
|
end
|
109
24
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
ENV["SCHEMA"] = "#{schema_dir}/schema.rb"
|
114
|
-
end
|
25
|
+
desc "run transform migrations"
|
26
|
+
task transform: :environment do
|
27
|
+
puts "running transform migrations"
|
115
28
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
29
|
+
without_dumping do
|
30
|
+
prepare_migration
|
31
|
+
run_migration :transform
|
32
|
+
end
|
120
33
|
end
|
121
34
|
|
122
|
-
desc "Redo the
|
35
|
+
desc "Redo the transform migration given by VERSION."
|
123
36
|
task redo: :environment do
|
124
|
-
|
125
|
-
verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
|
126
|
-
raise "VERSION is required" unless version
|
37
|
+
raise "VERSION is required" unless version.present?
|
127
38
|
|
128
39
|
ActiveRecord::Migration.verbose = verbose
|
129
40
|
ActiveRecord::SchemaMigration.where(version: version.to_s).delete_all
|
130
|
-
|
41
|
+
run_migration :transform
|
131
42
|
end
|
132
43
|
|
133
|
-
# maybe we should move this to a method?
|
134
44
|
desc "write the version to a file (not usually called directly)"
|
135
45
|
task :stamp, [:type] => [:environment] do |_t, args|
|
136
|
-
|
46
|
+
interpret_env_schema
|
137
47
|
Cardio.config.action_mailer.perform_deliveries = false
|
48
|
+
Cardio::Migration.new_for(args[:type]).stamp
|
49
|
+
end
|
138
50
|
|
139
|
-
|
51
|
+
task port: :environment do
|
52
|
+
Cardio::Migration.port_all
|
53
|
+
end
|
140
54
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
file.puts version
|
55
|
+
task recode: :environment do
|
56
|
+
Cardio::Mod.dirs.subpaths("data", "recode.yml").each_value do |path|
|
57
|
+
YAML.load_file(path).each do |oldcode, newcode|
|
58
|
+
Card::Codename.recode oldcode, newcode
|
146
59
|
end
|
147
60
|
end
|
148
61
|
end
|
@@ -152,3 +65,55 @@ namespace :card do
|
|
152
65
|
end
|
153
66
|
end
|
154
67
|
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def interpret_env_schema schema_dir=nil
|
72
|
+
schema_dir ||= "#{Cardio.root}/db"
|
73
|
+
# schema_dir = "#{Cardio.root}/db"
|
74
|
+
# Dir.mkdir schema_dir unless Dir.exist? schema_dir
|
75
|
+
ENV["SCHEMA"] ||= "#{schema_dir}/schema.rb"
|
76
|
+
end
|
77
|
+
|
78
|
+
def run_migration type
|
79
|
+
verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
|
80
|
+
Cardio::Migration.new_for(type).run version, verbose
|
81
|
+
stamp_migration type
|
82
|
+
end
|
83
|
+
|
84
|
+
def stamp_migration type
|
85
|
+
return unless ENV["STAMP_MIGRATIONS"]
|
86
|
+
|
87
|
+
task = Rake::Task["card:migrate:stamp"]
|
88
|
+
task.reenable
|
89
|
+
task.invoke type
|
90
|
+
end
|
91
|
+
|
92
|
+
def prepare_migration
|
93
|
+
interpret_env_schema
|
94
|
+
Card::Cache.reset_all
|
95
|
+
Card.config.action_mailer.perform_deliveries = false
|
96
|
+
Card.reset_column_information
|
97
|
+
# this is needed in production mode to insure core db
|
98
|
+
Card::Reference.reset_column_information
|
99
|
+
# structures are loaded before schema_mode is set
|
100
|
+
end
|
101
|
+
|
102
|
+
# @param mod [Boolean] if true reset column information for models defined in
|
103
|
+
# in mods in the deck
|
104
|
+
def reset_column_information mod=false
|
105
|
+
Rails.application.eager_load!
|
106
|
+
load_mod_lib if mod && !ENV["NO_CARD_LOAD"]
|
107
|
+
Cardio::Record.descendants.each(&:reset_column_information)
|
108
|
+
end
|
109
|
+
|
110
|
+
# FIXME: too general
|
111
|
+
# intent is to find Record classes; this gets a lot more.
|
112
|
+
def load_mod_lib
|
113
|
+
Dir.glob(Cardio.root.join("mod/*/lib/*.rb")).sort.each { |x| require x }
|
114
|
+
end
|
115
|
+
|
116
|
+
def without_dumping
|
117
|
+
ActiveRecord::Base.dump_schema_after_migration = false
|
118
|
+
yield
|
119
|
+
end
|
@@ -10,13 +10,11 @@ namespace :card do
|
|
10
10
|
failing_loudly "decko update" do
|
11
11
|
ENV["NO_RAILS_CACHE"] = "true"
|
12
12
|
# Benchmark.bm do |x|
|
13
|
-
[:migrate, :
|
13
|
+
["migrate:port", "migrate:schema", "migrate:recode", :eat, "migrate:transform",
|
14
|
+
:reset_tmp, :reset_cache,
|
14
15
|
"mod:uninstall", "mod:install", "mod:symlink"].each do |task|
|
15
|
-
# x.report(task) do
|
16
16
|
Rake::Task["card:#{task}"].invoke
|
17
|
-
# end
|
18
17
|
end
|
19
|
-
# end
|
20
18
|
end
|
21
19
|
end
|
22
20
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.106.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-
|
13
|
+
date: 2023-11-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: cardname
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.16.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
28
|
+
version: 0.16.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: rake
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -406,65 +406,6 @@ files:
|
|
406
406
|
- config/locales/de.yml
|
407
407
|
- config/locales/en.yml
|
408
408
|
- config/locales/es.yml
|
409
|
-
- db/migrate/20110511221913_require_earlier_migrations.rb
|
410
|
-
- db/migrate/20120105203350_require_1_8_migrations.rb
|
411
|
-
- db/migrate/20121111025347_require_1_10_migrations.rb
|
412
|
-
- db/migrate/20121118114000_split_link_type.rb
|
413
|
-
- db/migrate/20121118115000_update_link_type.rb
|
414
|
-
- db/migrate/20130106052640_table_cleanup.rb
|
415
|
-
- db/migrate/20130109015336_trunk_left.rb
|
416
|
-
- db/migrate/20130411210957_update_codenames.rb
|
417
|
-
- db/migrate/20140822073704_create_new_revision_tables.rb
|
418
|
-
- db/migrate/20141001105348_move_revisions_to_actions.rb
|
419
|
-
- db/migrate/20141121172918_rename_card_migration_table.rb
|
420
|
-
- db/migrate/20141208132159_remove_present_from_reference_table.rb
|
421
|
-
- db/migrate/20141216053032_better_index_names.rb
|
422
|
-
- db/migrate/20150724210803_add_comment_to_actions.rb
|
423
|
-
- db/migrate/20151105225559_more_space_for_db_content.rb
|
424
|
-
- db/migrate/20160122153608_new_indices.rb
|
425
|
-
- db/migrate/20170908114442_create_delayed_jobs.rb
|
426
|
-
- db/migrate/20170908114452_increase_text_size_for_delayed_jobs.rb
|
427
|
-
- db/migrate/20180514152037_add_card_virtuals_table.rb
|
428
|
-
- db/migrate/20190116170824_add_left_key_to_card_virtuals.rb
|
429
|
-
- db/migrate/20190131223248_add_codename_index.rb
|
430
|
-
- db/migrate/20190929202325_rename_present_in_reference_table.rb
|
431
|
-
- db/migrate/20200718051236_compound_names_do_not_store_name_and_key.rb
|
432
|
-
- db/migrate/20200805200729_add_unique_pair_indices.rb
|
433
|
-
- db/migrate/20211128040849_virtuals_updated_at.rb
|
434
|
-
- db/migrate/20221031182227_remove_referee_key_requirement.rb
|
435
|
-
- db/migrate_core_cards/20120611203506_rails_inflection_updates.rb
|
436
|
-
- db/migrate_core_cards/20130411191151_renaming_for_menu.rb
|
437
|
-
- db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
|
438
|
-
- db/migrate_core_cards/20130920291703_update_stylesheets.rb
|
439
|
-
- db/migrate_core_cards/20140307231621_user_data_to_cards.rb
|
440
|
-
- db/migrate_core_cards/20140317035504_account_requests_to_signups.rb
|
441
|
-
- db/migrate_core_cards/20141204061304_watchers_to_following.rb
|
442
|
-
- db/migrate_core_cards/20141208132416_partial_reference_type.rb
|
443
|
-
- db/migrate_core_cards/20150220134731_following_to_follow_rule.rb
|
444
|
-
- db/migrate_core_cards/20150429090551_search_card_context.rb
|
445
|
-
- db/migrate_core_cards/20150510031118_fix_skin_codenames.rb
|
446
|
-
- db/migrate_core_cards/20150724123438_update_file_and_image_cards.rb
|
447
|
-
- db/migrate_core_cards/20150807205221_create_references_for_search_cards.rb
|
448
|
-
- db/migrate_core_cards/20150824135418_update_file_history.rb
|
449
|
-
- db/migrate_core_cards/20160811115836_rename_stats_to_admin.rb
|
450
|
-
- db/migrate_core_cards/20160914132636_fix_mod_files.rb
|
451
|
-
- db/migrate_core_cards/20161103154836_update_keys.rb
|
452
|
-
- db/migrate_core_cards/20170830210517_correct_signup_success_message.rb
|
453
|
-
- db/migrate_core_cards/20180905061537_migrate_layouts.rb
|
454
|
-
- db/migrate_core_cards/20190125125150_add_script_rules_card.rb
|
455
|
-
- db/migrate_core_cards/20190320091257_upgrade_recaptcha_to_v3.rb
|
456
|
-
- db/migrate_core_cards/20190322095534_remove_toolbar_cards.rb
|
457
|
-
- db/migrate_core_cards/20190502130029_add_shark_and_help_desk_role.rb
|
458
|
-
- db/migrate_core_cards/20190528131330_enabled_roles.rb
|
459
|
-
- db/migrate_core_cards/20190625153616_pointer_overhaul.rb
|
460
|
-
- db/migrate_core_cards/20190718140126_add_guides.rb
|
461
|
-
- db/migrate_core_cards/20190822093633_move_help_text_to_code.rb
|
462
|
-
- db/migrate_core_cards/20190829205148_remove_add_help.rb
|
463
|
-
- db/migrate_core_cards/20190902193208_input_type.rb
|
464
|
-
- db/migrate_core_cards/20190904174403_token_upgrade.rb
|
465
|
-
- db/migrate_core_cards/20190909104250_add_cardtype_input_types.rb
|
466
|
-
- db/migrate_core_cards/20191115160748_history_cleanup.rb
|
467
|
-
- db/migrate_core_cards/20230502094848_repair_all_references.rb
|
468
409
|
- db/schema.rb
|
469
410
|
- db/seeds.rb
|
470
411
|
- db/version.txt
|
@@ -652,9 +593,10 @@ files:
|
|
652
593
|
- lib/cardio/generators/rails_overrides.rb
|
653
594
|
- lib/cardio/job.rb
|
654
595
|
- lib/cardio/migration.rb
|
655
|
-
- lib/cardio/migration/
|
656
|
-
- lib/cardio/migration/
|
657
|
-
- lib/cardio/migration/
|
596
|
+
- lib/cardio/migration/assumption.rb
|
597
|
+
- lib/cardio/migration/schema.rb
|
598
|
+
- lib/cardio/migration/stamp.rb
|
599
|
+
- lib/cardio/migration/transform.rb
|
658
600
|
- lib/cardio/mod.rb
|
659
601
|
- lib/cardio/mod/class_methods.rb
|
660
602
|
- lib/cardio/mod/dirs.rb
|
@@ -676,7 +618,6 @@ files:
|
|
676
618
|
- lib/cardio/mod/sow.rb
|
677
619
|
- lib/cardio/railtie.rb
|
678
620
|
- lib/cardio/record.rb
|
679
|
-
- lib/cardio/schema.rb
|
680
621
|
- lib/cardio/script_loader.rb
|
681
622
|
- lib/cardio/seed.rb
|
682
623
|
- lib/cardio/utils.rb
|
@@ -740,14 +681,69 @@ files:
|
|
740
681
|
- mod/core/data/fixtures/real/card_references.yml
|
741
682
|
- mod/core/data/fixtures/real/cards.yml
|
742
683
|
- mod/core/data/fixtures/real/schema_migrations.yml
|
743
|
-
- mod/core/data/fixtures/real/
|
744
|
-
- mod/core/data/fixtures/real/schema_migrations_deck.yml
|
745
|
-
- mod/core/data/fixtures/real/schema_migrations_deck_cards.yml
|
684
|
+
- mod/core/data/fixtures/real/transform_migrations.yml
|
746
685
|
- mod/core/data/real.yml
|
686
|
+
- mod/core/data/recode.yml
|
687
|
+
- mod/core/data/schema/20110511221913_require_earlier_migrations.rb
|
688
|
+
- mod/core/data/schema/20120105203350_require_1_8_migrations.rb
|
689
|
+
- mod/core/data/schema/20121111025347_require_1_10_migrations.rb
|
690
|
+
- mod/core/data/schema/20121118114000_split_link_type.rb
|
691
|
+
- mod/core/data/schema/20121118115000_update_link_type.rb
|
692
|
+
- mod/core/data/schema/20130106052640_table_cleanup.rb
|
693
|
+
- mod/core/data/schema/20130109015336_trunk_left.rb
|
694
|
+
- mod/core/data/schema/20140822073704_create_new_revision_tables.rb
|
695
|
+
- mod/core/data/schema/20141001105348_move_revisions_to_actions.rb
|
696
|
+
- mod/core/data/schema/20141216053032_better_index_names.rb
|
697
|
+
- mod/core/data/schema/20150724210803_add_comment_to_actions.rb
|
698
|
+
- mod/core/data/schema/20151105225559_more_space_for_db_content.rb
|
699
|
+
- mod/core/data/schema/20160122153608_new_indices.rb
|
700
|
+
- mod/core/data/schema/20170908114442_create_delayed_jobs.rb
|
701
|
+
- mod/core/data/schema/20170908114452_increase_text_size_for_delayed_jobs.rb
|
702
|
+
- mod/core/data/schema/20180514152037_add_card_virtuals_table.rb
|
703
|
+
- mod/core/data/schema/20190116170824_add_left_key_to_card_virtuals.rb
|
704
|
+
- mod/core/data/schema/20190131223248_add_codename_index.rb
|
705
|
+
- mod/core/data/schema/20190929202325_rename_present_in_reference_table.rb
|
706
|
+
- mod/core/data/schema/20200718051236_compound_names_do_not_store_name_and_key.rb
|
707
|
+
- mod/core/data/schema/20200805200729_add_unique_pair_indices.rb
|
708
|
+
- mod/core/data/schema/20211128040849_virtuals_updated_at.rb
|
709
|
+
- mod/core/data/schema/20221031182227_remove_referee_key_requirement.rb
|
747
710
|
- mod/core/data/test.yml
|
748
711
|
- mod/core/data/test/cardtype.yml
|
749
712
|
- mod/core/data/test/sample.yml
|
750
713
|
- mod/core/data/test/user.yml
|
714
|
+
- mod/core/data/transform/20120611203506_rails_inflection_updates.rb
|
715
|
+
- mod/core/data/transform/20130411191151_renaming_for_menu.rb
|
716
|
+
- mod/core/data/transform/20130920214038_jsonize_tinymce.rb
|
717
|
+
- mod/core/data/transform/20130920291703_update_stylesheets.rb
|
718
|
+
- mod/core/data/transform/20140307231621_user_data_to_cards.rb
|
719
|
+
- mod/core/data/transform/20140317035504_account_requests_to_signups.rb
|
720
|
+
- mod/core/data/transform/20141204061304_watchers_to_following.rb
|
721
|
+
- mod/core/data/transform/20141208132416_partial_reference_type.rb
|
722
|
+
- mod/core/data/transform/20150220134731_following_to_follow_rule.rb
|
723
|
+
- mod/core/data/transform/20150429090551_search_card_context.rb
|
724
|
+
- mod/core/data/transform/20150510031118_fix_skin_codenames.rb
|
725
|
+
- mod/core/data/transform/20150724123438_update_file_and_image_cards.rb
|
726
|
+
- mod/core/data/transform/20150807205221_create_references_for_search_cards.rb
|
727
|
+
- mod/core/data/transform/20150824135418_update_file_history.rb
|
728
|
+
- mod/core/data/transform/20160811115836_rename_stats_to_admin.rb
|
729
|
+
- mod/core/data/transform/20160914132636_fix_mod_files.rb
|
730
|
+
- mod/core/data/transform/20161103154836_update_keys.rb
|
731
|
+
- mod/core/data/transform/20170830210517_correct_signup_success_message.rb
|
732
|
+
- mod/core/data/transform/20180905061537_migrate_layouts.rb
|
733
|
+
- mod/core/data/transform/20190125125150_add_script_rules_card.rb
|
734
|
+
- mod/core/data/transform/20190320091257_upgrade_recaptcha_to_v3.rb
|
735
|
+
- mod/core/data/transform/20190322095534_remove_toolbar_cards.rb
|
736
|
+
- mod/core/data/transform/20190502130029_add_shark_and_help_desk_role.rb
|
737
|
+
- mod/core/data/transform/20190528131330_enabled_roles.rb
|
738
|
+
- mod/core/data/transform/20190625153616_pointer_overhaul.rb
|
739
|
+
- mod/core/data/transform/20190718140126_add_guides.rb
|
740
|
+
- mod/core/data/transform/20190822093633_move_help_text_to_code.rb
|
741
|
+
- mod/core/data/transform/20190829205148_remove_add_help.rb
|
742
|
+
- mod/core/data/transform/20190902193208_input_type.rb
|
743
|
+
- mod/core/data/transform/20190904174403_token_upgrade.rb
|
744
|
+
- mod/core/data/transform/20190909104250_add_cardtype_input_types.rb
|
745
|
+
- mod/core/data/transform/20191115160748_history_cleanup.rb
|
746
|
+
- mod/core/data/transform/20230502094848_repair_all_references.rb
|
751
747
|
- mod/core/lib/tasks/card.rake
|
752
748
|
- mod/core/lib/tasks/card/migrate.rake
|
753
749
|
- mod/core/lib/tasks/card/mod.rake
|
@@ -819,7 +815,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
819
815
|
- !ruby/object:Gem::Version
|
820
816
|
version: '0'
|
821
817
|
requirements: []
|
822
|
-
rubygems_version: 3.
|
818
|
+
rubygems_version: 3.4.10
|
823
819
|
signing_key:
|
824
820
|
specification_version: 4
|
825
821
|
summary: a simple engine for emergent data structures
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
class UpdateCodenames < ActiveRecord::Migration[4.2]
|
4
|
-
def up
|
5
|
-
{ content: :structure, edit_help: :help }.each do |oldname, newname|
|
6
|
-
execute %(update cards set codename = "#{newname}" where codename = "#{oldname}";)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def down
|
11
|
-
{ content: :structure, edit_help: :help }.each do |oldname, newname|
|
12
|
-
execute %(update cards set codename = "#{oldname}" where codename = "#{newname}";)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
class MoveRevisionsToActions < ActiveRecord::Migration[4.2]
|
2
|
-
class TmpRevision < Cardio::Record
|
3
|
-
belongs_to :tmp_card, foreign_key: :card_id
|
4
|
-
self.table_name = "card_revisions"
|
5
|
-
def self.delete_cardless
|
6
|
-
left_join = "LEFT JOIN card_revisions "\
|
7
|
-
"ON card_revisions.card_id = cards.id"
|
8
|
-
TmpRevision.joins(left_join).where("cards.id IS NULL").delete_all
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
class TmpAct < Cardio::Record
|
13
|
-
self.table_name = "card_acts"
|
14
|
-
end
|
15
|
-
|
16
|
-
class TmpAction < Cardio::Record
|
17
|
-
self.table_name = "card_actions"
|
18
|
-
end
|
19
|
-
|
20
|
-
class TmpChange < Cardio::Record
|
21
|
-
self.table_name = "card_changes"
|
22
|
-
end
|
23
|
-
|
24
|
-
class TmpCard < Cardio::Record
|
25
|
-
belongs_to :tmp_revision, foreign_key: :current_revision_id
|
26
|
-
has_many :tmp_actions, foreign_key: :card_id
|
27
|
-
self.table_name = "cards"
|
28
|
-
end
|
29
|
-
|
30
|
-
def up
|
31
|
-
TmpRevision.delete_cardless
|
32
|
-
|
33
|
-
conn = TmpRevision.connection
|
34
|
-
created = ::Set.new
|
35
|
-
|
36
|
-
TmpRevision.find_each do |rev|
|
37
|
-
TmpAct.create(
|
38
|
-
{ id: rev.id, card_id: rev.card_id, actor_id: rev.creator_id,
|
39
|
-
acted_at: rev.created_at }, without_protection: true
|
40
|
-
)
|
41
|
-
if created.include? rev.card_id
|
42
|
-
TmpAction.connection.execute "INSERT INTO card_actions (id, card_id, card_act_id, action_type) VALUES
|
43
|
-
('#{rev.id}', '#{rev.card_id}', '#{rev.id}', 1)"
|
44
|
-
TmpChange.connection.execute "INSERT INTO card_changes (card_action_id, field, value) VALUES
|
45
|
-
('#{rev.id}', 2, #{conn.quote(rev.content)})"
|
46
|
-
else
|
47
|
-
TmpAction.connection.execute "INSERT INTO card_actions (id, card_id, card_act_id, action_type) VALUES
|
48
|
-
('#{rev.id}', '#{rev.card_id}', '#{rev.id}', 0)"
|
49
|
-
|
50
|
-
if (tmp_card = rev.tmp_card)
|
51
|
-
TmpChange.connection.execute "INSERT INTO card_changes (card_action_id, field, value) VALUES
|
52
|
-
('#{rev.id}', 0, #{conn.quote tmp_card.name}),
|
53
|
-
('#{rev.id}', 1, '#{tmp_card.type_id}'),
|
54
|
-
('#{rev.id}', 2, #{conn.quote(rev.content)}),
|
55
|
-
('#{rev.id}', 3, #{tmp_card.trash})"
|
56
|
-
end
|
57
|
-
created.add rev.card_id
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
TmpCard.find_each do |card|
|
62
|
-
card.update_column(:db_content, card.tmp_revision.content) if card.tmp_revision
|
63
|
-
end
|
64
|
-
|
65
|
-
# drop_table :card_revisions
|
66
|
-
# remove_column :cards, :current_revision
|
67
|
-
end
|
68
|
-
|
69
|
-
def down; end
|
70
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class RenameCardMigrationTable < ActiveRecord::Migration[4.2]
|
2
|
-
def self.up
|
3
|
-
if ActiveRecord::Base.connection.table_exists? :schema_migrations_cards
|
4
|
-
rename_table :schema_migrations_cards, :schema_migrations_core_cards
|
5
|
-
else
|
6
|
-
create_table "schema_migrations_core_cards", id: false, force: true do |t|
|
7
|
-
t.string "version", null: false
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.down
|
13
|
-
rename_table :schema_migrations_core_cards, :schema_migrations_cards
|
14
|
-
end
|
15
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
class RenamingForMenu < Cardio::Migration::Core
|
4
|
-
def up
|
5
|
-
renames = {
|
6
|
-
"*content" => "*structure",
|
7
|
-
"*edit help" => "*help",
|
8
|
-
"*links" => "*links to",
|
9
|
-
"*inclusions" => "*includes",
|
10
|
-
"*linkers" => "*linked to by",
|
11
|
-
"*includers" => "*included by",
|
12
|
-
"*plus cards" => "*children",
|
13
|
-
"*plus parts" => "*mates",
|
14
|
-
"*editing" => "*edited"
|
15
|
-
}
|
16
|
-
renames.each do |oldname, newname|
|
17
|
-
puts "updating: #{oldname}"
|
18
|
-
c = Card[oldname]
|
19
|
-
c.name = newname
|
20
|
-
c.save!
|
21
|
-
end
|
22
|
-
|
23
|
-
codenames = %w[
|
24
|
-
by_name
|
25
|
-
by_update
|
26
|
-
by_create
|
27
|
-
refers_to
|
28
|
-
links_to
|
29
|
-
includes
|
30
|
-
referred_to_by
|
31
|
-
linked_to_by
|
32
|
-
included_by
|
33
|
-
children
|
34
|
-
mates
|
35
|
-
editors
|
36
|
-
discussion
|
37
|
-
created
|
38
|
-
edited
|
39
|
-
]
|
40
|
-
codenames.each do |codename|
|
41
|
-
name = codename =~ /^by|disc/ ? codename : "*#{codename}"
|
42
|
-
c = Card[name]
|
43
|
-
c.codename = codename
|
44
|
-
c.save!
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
class JsonizeTinymce < Cardio::Migration::Core
|
4
|
-
def up
|
5
|
-
card = Card[:tiny_mce]
|
6
|
-
cleaned_rows = card.db_content.strip.split(/\s*,\s+/).map do |row|
|
7
|
-
key, val = row.split(/\s*:\s*/)
|
8
|
-
val.gsub!(/"\s*\+\s*"/, "")
|
9
|
-
val.gsub! "'", '",'
|
10
|
-
%("#{key}":#{val})
|
11
|
-
end
|
12
|
-
card.content = %({\n#{cleaned_rows.join ",\n"}\n})
|
13
|
-
card.save!
|
14
|
-
end
|
15
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
class User < Cardio::Record
|
4
|
-
end
|
5
|
-
|
6
|
-
class UserDataToCards < Cardio::Migration::Core
|
7
|
-
def up
|
8
|
-
puts "importing all user details (for those not in trash) into +*account attributes"
|
9
|
-
User.all.each do |user|
|
10
|
-
base = Card[user.card_id]
|
11
|
-
next unless base && !base.trash
|
12
|
-
|
13
|
-
puts "~ importing details for #{base.name}"
|
14
|
-
date_args = { created_at: user.created_at, updated_at: user.updated_at }
|
15
|
-
%i[email salt password status].each do |field|
|
16
|
-
cardname = [base.name, :account, field].cardname
|
17
|
-
user_field = (field == :password ? :crypted_password : field)
|
18
|
-
next unless (content = user.send(user_field))
|
19
|
-
|
20
|
-
begin
|
21
|
-
Card.create! date_args.merge(name: cardname, content: content)
|
22
|
-
rescue StandardError => e
|
23
|
-
puts "error importing #{cardname}: #{e.message}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|