ridgepole 0.9.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +4 -0
  3. data/CHANGELOG.md +238 -0
  4. data/README.md +12 -142
  5. data/bin/ridgepole +1 -1
  6. data/docker-compose.yml +26 -18
  7. data/gemfiles/activerecord_7.0.gemfile +7 -0
  8. data/lib/ridgepole/delta.rb +1 -1
  9. data/lib/ridgepole/diff.rb +4 -1
  10. data/lib/ridgepole/execute_expander.rb +5 -2
  11. data/lib/ridgepole/ext/abstract_adapter/disable_table_options.rb +1 -0
  12. data/lib/ridgepole/version.rb +1 -1
  13. data/ridgepole.gemspec +8 -5
  14. metadata +10 -284
  15. data/.github/workflows/test.yml +0 -70
  16. data/.gitignore +0 -25
  17. data/spec/cli_helper.rb +0 -65
  18. data/spec/dsl_parser/context_spec.rb +0 -16
  19. data/spec/erb_helper.rb +0 -26
  20. data/spec/fixtures/for_require_relative_spec.rb +0 -3
  21. data/spec/hide_pending_formatter.rb +0 -9
  22. data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +0 -40
  23. data/spec/mysql/bigint_pk/int_pk_spec.rb +0 -47
  24. data/spec/mysql/cli/config_spec.rb +0 -210
  25. data/spec/mysql/cli/ridgepole_spec.rb +0 -447
  26. data/spec/mysql/collation/collation_spec.rb +0 -153
  27. data/spec/mysql/comment/comment_spec.rb +0 -179
  28. data/spec/mysql/default_lambda/default_lambda_spec.rb +0 -164
  29. data/spec/mysql/diff/diff2_spec.rb +0 -189
  30. data/spec/mysql/diff/diff_spec.rb +0 -168
  31. data/spec/mysql/dump/dump_class_method_spec.rb +0 -74
  32. data/spec/mysql/dump/dump_some_tables_spec.rb +0 -70
  33. data/spec/mysql/dump/dump_spec.rb +0 -74
  34. data/spec/mysql/dump/dump_unknown_column_type_spec.rb +0 -28
  35. data/spec/mysql/dump/dump_without_table_options_spec.rb +0 -34
  36. data/spec/mysql/fk/migrate_change_fk2_spec.rb +0 -47
  37. data/spec/mysql/fk/migrate_change_fk_spec.rb +0 -265
  38. data/spec/mysql/fk/migrate_create_fk_spec.rb +0 -349
  39. data/spec/mysql/fk/migrate_drop_fk_spec.rb +0 -331
  40. data/spec/mysql/fk/migrate_fk_with_column_spec.rb +0 -163
  41. data/spec/mysql/fk/migrate_ignore_fk_spec.rb +0 -70
  42. data/spec/mysql/migrate/check_orphan_index_spec.rb +0 -83
  43. data/spec/mysql/migrate/migrate_add_column2_spec.rb +0 -159
  44. data/spec/mysql/migrate/migrate_add_column_order_spec.rb +0 -242
  45. data/spec/mysql/migrate/migrate_add_column_spec.rb +0 -161
  46. data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +0 -231
  47. data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +0 -152
  48. data/spec/mysql/migrate/migrate_change_column2_spec.rb +0 -91
  49. data/spec/mysql/migrate/migrate_change_column3_spec.rb +0 -404
  50. data/spec/mysql/migrate/migrate_change_column4_spec.rb +0 -83
  51. data/spec/mysql/migrate/migrate_change_column5_spec.rb +0 -129
  52. data/spec/mysql/migrate/migrate_change_column6_spec.rb +0 -241
  53. data/spec/mysql/migrate/migrate_change_column7_spec.rb +0 -34
  54. data/spec/mysql/migrate/migrate_change_column8_spec.rb +0 -87
  55. data/spec/mysql/migrate/migrate_change_column_default_spec.rb +0 -199
  56. data/spec/mysql/migrate/migrate_change_column_float_spec.rb +0 -75
  57. data/spec/mysql/migrate/migrate_change_column_spec.rb +0 -158
  58. data/spec/mysql/migrate/migrate_change_index2_spec.rb +0 -86
  59. data/spec/mysql/migrate/migrate_change_index3_spec.rb +0 -179
  60. data/spec/mysql/migrate/migrate_change_index4_spec.rb +0 -112
  61. data/spec/mysql/migrate/migrate_change_index5_spec.rb +0 -74
  62. data/spec/mysql/migrate/migrate_change_index6_spec.rb +0 -202
  63. data/spec/mysql/migrate/migrate_change_index7_spec.rb +0 -85
  64. data/spec/mysql/migrate/migrate_change_index8_spec.rb +0 -85
  65. data/spec/mysql/migrate/migrate_change_index_spec.rb +0 -235
  66. data/spec/mysql/migrate/migrate_change_table_comment_spec.rb +0 -72
  67. data/spec/mysql/migrate/migrate_change_table_option_spec.rb +0 -83
  68. data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +0 -225
  69. data/spec/mysql/migrate/migrate_create_index2_spec.rb +0 -203
  70. data/spec/mysql/migrate/migrate_create_index_spec.rb +0 -220
  71. data/spec/mysql/migrate/migrate_create_table_spec.rb +0 -123
  72. data/spec/mysql/migrate/migrate_create_table_with_ignore_spec.rb +0 -45
  73. data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +0 -43
  74. data/spec/mysql/migrate/migrate_create_table_with_options_spec.rb +0 -59
  75. data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +0 -132
  76. data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +0 -140
  77. data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +0 -167
  78. data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +0 -52
  79. data/spec/mysql/migrate/migrate_drop_column_spec.rb +0 -158
  80. data/spec/mysql/migrate/migrate_drop_index_spec.rb +0 -160
  81. data/spec/mysql/migrate/migrate_drop_table_spec.rb +0 -123
  82. data/spec/mysql/migrate/migrate_duplicate_index_spec.rb +0 -27
  83. data/spec/mysql/migrate/migrate_duplicate_table_spec.rb +0 -37
  84. data/spec/mysql/migrate/migrate_empty_spec.rb +0 -78
  85. data/spec/mysql/migrate/migrate_execute_spec.rb +0 -288
  86. data/spec/mysql/migrate/migrate_ignore_column_spec.rb +0 -98
  87. data/spec/mysql/migrate/migrate_ignore_index_spec.rb +0 -92
  88. data/spec/mysql/migrate/migrate_log_file_spec.rb +0 -125
  89. data/spec/mysql/migrate/migrate_merge_mode_spec.rb +0 -145
  90. data/spec/mysql/migrate/migrate_noop_spec.rb +0 -234
  91. data/spec/mysql/migrate/migrate_primary_key_spec.rb +0 -104
  92. data/spec/mysql/migrate/migrate_rename_column_spec.rb +0 -184
  93. data/spec/mysql/migrate/migrate_rename_table_spec.rb +0 -241
  94. data/spec/mysql/migrate/migrate_same_default_null_spec.rb +0 -77
  95. data/spec/mysql/migrate/migrate_same_spec.rb +0 -82
  96. data/spec/mysql/migrate/migrate_script_error_spec.rb +0 -91
  97. data/spec/mysql/migrate/migrate_skip_column_comment_change_spec.rb +0 -39
  98. data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +0 -145
  99. data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +0 -140
  100. data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +0 -141
  101. data/spec/mysql/migrate/migrate_with_ignore_tables_spec.rb +0 -307
  102. data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +0 -153
  103. data/spec/mysql/migrate/migrate_with_tables_spec.rb +0 -149
  104. data/spec/mysql/migrate/migrate_with_verbose_log_spec.rb +0 -60
  105. data/spec/mysql/ridgepole_test_database.sql +0 -2
  106. data/spec/mysql/ridgepole_test_tables.sql +0 -79
  107. data/spec/mysql/ridgepole_test_tables_unknown_column_type.sql +0 -17
  108. data/spec/mysql/text_blob_types/text_blob_types_spec.rb +0 -131
  109. data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +0 -59
  110. data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +0 -133
  111. data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +0 -100
  112. data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +0 -43
  113. data/spec/mysql57/json/add_json_column_spec.rb +0 -35
  114. data/spec/mysql57/json/change_json_column_spec.rb +0 -102
  115. data/spec/mysql57/json/drop_json_column_spec.rb +0 -35
  116. data/spec/mysql57/virtual/add_virtual_column_spec.rb +0 -37
  117. data/spec/mysql57/virtual/change_virtual_column_spec.rb +0 -40
  118. data/spec/mysql57/virtual/drop_virtual_column_spec.rb +0 -37
  119. data/spec/postgresql/diff/diff_spec.rb +0 -216
  120. data/spec/postgresql/dump/dump_spec.rb +0 -69
  121. data/spec/postgresql/fk/migrate_change_fk_spec.rb +0 -115
  122. data/spec/postgresql/fk/migrate_create_fk_spec.rb +0 -176
  123. data/spec/postgresql/fk/migrate_drop_fk_spec.rb +0 -197
  124. data/spec/postgresql/migrate/migrate_add_column_spec.rb +0 -203
  125. data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +0 -25
  126. data/spec/postgresql/migrate/migrate_bigint_spec.rb +0 -53
  127. data/spec/postgresql/migrate/migrate_change_column_default_spec.rb +0 -38
  128. data/spec/postgresql/migrate/migrate_change_column_spec.rb +0 -185
  129. data/spec/postgresql/migrate/migrate_change_index_spec.rb +0 -164
  130. data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +0 -114
  131. data/spec/postgresql/migrate/migrate_create_table_spec.rb +0 -120
  132. data/spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb +0 -112
  133. data/spec/postgresql/migrate/migrate_drop_column_spec.rb +0 -163
  134. data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +0 -166
  135. data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +0 -59
  136. data/spec/postgresql/migrate/migrate_drop_index_spec.rb +0 -158
  137. data/spec/postgresql/migrate/migrate_drop_table_spec.rb +0 -122
  138. data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +0 -64
  139. data/spec/postgresql/migrate/migrate_primary_key2_spec.rb +0 -73
  140. data/spec/postgresql/migrate/migrate_primary_key_spec.rb +0 -99
  141. data/spec/postgresql/migrate/migrate_references_spec.rb +0 -90
  142. data/spec/postgresql/migrate/migrate_rename_column_spec.rb +0 -155
  143. data/spec/postgresql/migrate/migrate_rename_table_spec.rb +0 -175
  144. data/spec/postgresql/migrate/migrate_same_spec.rb +0 -77
  145. data/spec/postgresql/ridgepole_test_database.sql +0 -16
  146. data/spec/postgresql/ridgepole_test_tables.sql +0 -75
  147. data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +0 -59
  148. data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +0 -134
  149. data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +0 -100
  150. data/spec/processing_for_ci.rb +0 -13
  151. data/spec/spec_condition.rb +0 -58
  152. data/spec/spec_const.rb +0 -20
  153. data/spec/spec_helper.rb +0 -173
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3453e48af2d76cbb35301fcc70d7177f0016c47f4279593b6adbf269190d0b01
4
- data.tar.gz: e4e61ed5bbbfae92a0660244a4e021fc387d945ccd5e85971d20c1ff184dc79f
3
+ metadata.gz: dd3d82e112d8ef525a7a909538e864b1dc6b4d1b6eaabad978e2ec552962fd63
4
+ data.tar.gz: 76dcd540c7ae97d1c226077f2b09979fa16e9937ec8a8d8d9f81b001bcdb2ee2
5
5
  SHA512:
6
- metadata.gz: aa213105207d7a0a73adae7254885966fb06b0e0cc22cec7e2e44f7bd2082f7a6b10b2e7d8b5c5822c57b333447cd8ebb591db691b95a541f1493adcf3d46153
7
- data.tar.gz: 3e1a1c8bbcde1f7d313df1a151d5ca3096e1bba911a099cc4e8969b877941dd85061d2c3d18c17afff976c5119d3cc00f9c9966f9037af5365d8d5b0c87243c0
6
+ metadata.gz: f641654487c60639c6de8633cba4ee8d3dc55a52b200ee43857f670a818c6699ba4271de56616152b8d378aac2c0e1eee118c17aa362c2e5e451542e5be540c3
7
+ data.tar.gz: b502738eb29e65a73e03dc0d64cec03cb250227c319888d65c7869bb123166fbd6354a9accfb25072484ed50e4bbbccd98e674b89dad51618341284bc8c1aeed
data/Appraisals CHANGED
@@ -16,3 +16,7 @@ end
16
16
  appraise 'activerecord-6.1' do
17
17
  gem 'activerecord', '~> 6.1.0'
18
18
  end
19
+
20
+ appraise 'activerecord-7.0' do
21
+ gem 'activerecord', '~> 7.0.0'
22
+ end
data/CHANGELOG.md ADDED
@@ -0,0 +1,238 @@
1
+ # Changelog
2
+
3
+ ## 1.0 (2021/12/19)
4
+
5
+ * Support Rails 7.0
6
+ * `--skip-drop-table` by default ([pull#363](https://github.com/winebarrel/ridgepole/pull/363))
7
+
8
+ ## 0.9
9
+
10
+ ### 0.9.6
11
+
12
+ * Fix malformed error ([pull#362](https://github.com/winebarrel/ridgepole/pull/362))
13
+
14
+ ### 0.9.5
15
+
16
+ * Call `super` in `disable_table_options.rb` ([pull#357](https://github.com/winebarrel/ridgepole/pull/357))
17
+
18
+ ### 0.9.4
19
+
20
+ * Fix `--alter-extra` option for unique index ([pull#356](https://github.com/winebarrel/ridgepole/pull/356))
21
+
22
+ ### 0.9.3
23
+
24
+ * Fix `limit` option for `t.integer` ([pull#354](https://github.com/winebarrel/ridgepole/pull/354))
25
+
26
+ ### 0.9.2
27
+
28
+ * Support `t.column index option` ([pull#353](https://github.com/winebarrel/ridgepole/pull/353))
29
+
30
+ ### 0.9.1
31
+
32
+ * Support `t.foreign_key` ([pull#348](https://github.com/winebarrel/ridgepole/pull/348))
33
+
34
+ ### 0.9.0
35
+
36
+ * Remove `--mysql-use-alter` option ([pull#330](https://github.com/winebarrel/ridgepole/pull/330))
37
+ * Add `--table-hash-options` option ([pull#331](https://github.com/winebarrel/ridgepole/pull/331))
38
+ * Support Rails 6.1 ([pull#323](https://github.com/winebarrel/ridgepole/pull/323))
39
+ * Disable Rails 5.0 support ([pull#335](https://github.com/winebarrel/ridgepole/pull/335))
40
+ * Fix PK AUTO_INCREMENT change bug ([pull#334](https://github.com/winebarrel/ridgepole/pull/334))
41
+
42
+ ## 0.8
43
+
44
+ ### 0.8.13
45
+
46
+ * Support `serial` and `bigserial` column types ([pull#321](https://github.com/winebarrel/ridgepole/pull/321))
47
+
48
+ ### 0.8.12
49
+
50
+ * Pluralize column specified by `references` ([pull#317](https://github.com/winebarrel/ridgepole/pull/317))
51
+
52
+ ### 0.8.11
53
+
54
+ * Fix FK index check support multiple PK ([pull#315](https://github.com/winebarrel/ridgepole/pull/315))
55
+ * Support t.reference() foreign_key option ([pull#316](https://github.com/winebarrel/ridgepole/pull/316))
56
+
57
+ ### 0.8.10
58
+
59
+ * Raise an error if an InnoDB column has a foreign key but no index ([pull#310](https://github.com/winebarrel/ridgepole/pull/310))
60
+
61
+ ### 0.8.9
62
+
63
+ * Fix unexpected differences on text types and blob types on Rails 6 ([pull#306](https://github.com/winebarrel/ridgepole/pull/306))
64
+ * Fix unexpected warning when a foreign key is added on the primary key ([pull#307](https://github.com/winebarrel/ridgepole/pull/307))
65
+
66
+ ### 0.8.8
67
+
68
+ * Fix keyword arguments warnings in Ruby 2.7 ([pull#303](https://github.com/winebarrel/ridgepole/pull/303))
69
+
70
+ ### 0.8.7
71
+
72
+ * Support `require_relative` ([pull#298](https://github.com/winebarrel/ridgepole/pull/298))
73
+
74
+ ### 0.8.6
75
+
76
+ * Support multiple databases feature ([pull#297](https://github.com/winebarrel/ridgepole/pull/297))
77
+
78
+ ### 0.8.5
79
+
80
+ * Improve warning message on table options ([pull#291](https://github.com/winebarrel/ridgepole/pull/291))
81
+
82
+ ### 0.8.4
83
+
84
+ * Display a warning if an InnoDB table doesn't have any indexes on a column where it has a foreign key ([pull#290](https://github.com/winebarrel/ridgepole/pull/290))
85
+
86
+ ### 0.8.3
87
+
88
+ * Fix "topological sort failed" error ([pull#287](https://github.com/winebarrel/ridgepole/pull/287))
89
+
90
+ ### 0.8.2
91
+
92
+ * Support `postgres://` schema ([pull#285](https://github.com/winebarrel/ridgepole/pull/285))
93
+
94
+ ### 0.8.1
95
+
96
+ * Drop tables in an order considering foreign key constraints ([pull#284](https://github.com/winebarrel/ridgepole/pull/284))
97
+
98
+ ### 0.8.0
99
+
100
+ * Support Rails 6.0
101
+
102
+ ## 0.7
103
+
104
+ ### 0.7.8
105
+
106
+ * Fix for `add_foreign_key(..., column: ,,,)` ([pull#278](https://github.com/winebarrel/ridgepole/pull/278))
107
+
108
+ ### 0.7.7
109
+
110
+ * Support URI query string ([pull#273](https://github.com/winebarrel/ridgepole/pull/273))
111
+
112
+ ### 0.7.6
113
+
114
+ * Fix database url check ([pull#266](https://github.com/winebarrel/ridgepole/pull/266))
115
+ * Add ignore option ([pull#267](https://github.com/winebarrel/ridgepole/pull/267))
116
+
117
+ ### 0.7.5
118
+
119
+ * Fix polymorphic options ([pull#263](https://github.com/winebarrel/ridgepole/pull/263))
120
+ * Fix `--mysql-use-alter` option ([pull#246](https://github.com/winebarrel/ridgepole/pull/264))
121
+ * Fix Database URI parsing ([pull#265](https://github.com/winebarrel/ridgepole/pull/265))
122
+
123
+ ### 0.7.4
124
+
125
+ * Fix `add_foreign_key` options ([issue#250](https://github.com/winebarrel/ridgepole/issues/250))
126
+
127
+ ### 0.7.3
128
+
129
+ * Add `--mysql-change-table-comment option` ([pull#166](https://github.com/winebarrel/ridgepole/pull/166))
130
+ * Refactoring with RuboCop
131
+ * Support primary key adding/dropping ([issue#246](https://github.com/winebarrel/ridgepole/issues/246))
132
+
133
+ ### 0.7.2
134
+
135
+ * Support Rails 5.2
136
+
137
+ ### 0.7.1
138
+
139
+ * Remove `--reverse` option
140
+ * Add `--allow-pk-change` option
141
+ * Add `--create-table-with-index` option
142
+ * Add `--mysql-dump-auto-increment` option (`rails >= 5.1`)
143
+
144
+ ### 0.7.0
145
+
146
+ * Remove Rails 4.x support
147
+ * Add Rails 5.1 support
148
+ * Remove `--enable-mysql-awesome` option
149
+ * Add `--skip-drop-table` option
150
+ * Support foreign key without name
151
+ * Support MySQL JSON Type and Generated Columns
152
+ * Add `--mysql-change-table-options` option
153
+ * Pass config from env
154
+ * Fix change fk order
155
+ * Add `--check-relation-type` option
156
+ * Add `--skip-column-comment-change` option
157
+ * Add `--default-bigint-limit` option
158
+ * Add `--ignore-table-comment` option
159
+
160
+ ## 0.6
161
+
162
+ ### 0.6.6
163
+
164
+ * Use `t.column` for migration ([pull#114](https://github.com/winebarrel/ridgepole/pull/114))
165
+ * Support DATABASE_URL format ([pull#118](https://github.com/winebarrel/ridgepole/pull/118))
166
+ * Add Ruby2.4 CI ([pull#119](https://github.com/winebarrel/ridgepole/pull/119))
167
+
168
+ ### 0.6.5
169
+
170
+ * Fix rails version `'>= 4.2', '< 6'`
171
+ * Support new types ([pull#84](https://github.com/winebarrel/ridgepole/pull/84))
172
+ * Support `default: -> { ... }` ([pull#85](https://github.com/winebarrel/ridgepole/pull/85))
173
+ * Support DDL Comment (Rails5 only)
174
+ * Output schema diff when pass `--verbose`
175
+ * Support composite primary key (Rails5 only / [pull#97](https://github.com/winebarrel/ridgepole/pull/97))
176
+
177
+ ### 0.6.4
178
+
179
+ * Execute sql using external script ([pull#56](https://github.com/winebarrel/ridgepole/pull/56))
180
+ * Add `--mysql-use-alter` option
181
+ * Add `--alter-extra` option
182
+ * Add `--dump-with-default-fk-name` option
183
+ * Support `t.index` ([pull#64](https://github.com/winebarrel/ridgepole/pull/64))
184
+ * Remove migration_comments
185
+ * Fix foreign key apply order
186
+
187
+ ### 0.6.3
188
+
189
+ * Fix `default` option ([pull#48](https://github.com/winebarrel/ridgepole/pull/48))
190
+ * Add `--enable-migration-comments` option ([pull#50](https://github.com/winebarrel/ridgepole/pull/50))
191
+ * Disable `rename_table_indexes`
192
+
193
+ ### 0.6.1
194
+
195
+ * Support [PostgreSQL columns](https://github.com/winebarrel/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L79)
196
+
197
+ ### 0.6.0
198
+
199
+ * Fix rails version `~> 4.2.1`
200
+ * Disable following libraries support:
201
+ * activerecord-mysql-unsigned
202
+ * migration_comments
203
+ * foreigner
204
+ * Disable sqlite support
205
+ * Add PostgreSQL test
206
+ * Remove `--mysql-awesome-unsigned-pk` option
207
+
208
+ ## 0.5
209
+
210
+ ### 0.5.2
211
+
212
+ * Add `--enable-mysql-awesome` option ([activerecord-mysql-awesome](https://github.com/kamipo/activerecord-mysql-awesome) is required `>= 0.0.3`)
213
+ * It is not possible to enable both `--enable-mysql-awesome` and `--enable-migration-comments`, `--enable-mysql-awesome` and `--enable-mysql-unsigned`, `--enable-mysql-awesome` and `--enable-mysql-pkdump`
214
+ * Fix foreigner version `<= 1.7.1`
215
+
216
+ ### 0.5.1
217
+
218
+ * Add `--enable-migration-comments` option ([migration_comments](https://github.com/pinnymz/migration_comments) is required)
219
+ * Fix rails version `< 4.2.0`
220
+
221
+ ### 0.5.0
222
+
223
+ * Fix `activerecord-mysql-unsigned` version: `~> 0.3.1`
224
+
225
+ ## 0.4
226
+
227
+ ### 0.4.12
228
+
229
+ * Fix `activerecord-mysql-unsigned` version: `~> 0.2.0`
230
+
231
+ ### 0.4.11
232
+
233
+ * Add `--enable-mysql-pkdump` option.
234
+
235
+ ### 0.4.8
236
+
237
+ * `activerecord-mysql-unsigned` is now optional. Please pass `--enable-mysql-unsigned` after you install [activerecord-mysql-unsigned](https://github.com/waka/activerecord-mysql-unsigned) if you want to use.
238
+ * Please pass `--enable-foreigner` after you install [foreigner](https://github.com/matthuhiggins/foreigner) if you want to use the foreign key.
data/README.md CHANGED
@@ -6,150 +6,20 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
6
6
  (like Chef/Puppet)
7
7
 
8
8
  [![Gem Version](https://badge.fury.io/rb/ridgepole.svg)](http://badge.fury.io/rb/ridgepole)
9
- [![Build Status](https://github.com/winebarrel/ridgepole/workflows/test/badge.svg?branch=0.9)](https://github.com/winebarrel/ridgepole/actions)
10
- [![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=0.9)](https://coveralls.io/github/winebarrel/ridgepole?branch=0.9)
11
-
12
- <details><summary>ChangeLog</summary>
13
-
14
- * `>= 0.4.8`
15
- * `activerecord-mysql-unsigned` is now optional. Please pass `--enable-mysql-unsigned` after you install [activerecord-mysql-unsigned](https://github.com/waka/activerecord-mysql-unsigned) if you want to use.
16
- * Please pass `--enable-foreigner` after you install [foreigner](https://github.com/matthuhiggins/foreigner) if you want to use the foreign key.
17
- * `>= 0.4.11`
18
- * Add `--enable-mysql-pkdump` option.
19
- * `>= 0.4.12`
20
- * Fix `activerecord-mysql-unsigned` version: `~> 0.2.0`
21
- * `>= 0.5.0`
22
- * Fix `activerecord-mysql-unsigned` version: `~> 0.3.1`
23
- * `>= 0.5.1`
24
- * Add `--enable-migration-comments` option ([migration_comments](https://github.com/pinnymz/migration_comments) is required)
25
- * Fix rails version `< 4.2.0`
26
- * `>= 0.5.2`
27
- * Add `--enable-mysql-awesome` option ([activerecord-mysql-awesome](https://github.com/kamipo/activerecord-mysql-awesome) is required `>= 0.0.3`)
28
- * It is not possible to enable both `--enable-mysql-awesome` and `--enable-migration-comments`, `--enable-mysql-awesome` and `--enable-mysql-unsigned`, `--enable-mysql-awesome` and `--enable-mysql-pkdump`
29
- * Fix foreigner version `<= 1.7.1`
30
- * `>= 0.6.0`
31
- * Fix rails version `~> 4.2.1`
32
- * Disable following libraries support:
33
- * activerecord-mysql-unsigned
34
- * migration_comments
35
- * foreigner
36
- * Disable sqlite support
37
- * Add PostgreSQL test
38
- * Remove `--mysql-awesome-unsigned-pk` option
39
- * `>= 0.6.1`
40
- * Support [PostgreSQL columns](https://github.com/winebarrel/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L79)
41
- * `>= 0.6.3`
42
- * Fix `default` option ([pull#48](https://github.com/winebarrel/ridgepole/pull/48))
43
- * Add `--enable-migration-comments` option ([pull#50](https://github.com/winebarrel/ridgepole/pull/50))
44
- * Disable `rename_table_indexes`
45
- * `>= 0.6.4`
46
- * Execute sql using external script ([pull#56](https://github.com/winebarrel/ridgepole/pull/56))
47
- * Add `--mysql-use-alter` option
48
- * Add `--alter-extra` option
49
- * Add `--dump-with-default-fk-name` option
50
- * Support `t.index` ([pull#64](https://github.com/winebarrel/ridgepole/pull/64))
51
- * Remove migration_comments
52
- * Fix foreign key apply order
53
- * `>= 0.6.5`
54
- * Fix rails version `'>= 4.2', '< 6'`
55
- * Support new types ([pull#84](https://github.com/winebarrel/ridgepole/pull/84))
56
- * Support `default: -> { ... }` ([pull#85](https://github.com/winebarrel/ridgepole/pull/85))
57
- * Support DDL Comment (Rails5 only)
58
- * Output schema diff when pass `--verbose`
59
- * Support composite primary key (Rails5 only / [pull#97](https://github.com/winebarrel/ridgepole/pull/97))
60
- * `>= 0.6.6`
61
- * Use `t.column` for migration ([pull#114](https://github.com/winebarrel/ridgepole/pull/114))
62
- * Support DATABASE_URL format ([pull#118](https://github.com/winebarrel/ridgepole/pull/118))
63
- * Add Ruby2.4 CI ([pull#119](https://github.com/winebarrel/ridgepole/pull/119))
64
- * `>= 0.7.0`
65
- * Remove Rails 4.x support
66
- * Add Rails 5.1 support
67
- * Remove `--enable-mysql-awesome` option
68
- * Add `--skip-drop-table` option
69
- * Support foreign key without name
70
- * Support MySQL JSON Type and Generated Columns
71
- * Add `--mysql-change-table-options` option
72
- * Pass config from env
73
- * Fix change fk order
74
- * Add `--check-relation-type` option
75
- * Add `--skip-column-comment-change` option
76
- * Add `--default-bigint-limit` option
77
- * Add `--ignore-table-comment` option
78
- * `>= 0.7.1`
79
- * Remove `--reverse` option
80
- * Add `--allow-pk-change` option
81
- * Add `--create-table-with-index` option
82
- * Add `--mysql-dump-auto-increment` option (`rails >= 5.1`)
83
- * `>= 0.7.2`
84
- * Support Rails 5.2
85
- * `>= 0.7.3`
86
- * Add `--mysql-change-table-comment option` ([pull#166](https://github.com/winebarrel/ridgepole/pull/166))
87
- * Refactoring with RuboCop
88
- * Support primary key adding/dropping ([issue#246](https://github.com/winebarrel/ridgepole/issues/246))
89
- * `>= 0.7.4`
90
- * Fix `add_foreign_key` options ([issue#250](https://github.com/winebarrel/ridgepole/issues/250))
91
- * `>= 0.7.5`
92
- * Fix polymorphic options ([pull#263](https://github.com/winebarrel/ridgepole/pull/263))
93
- * Fix `--mysql-use-alter` option ([pull#246](https://github.com/winebarrel/ridgepole/pull/264))
94
- * Fix Database URI parsing ([pull#265](https://github.com/winebarrel/ridgepole/pull/265))
95
- * `>= 0.7.6`
96
- * Fix database url check ([pull#266](https://github.com/winebarrel/ridgepole/pull/266))
97
- * Add ignore option ([pull#267](https://github.com/winebarrel/ridgepole/pull/267))
98
- * `>= 0.7.7`
99
- * Support URI query string ([pull#273](https://github.com/winebarrel/ridgepole/pull/273))
100
- * `>= 0.7.8`
101
- * Fix for `add_foreign_key(..., column: ,,,)` ([pull#278](https://github.com/winebarrel/ridgepole/pull/278))
102
- * `>= 0.8.0`
103
- * Support Rails 6.0
104
- * `>= 0.8.1`
105
- * Drop tables in an order considering foreign key constraints ([pull#284](https://github.com/winebarrel/ridgepole/pull/284))
106
- * `>= 0.8.2`
107
- * Support `postgres://` schema ([pull#285](https://github.com/winebarrel/ridgepole/pull/285))
108
- * `>= 0.8.3`
109
- * Fix "topological sort failed" error ([pull#287](https://github.com/winebarrel/ridgepole/pull/287))
110
- * `>= 0.8.4`
111
- * Display a warning if an InnoDB table doesn't have any indexes on a column where it has a foreign key ([pull#290](https://github.com/winebarrel/ridgepole/pull/290))
112
- * `>= 0.8.5`
113
- * Improve warning message on table options ([pull#291](https://github.com/winebarrel/ridgepole/pull/291))
114
- * `>= 0.8.6`
115
- * Support multiple databases feature ([pull#297](https://github.com/winebarrel/ridgepole/pull/297))
116
- * `>= 0.8.7`
117
- * Support `require_relative` ([pull#298](https://github.com/winebarrel/ridgepole/pull/298))
118
- * `>= 0.8.8`
119
- * Fix keyword arguments warnings in Ruby 2.7 ([pull#303](https://github.com/winebarrel/ridgepole/pull/303))
120
- * `>= 0.8.9`
121
- * Fix unexpected differences on text types and blob types on Rails 6 ([pull#306](https://github.com/winebarrel/ridgepole/pull/306))
122
- * Fix unexpected warning when a foreign key is added on the primary key ([pull#307](https://github.com/winebarrel/ridgepole/pull/307))
123
- * `>= 0.8.10`
124
- * Raise an error if an InnoDB column has a foreign key but no index ([pull#310](https://github.com/winebarrel/ridgepole/pull/310))
125
- * `>= 0.8.11`
126
- * Fix FK index check support multiple PK ([pull#315](https://github.com/winebarrel/ridgepole/pull/315))
127
- * Support t.reference() foreign_key option ([pull#316](https://github.com/winebarrel/ridgepole/pull/316))
128
- * `>= 0.8.12`
129
- * Pluralize column specified by `references` ([pull#317](https://github.com/winebarrel/ridgepole/pull/317))
130
- * `>= 0.8.13`
131
- * Support `serial` and `bigserial` column types ([pull#321](https://github.com/winebarrel/ridgepole/pull/321))
132
- * `>= 0.9.0`
133
- * Remove `--mysql-use-alter` option ([pull#330](https://github.com/winebarrel/ridgepole/pull/330))
134
- * Add `--table-hash-options` option ([pull#331](https://github.com/winebarrel/ridgepole/pull/331))
135
- * Support Rails 6.1 ([pull#323](https://github.com/winebarrel/ridgepole/pull/323))
136
- * Disable Rails 5.0 support ([pull#335](https://github.com/winebarrel/ridgepole/pull/335))
137
- * Fix PK AUTO_INCREMENT change bug ([pull#334](https://github.com/winebarrel/ridgepole/pull/334))
138
- * `>= 0.9.1`
139
- * Support `t.foreign_key` ([pull#348](https://github.com/winebarrel/ridgepole/pull/348))
140
- * `>= 0.9.2`
141
- * Support `t.column index option` ([pull#353](https://github.com/winebarrel/ridgepole/pull/353))
142
- * `>= 0.9.3`
143
- * Fix `limit` option for `t.integer` ([pull#354](https://github.com/winebarrel/ridgepole/pull/453))
144
- </details>
9
+ [![Build Status](https://github.com/winebarrel/ridgepole/workflows/test/badge.svg?branch=1.0)](https://github.com/winebarrel/ridgepole/actions)
10
+ [![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=1.0)](https://coveralls.io/github/winebarrel/ridgepole?branch=1.0)
145
11
 
146
12
  **Notice**
147
13
 
148
- ActiveRecord 6.1 is supported in ridgepole v0.9, but the ActiveRecord dump has been changed, so there is a difference between ActiveRecord 5.x/6.0 format.
149
-
150
- **If you use ActiveRecord 6.1, please modify Schemafile format**.
151
-
152
- cf. https://github.com/winebarrel/ridgepole/pull/323
14
+ * ActiveRecord 6.1 is supported in ridgepole v0.9, but the ActiveRecord dump has been changed, so there is a difference between ActiveRecord 5.x/6.0 format.
15
+ * **If you use ActiveRecord 6.1, please modify Schemafile format**.
16
+ * cf. https://github.com/winebarrel/ridgepole/pull/323
17
+ * `DROP TABLE` is skipped by default in v1.0 and later versions.
18
+ * If you want to `DROP TABLE`, please pass `--drop-table`.
19
+ * cf. https://github.com/ridgepole/ridgepole/pull/363
20
+ * In Rails 7.0, the output of dumper is different from Rails 6.
21
+ * cf. https://github.com/rails/rails/issues/43909
22
+ * cf. https://github.com/rails/rails/commit/c2a6f618d22cca4d9b7be7fa7652e7aac509350c#diff-55f41513f027a3d219629f475f03c2d1105ca55c5093d691e1b3dc4710c6cc0b
153
23
 
154
24
  ## Installation
155
25
 
@@ -200,7 +70,7 @@ Usage: ridgepole [options]
200
70
  --dump-without-table-options
201
71
  --dump-with-default-fk-name
202
72
  --index-removed-drop-column
203
- --skip-drop-table
73
+ --drop-table
204
74
  --mysql-change-table-options
205
75
  --mysql-change-table-comment
206
76
  --check-relation-type DEF_PK
data/bin/ridgepole CHANGED
@@ -137,7 +137,7 @@ ARGV.options do |opt|
137
137
  opt.on('', '--dump-without-table-options') { options[:dump_without_table_options] = true }
138
138
  opt.on('', '--dump-with-default-fk-name') { options[:dump_with_default_fk_name] = true }
139
139
  opt.on('', '--index-removed-drop-column') { options[:index_removed_drop_column] = true }
140
- opt.on('', '--skip-drop-table') { options[:skip_drop_table] = true }
140
+ opt.on('', '--drop-table') { options[:force_drop_table] = true }
141
141
  opt.on('', '--mysql-change-table-options') { options[:mysql_change_table_options] = true }
142
142
  opt.on('', '--mysql-change-table-comment') { options[:mysql_change_table_comment] = true }
143
143
  opt.on('', '--check-relation-type DEF_PK') { |v| options[:check_relation_type] = v }
data/docker-compose.yml CHANGED
@@ -1,18 +1,26 @@
1
- mysql:
2
- image: "mysql:5.6.38"
3
- ports:
4
- - "13316:3306"
5
- environment:
6
- MYSQL_ROOT_PASSWORD: password
7
- mysql57:
8
- image: "mysql:5.7.20"
9
- ports:
10
- - "13317:3306"
11
- environment:
12
- MYSQL_ROOT_PASSWORD: password
13
- postgres:
14
- image: "postgres:9.5"
15
- ports:
16
- - "15442:5432"
17
- environment:
18
- POSTGRES_PASSWORD: password
1
+ version: "3.8"
2
+ services:
3
+ mysql:
4
+ image: "mysql:5.6"
5
+ ports:
6
+ - "13316:3306"
7
+ environment:
8
+ MYSQL_ROOT_PASSWORD: password
9
+ mysql57:
10
+ image: "mysql:5.7"
11
+ ports:
12
+ - "13317:3306"
13
+ environment:
14
+ MYSQL_ROOT_PASSWORD: password
15
+ mysql80:
16
+ image: "mysql:8.0"
17
+ ports:
18
+ - "13318:3306"
19
+ environment:
20
+ MYSQL_ROOT_PASSWORD: password
21
+ postgres:
22
+ image: "postgres:14"
23
+ ports:
24
+ - "15442:5432"
25
+ environment:
26
+ POSTGRES_PASSWORD: password
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 7.0.0"
6
+
7
+ gemspec path: "../"
@@ -191,7 +191,7 @@ module Ridgepole
191
191
  errmsg = lines.with_index.map do |l, i|
192
192
  line_num = i + 1
193
193
  prefix = line_num == err_num ? '* ' : ' '
194
- format("#{prefix}%<line_num>#{digit_number}d: #{l}", line_num: line_num)
194
+ format("#{prefix}%<line_num>#{digit_number}d: %<line>s", line_num: line_num, line: l)
195
195
  end
196
196
 
197
197
  if err_num > 0
@@ -41,7 +41,7 @@ module Ridgepole
41
41
 
42
42
  scan_relation_info(relation_info)
43
43
 
44
- unless @options[:merge] || @options[:skip_drop_table]
44
+ if !@options[:merge] && @options[:force_drop_table]
45
45
  from.each do |table_name, from_attrs|
46
46
  next unless target?(table_name)
47
47
 
@@ -419,6 +419,9 @@ module Ridgepole
419
419
  opts[:limit] = 4_294_967_295
420
420
  end
421
421
  end
422
+
423
+ # Workaround for Active Record 7.0
424
+ opts.delete(:precision) if attrs[:type] == :datetime && opts[:precision].nil?
422
425
  end
423
426
  end
424
427
 
@@ -13,7 +13,10 @@ module Ridgepole
13
13
  end
14
14
 
15
15
  module ConnectionAdapterExt
16
- def execute(sql, name = nil)
16
+ def execute(*args)
17
+ sql = args.fetch(0)
18
+ name = args[1]
19
+
17
20
  if Ridgepole::ExecuteExpander.noop
18
21
  if (callback = Ridgepole::ExecuteExpander.callback)
19
22
  sql = append_alter_extra(sql)
@@ -50,7 +53,7 @@ module Ridgepole
50
53
  case sql
51
54
  when /\AALTER\b/i
52
55
  sql += ',' + Ridgepole::ExecuteExpander.alter_extra
53
- when /\A(CREATE|DROP)\s+INDEX\b/i
56
+ when /\A(CREATE|DROP)\s+((ONLINE|OFFLINE)\s+)?((UNIQUE|FULLTEXT|SPATIAL)\s+)?INDEX\b/i
54
57
  # https://dev.mysql.com/doc/refman/5.6/en/create-index.html
55
58
  # https://dev.mysql.com/doc/refman/5.6/en/drop-index.html
56
59
  sql += ' ' + Ridgepole::ExecuteExpander.alter_extra.tr(',', ' ')
@@ -36,6 +36,7 @@ module ActiveRecord
36
36
  class AbstractAdapter
37
37
  def self.inherited(subclass)
38
38
  subclass.prepend Ridgepole::Ext::AbstractAdapter::DisableTableOptions
39
+ super
39
40
  end
40
41
  end
41
42
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ridgepole
4
- VERSION = '0.9.3'
4
+ VERSION = '1.0.0'
5
5
  end
data/ridgepole.gemspec CHANGED
@@ -8,20 +8,23 @@ Gem::Specification.new do |spec|
8
8
  spec.name = 'ridgepole'
9
9
  spec.version = Ridgepole::VERSION
10
10
  spec.authors = ['Genki Sugawara']
11
- spec.email = ['sugawara@cookpad.com']
11
+ spec.email = ['sugawara@winebarrel.jp']
12
12
  spec.summary = 'Ridgepole is a tool to manage DB schema.'
13
13
  spec.description = 'Ridgepole is a tool to manage DB schema. It defines DB schema using Rails DSL, and updates DB schema according to DSL.'
14
- spec.homepage = 'https://github.com/winebarrel/ridgepole'
14
+ spec.homepage = 'https://github.com/ridgepole/ridgepole'
15
15
  spec.license = 'MIT'
16
16
 
17
- spec.files = `git ls-files -z`.split("\x0")
17
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
+ `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
20
+ end
21
+ end
18
22
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
23
  spec.require_paths = ['lib']
21
24
 
22
25
  spec.required_ruby_version = Gem::Requirement.new('>= 2.2.7') # rubocop:disable Gemspec/RequiredRubyVersion
23
26
 
24
- spec.add_dependency 'activerecord', '>= 5.1', '< 6.2'
27
+ spec.add_dependency 'activerecord', '>= 5.1', '< 7.1'
25
28
  spec.add_dependency 'diffy'
26
29
 
27
30
  spec.add_development_dependency 'appraisal', '>= 2.2.0'