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,24 +1,23 @@
|
|
1
1
|
|
2
2
|
Description:
|
3
|
-
Generates a migration of database content.
|
4
|
-
|
5
|
-
To import database content from a json file move your json file to db/migrate_cards/data
|
6
|
-
and choose as migration name import_<filename>.
|
3
|
+
Generates a migration of database schema or content.
|
7
4
|
|
8
5
|
Example:
|
9
|
-
<%= banner_command %> generate
|
6
|
+
<%= banner_command %> generate migration better_comments -m mymod
|
10
7
|
|
11
8
|
This will create:
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
...which is set up to use methods in lib/card/migration.rb
|
10
|
+
mod/mymod/data/transform/(migration_number)_better_comments.rb
|
16
11
|
|
17
12
|
|
18
|
-
<%= banner_command %> generate
|
13
|
+
<%= banner_command %> generate migration better_comments -m mymod --schema
|
19
14
|
|
20
15
|
This will create:
|
21
16
|
|
22
|
-
|
17
|
+
mod/mymod/data/schema/(migration_number)_better_comments.rb
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
23
|
|
24
|
-
...which is set up to import data from db/migrate_cards/data/better_search_cards.json
|
@@ -3,42 +3,44 @@
|
|
3
3
|
module Cardio
|
4
4
|
module Generators
|
5
5
|
# generate structure and card migrations
|
6
|
-
class MigrationGenerator < Base
|
6
|
+
class MigrationGenerator < ActiveRecord::Generators::Base
|
7
|
+
extend ClassMethods
|
7
8
|
source_root File.expand_path("templates", __dir__)
|
8
9
|
|
9
|
-
|
10
|
+
argument :name, required: true
|
10
11
|
|
11
|
-
class_option "
|
12
|
-
default: false, group: :runtime,
|
13
|
-
desc: "Create card migration for card core"
|
12
|
+
class_option "mod", aliases: "-m", group: :runtime, desc: "mod", required: true
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
raise "No migration directory for #{migration_type}" if mig_paths.blank?
|
14
|
+
class_option "schema",
|
15
|
+
type: :boolean, lazy_default: true, group: :runtime,
|
16
|
+
desc: "Create schema migration"
|
19
17
|
|
18
|
+
def create_migration_file
|
20
19
|
set_local_assigns!
|
21
|
-
migration_template
|
22
|
-
File.join(
|
20
|
+
migration_template "card_migration.erb",
|
21
|
+
File.join(migration_path, "#{file_name}.rb")
|
23
22
|
end
|
24
23
|
|
25
24
|
protected
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
def mod_object
|
27
|
+
@mod_object ||= Cardio::Mod.fetch(options[:mod]) || raise("unknown mod: #{mod}")
|
28
|
+
end
|
29
|
+
|
30
|
+
def migration_path
|
31
|
+
mod_object.subpath "data", migration_type.to_s, force: true
|
32
|
+
end
|
33
|
+
|
34
|
+
def migration_type
|
35
|
+
options["schema"] ? :schema : :transform
|
36
|
+
end
|
37
|
+
|
38
|
+
def migration_object
|
39
|
+
Migration.new_for migration_type
|
40
|
+
end
|
32
41
|
|
33
42
|
def set_local_assigns!
|
34
|
-
@
|
35
|
-
@migration_parent_class =
|
36
|
-
options["core"] ? "Cardio::Migration::Core" : "Cardio::Migration"
|
37
|
-
case file_name
|
38
|
-
when /^(import)_(.*)(?:\.json)?/
|
39
|
-
@migration_action = Regexp.last_match(1)
|
40
|
-
@json_filename = "#{Regexp.last_match(2)}.json"
|
41
|
-
end
|
43
|
+
@migration_parent_class = Cardio::Migration.migration_class migration_type
|
42
44
|
end
|
43
45
|
end
|
44
46
|
end
|
@@ -0,0 +1,351 @@
|
|
1
|
+
---
|
2
|
+
transform_migrations_001:
|
3
|
+
version: '20120611203506'
|
4
|
+
transform_migrations_002:
|
5
|
+
version: '20130411191151'
|
6
|
+
transform_migrations_003:
|
7
|
+
version: '20130411211600'
|
8
|
+
transform_migrations_004:
|
9
|
+
version: '20130419215612'
|
10
|
+
transform_migrations_005:
|
11
|
+
version: '20130823192433'
|
12
|
+
transform_migrations_006:
|
13
|
+
version: '20130910183318'
|
14
|
+
transform_migrations_007:
|
15
|
+
version: '20130920214038'
|
16
|
+
transform_migrations_008:
|
17
|
+
version: '20130920291703'
|
18
|
+
transform_migrations_009:
|
19
|
+
version: '20130927191728'
|
20
|
+
transform_migrations_010:
|
21
|
+
version: '20131016172445'
|
22
|
+
transform_migrations_011:
|
23
|
+
version: '20140110193325'
|
24
|
+
transform_migrations_012:
|
25
|
+
version: '20140307231621'
|
26
|
+
transform_migrations_013:
|
27
|
+
version: '20140317035504'
|
28
|
+
transform_migrations_014:
|
29
|
+
version: '20140512155840'
|
30
|
+
transform_migrations_015:
|
31
|
+
version: '20140629222005'
|
32
|
+
transform_migrations_016:
|
33
|
+
version: '20140725180118'
|
34
|
+
transform_migrations_017:
|
35
|
+
version: '20141111083921'
|
36
|
+
transform_migrations_018:
|
37
|
+
version: '20141115034214'
|
38
|
+
transform_migrations_019:
|
39
|
+
version: '20141119001955'
|
40
|
+
transform_migrations_020:
|
41
|
+
version: '20141120120605'
|
42
|
+
transform_migrations_021:
|
43
|
+
version: '20141204061304'
|
44
|
+
transform_migrations_022:
|
45
|
+
version: '20141208132416'
|
46
|
+
transform_migrations_023:
|
47
|
+
version: '20141216155251'
|
48
|
+
transform_migrations_024:
|
49
|
+
version: '20141230204340'
|
50
|
+
transform_migrations_025:
|
51
|
+
version: '20150116220620'
|
52
|
+
transform_migrations_026:
|
53
|
+
version: '20150202143810'
|
54
|
+
transform_migrations_027:
|
55
|
+
version: '20150220134731'
|
56
|
+
transform_migrations_028:
|
57
|
+
version: '20150317162412'
|
58
|
+
transform_migrations_029:
|
59
|
+
version: '20150326205655'
|
60
|
+
transform_migrations_030:
|
61
|
+
version: '20150331135745'
|
62
|
+
transform_migrations_031:
|
63
|
+
version: '20150429090551'
|
64
|
+
transform_migrations_032:
|
65
|
+
version: '20150501010515'
|
66
|
+
transform_migrations_033:
|
67
|
+
version: '20150508212032'
|
68
|
+
transform_migrations_034:
|
69
|
+
version: '20150510031118'
|
70
|
+
transform_migrations_035:
|
71
|
+
version: '20150528084659'
|
72
|
+
transform_migrations_036:
|
73
|
+
version: '20150601133433'
|
74
|
+
transform_migrations_037:
|
75
|
+
version: '20150605115802'
|
76
|
+
transform_migrations_038:
|
77
|
+
version: '20150610171702'
|
78
|
+
transform_migrations_039:
|
79
|
+
version: '20150610180019'
|
80
|
+
transform_migrations_040:
|
81
|
+
version: '20150627205133'
|
82
|
+
transform_migrations_041:
|
83
|
+
version: '20150702130543'
|
84
|
+
transform_migrations_042:
|
85
|
+
version: '20150708224756'
|
86
|
+
transform_migrations_043:
|
87
|
+
version: '20150724123438'
|
88
|
+
transform_migrations_044:
|
89
|
+
version: '20150807205221'
|
90
|
+
transform_migrations_045:
|
91
|
+
version: '20150824135418'
|
92
|
+
transform_migrations_046:
|
93
|
+
version: '20150903130006'
|
94
|
+
transform_migrations_047:
|
95
|
+
version: '20150910085603'
|
96
|
+
transform_migrations_048:
|
97
|
+
version: '20151120180631'
|
98
|
+
transform_migrations_049:
|
99
|
+
version: '20160801143221'
|
100
|
+
transform_migrations_050:
|
101
|
+
version: '20160801175002'
|
102
|
+
transform_migrations_051:
|
103
|
+
version: '20160804112340'
|
104
|
+
transform_migrations_052:
|
105
|
+
version: '20160804112510'
|
106
|
+
transform_migrations_053:
|
107
|
+
version: '20160804112538'
|
108
|
+
transform_migrations_054:
|
109
|
+
version: '20160804112547'
|
110
|
+
transform_migrations_055:
|
111
|
+
version: '20160804112548'
|
112
|
+
transform_migrations_056:
|
113
|
+
version: '20160804112560'
|
114
|
+
transform_migrations_057:
|
115
|
+
version: '20160805112548'
|
116
|
+
transform_migrations_058:
|
117
|
+
version: '20160806112710'
|
118
|
+
transform_migrations_059:
|
119
|
+
version: '20160811115836'
|
120
|
+
transform_migrations_060:
|
121
|
+
version: '20160812112513'
|
122
|
+
transform_migrations_061:
|
123
|
+
version: '20160908154210'
|
124
|
+
transform_migrations_062:
|
125
|
+
version: '20160914132636'
|
126
|
+
transform_migrations_063:
|
127
|
+
version: '20161102202156'
|
128
|
+
transform_migrations_064:
|
129
|
+
version: '20161103154836'
|
130
|
+
transform_migrations_065:
|
131
|
+
version: '20170209132834'
|
132
|
+
transform_migrations_066:
|
133
|
+
version: '20170314175313'
|
134
|
+
transform_migrations_067:
|
135
|
+
version: '20170515101262'
|
136
|
+
transform_migrations_068:
|
137
|
+
version: '20170608083819'
|
138
|
+
transform_migrations_069:
|
139
|
+
version: '20170608200649'
|
140
|
+
transform_migrations_070:
|
141
|
+
version: '20170719163733'
|
142
|
+
transform_migrations_071:
|
143
|
+
version: '20170720093738'
|
144
|
+
transform_migrations_072:
|
145
|
+
version: '20170726111053'
|
146
|
+
transform_migrations_073:
|
147
|
+
version: '20170726145012'
|
148
|
+
transform_migrations_074:
|
149
|
+
version: '20170830210517'
|
150
|
+
transform_migrations_075:
|
151
|
+
version: '20171110164934'
|
152
|
+
transform_migrations_076:
|
153
|
+
version: '20171113233151'
|
154
|
+
transform_migrations_077:
|
155
|
+
version: '20180215143733'
|
156
|
+
transform_migrations_078:
|
157
|
+
version: '20180216173344'
|
158
|
+
transform_migrations_079:
|
159
|
+
version: '20180404144130'
|
160
|
+
transform_migrations_080:
|
161
|
+
version: '20180423120222'
|
162
|
+
transform_migrations_081:
|
163
|
+
version: '20180423143146'
|
164
|
+
transform_migrations_082:
|
165
|
+
version: '20180423143147'
|
166
|
+
transform_migrations_083:
|
167
|
+
version: '20180423160231'
|
168
|
+
transform_migrations_084:
|
169
|
+
version: '20180423170283'
|
170
|
+
transform_migrations_085:
|
171
|
+
version: '20180425174432'
|
172
|
+
transform_migrations_086:
|
173
|
+
version: '20180425174433'
|
174
|
+
transform_migrations_087:
|
175
|
+
version: '20180508210903'
|
176
|
+
transform_migrations_088:
|
177
|
+
version: '20180509090433'
|
178
|
+
transform_migrations_089:
|
179
|
+
version: '20180509141814'
|
180
|
+
transform_migrations_090:
|
181
|
+
version: '20180509141815'
|
182
|
+
transform_migrations_091:
|
183
|
+
version: '20180515175726'
|
184
|
+
transform_migrations_092:
|
185
|
+
version: '20180516153037'
|
186
|
+
transform_migrations_093:
|
187
|
+
version: '20180601133753'
|
188
|
+
transform_migrations_094:
|
189
|
+
version: '20180712042655'
|
190
|
+
transform_migrations_095:
|
191
|
+
version: '20180805112548'
|
192
|
+
transform_migrations_096:
|
193
|
+
version: '20180905061534'
|
194
|
+
transform_migrations_097:
|
195
|
+
version: '20180905061536'
|
196
|
+
transform_migrations_098:
|
197
|
+
version: '20180905061537'
|
198
|
+
transform_migrations_099:
|
199
|
+
version: '20181108181219'
|
200
|
+
transform_migrations_100:
|
201
|
+
version: '20181120200937'
|
202
|
+
transform_migrations_101:
|
203
|
+
version: '20181129140917'
|
204
|
+
transform_migrations_102:
|
205
|
+
version: '20190125125150'
|
206
|
+
transform_migrations_103:
|
207
|
+
version: '20190204195038'
|
208
|
+
transform_migrations_104:
|
209
|
+
version: '20190204195039'
|
210
|
+
transform_migrations_105:
|
211
|
+
version: '20190228122633'
|
212
|
+
transform_migrations_106:
|
213
|
+
version: '20190228122634'
|
214
|
+
transform_migrations_107:
|
215
|
+
version: '20190228122635'
|
216
|
+
transform_migrations_108:
|
217
|
+
version: '20190228122636'
|
218
|
+
transform_migrations_109:
|
219
|
+
version: '20190228122638'
|
220
|
+
transform_migrations_110:
|
221
|
+
version: '20190228122739'
|
222
|
+
transform_migrations_111:
|
223
|
+
version: '20190306172622'
|
224
|
+
transform_migrations_112:
|
225
|
+
version: '20190306172623'
|
226
|
+
transform_migrations_113:
|
227
|
+
version: '20190306172890'
|
228
|
+
transform_migrations_114:
|
229
|
+
version: '20190320091257'
|
230
|
+
transform_migrations_115:
|
231
|
+
version: '20190321085735'
|
232
|
+
transform_migrations_116:
|
233
|
+
version: '20190322095534'
|
234
|
+
transform_migrations_117:
|
235
|
+
version: '20190417142612'
|
236
|
+
transform_migrations_118:
|
237
|
+
version: '20190424100531'
|
238
|
+
transform_migrations_119:
|
239
|
+
version: '20190424101004'
|
240
|
+
transform_migrations_120:
|
241
|
+
version: '20190502130024'
|
242
|
+
transform_migrations_121:
|
243
|
+
version: '201905021300268'
|
244
|
+
transform_migrations_122:
|
245
|
+
version: '20190502130029'
|
246
|
+
transform_migrations_123:
|
247
|
+
version: '20190503122738'
|
248
|
+
transform_migrations_124:
|
249
|
+
version: '20190503122739'
|
250
|
+
transform_migrations_125:
|
251
|
+
version: '20190528131330'
|
252
|
+
transform_migrations_126:
|
253
|
+
version: '20190528141530'
|
254
|
+
transform_migrations_127:
|
255
|
+
version: '20190605133556'
|
256
|
+
transform_migrations_128:
|
257
|
+
version: '20190618110446'
|
258
|
+
transform_migrations_129:
|
259
|
+
version: '20190621143156'
|
260
|
+
transform_migrations_130:
|
261
|
+
version: '20190625153614'
|
262
|
+
transform_migrations_131:
|
263
|
+
version: '20190625153615'
|
264
|
+
transform_migrations_132:
|
265
|
+
version: '20190625153616'
|
266
|
+
transform_migrations_133:
|
267
|
+
version: '20190710090205'
|
268
|
+
transform_migrations_134:
|
269
|
+
version: '20190710090207'
|
270
|
+
transform_migrations_135:
|
271
|
+
version: '20190710090208'
|
272
|
+
transform_migrations_136:
|
273
|
+
version: '20190710090209'
|
274
|
+
transform_migrations_137:
|
275
|
+
version: '20190718140125'
|
276
|
+
transform_migrations_138:
|
277
|
+
version: '20190718140126'
|
278
|
+
transform_migrations_139:
|
279
|
+
version: '20190820155833'
|
280
|
+
transform_migrations_140:
|
281
|
+
version: '20190822093633'
|
282
|
+
transform_migrations_141:
|
283
|
+
version: '20190823220017'
|
284
|
+
transform_migrations_142:
|
285
|
+
version: '20190823220018'
|
286
|
+
transform_migrations_143:
|
287
|
+
version: '20190826132738'
|
288
|
+
transform_migrations_144:
|
289
|
+
version: '20190829093961'
|
290
|
+
transform_migrations_145:
|
291
|
+
version: '20190829151731'
|
292
|
+
transform_migrations_146:
|
293
|
+
version: '20190829205148'
|
294
|
+
transform_migrations_147:
|
295
|
+
version: '20190830131820'
|
296
|
+
transform_migrations_148:
|
297
|
+
version: '20190902161223'
|
298
|
+
transform_migrations_149:
|
299
|
+
version: '20190902193208'
|
300
|
+
transform_migrations_150:
|
301
|
+
version: '20190904174403'
|
302
|
+
transform_migrations_151:
|
303
|
+
version: '20190909104250'
|
304
|
+
transform_migrations_152:
|
305
|
+
version: '20190918200115'
|
306
|
+
transform_migrations_153:
|
307
|
+
version: '20190927112151'
|
308
|
+
transform_migrations_154:
|
309
|
+
version: '20191008201046'
|
310
|
+
transform_migrations_155:
|
311
|
+
version: '20191014204655'
|
312
|
+
transform_migrations_156:
|
313
|
+
version: '20191028135243'
|
314
|
+
transform_migrations_157:
|
315
|
+
version: '20191115160748'
|
316
|
+
transform_migrations_158:
|
317
|
+
version: '20191118145629'
|
318
|
+
transform_migrations_159:
|
319
|
+
version: '20200804112345'
|
320
|
+
transform_migrations_160:
|
321
|
+
version: '20200804112346'
|
322
|
+
transform_migrations_161:
|
323
|
+
version: '20200804112347'
|
324
|
+
transform_migrations_162:
|
325
|
+
version: '20200804112348'
|
326
|
+
transform_migrations_163:
|
327
|
+
version: '20200805112346'
|
328
|
+
transform_migrations_164:
|
329
|
+
version: '20200806112346'
|
330
|
+
transform_migrations_165:
|
331
|
+
version: '20200809112346'
|
332
|
+
transform_migrations_166:
|
333
|
+
version: '20200821231558'
|
334
|
+
transform_migrations_167:
|
335
|
+
version: '20201115133753'
|
336
|
+
transform_migrations_168:
|
337
|
+
version: '20201129140917'
|
338
|
+
transform_migrations_169:
|
339
|
+
version: '20210509141814'
|
340
|
+
transform_migrations_170:
|
341
|
+
version: '202108028112350'
|
342
|
+
transform_migrations_171:
|
343
|
+
version: '202108028112351'
|
344
|
+
transform_migrations_172:
|
345
|
+
version: '202108028112352'
|
346
|
+
transform_migrations_173:
|
347
|
+
version: '20211107155032'
|
348
|
+
schema_migrations_deck_cards_001:
|
349
|
+
version: '20150116220621'
|
350
|
+
schema_migrations_deck_cards_002:
|
351
|
+
version: '20210504195646'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
|
-
class RequireEarlierMigrations <
|
4
|
-
def
|
3
|
+
class RequireEarlierMigrations < Cardio::Migration::Schema
|
4
|
+
def up
|
5
5
|
raise %(
|
6
6
|
Your database is not ready to be migrated to #{Cardio::Version.release}.
|
7
7
|
You will need to do incremental upgrades.
|
@@ -12,7 +12,7 @@ Sorry about this! We're working to minimize these hassles in the future.
|
|
12
12
|
)
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
15
|
+
def down
|
16
16
|
raise "Older migrations have been removed because of incompatibility."
|
17
17
|
end
|
18
18
|
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
class MoveRevisionsToActions < Cardio::Migration::Schema
|
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 cards "\
|
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
|
+
TmpRevision.find_each { |rev| migrate_revision rev }
|
33
|
+
TmpCard.find_each { |card| update_tmp_card card }
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def conn
|
39
|
+
@conn ||= TmpRevision.connection
|
40
|
+
end
|
41
|
+
|
42
|
+
def created
|
43
|
+
@created ||= ::Set.new
|
44
|
+
end
|
45
|
+
|
46
|
+
def migrate_revision rev
|
47
|
+
create_tmp_act rev
|
48
|
+
|
49
|
+
if created.include? rev.card_id
|
50
|
+
create_update_action rev
|
51
|
+
else
|
52
|
+
create_create_action rev
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def create_create_action rev
|
57
|
+
TmpAction.connection.execute(
|
58
|
+
"INSERT INTO card_actions (id, card_id, card_act_id, action_type) VALUES "\
|
59
|
+
"('#{rev.id}', '#{rev.card_id}', '#{rev.id}', 0)")
|
60
|
+
if (tmp_card = rev.tmp_card)
|
61
|
+
TmpChange.connection.execute "INSERT INTO card_changes (card_action_id, field, value) VALUES
|
62
|
+
('#{rev.id}', 0, #{conn.quote tmp_card.name}),
|
63
|
+
('#{rev.id}', 1, '#{tmp_card.type_id}'),
|
64
|
+
('#{rev.id}', 2, #{conn.quote(rev.content)}),
|
65
|
+
('#{rev.id}', 3, #{tmp_card.trash})"
|
66
|
+
end
|
67
|
+
created.add rev.card_id
|
68
|
+
end
|
69
|
+
|
70
|
+
def create_update_action rev
|
71
|
+
TmpAction.connection.execute(
|
72
|
+
"INSERT INTO card_actions (id, card_id, card_act_id, action_type) VALUES " \
|
73
|
+
"('#{rev.id}', '#{rev.card_id}', '#{rev.id}', 1)")
|
74
|
+
TmpChange.connection.execute(
|
75
|
+
"INSERT INTO card_changes (card_action_id, field, value) VALUES " \
|
76
|
+
"('#{rev.id}', 2, #{conn.quote(rev.content)})")
|
77
|
+
end
|
78
|
+
|
79
|
+
def create_tmp_act rev
|
80
|
+
TmpAct.create id: rev.id, card_id: rev.card_id,
|
81
|
+
actor_id: rev.creator_id, acted_at: rev.created_at
|
82
|
+
end
|
83
|
+
|
84
|
+
def update_tmp_card card
|
85
|
+
card.update_column(:db_content, card.tmp_revision.content) if card.tmp_revision
|
86
|
+
end
|
87
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class BetterIndexNames <
|
1
|
+
class BetterIndexNames < Cardio::Migration::Schema
|
2
2
|
def up
|
3
3
|
rename_index :card_acts, "actor_id_index", "card_acts_actor_id_index"
|
4
4
|
rename_index :card_acts, "card_id_index", "card_acts_card_id_index"
|
@@ -18,9 +18,15 @@ class BetterIndexNames < ActiveRecord::Migration[4.2]
|
|
18
18
|
|
19
19
|
rename_index :cards, "cards_key_uniq", "cards_key_index"
|
20
20
|
rename_index :cards, "card_type_index", "cards_type_id_index"
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
rename_index_robustly :trunk, :left
|
22
|
+
rename_index_robustly :tag, :right
|
23
|
+
rename_index_robustly :read_rule, :read_rule
|
24
|
+
end
|
25
|
+
|
26
|
+
def rename_index_robustly old, new
|
27
|
+
rename_index :cards, "index_cards_on_#{old}_id", "cards_#{new}_id_index"
|
28
|
+
rescue ActiveRecord::StatementInvalid
|
29
|
+
rename_index :cards, "index_cards_on_#{new}_id", "cards_#{new}_id_index"
|
24
30
|
end
|
25
31
|
|
26
32
|
def down; end
|