ridgepole 0.9.5 → 1.0.2.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -1
  3. data/.simplecov +1 -1
  4. data/Appraisals +4 -0
  5. data/CHANGELOG.md +251 -0
  6. data/README.md +45 -153
  7. data/bin/ridgepole +83 -85
  8. data/docker-compose.yml +26 -18
  9. data/gemfiles/activerecord_7.0.gemfile +7 -0
  10. data/lib/ridgepole/client.rb +5 -0
  11. data/lib/ridgepole/delta.rb +23 -1
  12. data/lib/ridgepole/diff.rb +57 -3
  13. data/lib/ridgepole/dsl_parser/context.rb +16 -0
  14. data/lib/ridgepole/execute_expander.rb +4 -1
  15. data/lib/ridgepole/ext/abstract_adapter/partition_definition.rb +19 -0
  16. data/lib/ridgepole/ext/abstract_adapter/partition_options.rb +34 -0
  17. data/lib/ridgepole/ext/abstract_adapter/partitioning.rb +40 -0
  18. data/lib/ridgepole/ext/abstract_mysql_adapter/partitioning.rb +71 -0
  19. data/lib/ridgepole/ext/abstract_mysql_adapter/schema_creation.rb +46 -0
  20. data/lib/ridgepole/ext/postgresql_adapter/partitioning.rb +126 -0
  21. data/lib/ridgepole/ext/schema_dumper.rb +24 -0
  22. data/lib/ridgepole/external_sql_executer.rb +11 -13
  23. data/lib/ridgepole/version.rb +1 -1
  24. data/lib/ridgepole.rb +3 -0
  25. data/ridgepole.gemspec +9 -5
  26. metadata +22 -289
  27. data/.github/workflows/test.yml +0 -70
  28. data/.gitignore +0 -25
  29. data/spec/cli_helper.rb +0 -65
  30. data/spec/dsl_parser/context_spec.rb +0 -16
  31. data/spec/erb_helper.rb +0 -26
  32. data/spec/fixtures/for_require_relative_spec.rb +0 -3
  33. data/spec/hide_pending_formatter.rb +0 -9
  34. data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +0 -40
  35. data/spec/mysql/bigint_pk/int_pk_spec.rb +0 -47
  36. data/spec/mysql/cli/config_spec.rb +0 -210
  37. data/spec/mysql/cli/ridgepole_spec.rb +0 -447
  38. data/spec/mysql/collation/collation_spec.rb +0 -153
  39. data/spec/mysql/comment/comment_spec.rb +0 -179
  40. data/spec/mysql/default_lambda/default_lambda_spec.rb +0 -164
  41. data/spec/mysql/diff/diff2_spec.rb +0 -189
  42. data/spec/mysql/diff/diff_spec.rb +0 -168
  43. data/spec/mysql/dump/dump_class_method_spec.rb +0 -74
  44. data/spec/mysql/dump/dump_some_tables_spec.rb +0 -70
  45. data/spec/mysql/dump/dump_spec.rb +0 -74
  46. data/spec/mysql/dump/dump_unknown_column_type_spec.rb +0 -28
  47. data/spec/mysql/dump/dump_without_table_options_spec.rb +0 -34
  48. data/spec/mysql/fk/migrate_change_fk2_spec.rb +0 -47
  49. data/spec/mysql/fk/migrate_change_fk_spec.rb +0 -265
  50. data/spec/mysql/fk/migrate_create_fk_spec.rb +0 -349
  51. data/spec/mysql/fk/migrate_drop_fk_spec.rb +0 -331
  52. data/spec/mysql/fk/migrate_fk_with_column_spec.rb +0 -163
  53. data/spec/mysql/fk/migrate_ignore_fk_spec.rb +0 -70
  54. data/spec/mysql/migrate/check_orphan_index_spec.rb +0 -83
  55. data/spec/mysql/migrate/migrate_add_column2_spec.rb +0 -159
  56. data/spec/mysql/migrate/migrate_add_column_order_spec.rb +0 -242
  57. data/spec/mysql/migrate/migrate_add_column_spec.rb +0 -161
  58. data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +0 -276
  59. data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +0 -152
  60. data/spec/mysql/migrate/migrate_change_column2_spec.rb +0 -91
  61. data/spec/mysql/migrate/migrate_change_column3_spec.rb +0 -404
  62. data/spec/mysql/migrate/migrate_change_column4_spec.rb +0 -83
  63. data/spec/mysql/migrate/migrate_change_column5_spec.rb +0 -129
  64. data/spec/mysql/migrate/migrate_change_column6_spec.rb +0 -241
  65. data/spec/mysql/migrate/migrate_change_column7_spec.rb +0 -34
  66. data/spec/mysql/migrate/migrate_change_column8_spec.rb +0 -87
  67. data/spec/mysql/migrate/migrate_change_column_default_spec.rb +0 -199
  68. data/spec/mysql/migrate/migrate_change_column_float_spec.rb +0 -75
  69. data/spec/mysql/migrate/migrate_change_column_spec.rb +0 -158
  70. data/spec/mysql/migrate/migrate_change_index2_spec.rb +0 -86
  71. data/spec/mysql/migrate/migrate_change_index3_spec.rb +0 -179
  72. data/spec/mysql/migrate/migrate_change_index4_spec.rb +0 -112
  73. data/spec/mysql/migrate/migrate_change_index5_spec.rb +0 -74
  74. data/spec/mysql/migrate/migrate_change_index6_spec.rb +0 -202
  75. data/spec/mysql/migrate/migrate_change_index7_spec.rb +0 -85
  76. data/spec/mysql/migrate/migrate_change_index8_spec.rb +0 -85
  77. data/spec/mysql/migrate/migrate_change_index_spec.rb +0 -235
  78. data/spec/mysql/migrate/migrate_change_table_comment_spec.rb +0 -72
  79. data/spec/mysql/migrate/migrate_change_table_option_spec.rb +0 -83
  80. data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +0 -225
  81. data/spec/mysql/migrate/migrate_create_index2_spec.rb +0 -203
  82. data/spec/mysql/migrate/migrate_create_index_spec.rb +0 -220
  83. data/spec/mysql/migrate/migrate_create_table_spec.rb +0 -123
  84. data/spec/mysql/migrate/migrate_create_table_with_ignore_spec.rb +0 -45
  85. data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +0 -43
  86. data/spec/mysql/migrate/migrate_create_table_with_options_spec.rb +0 -59
  87. data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +0 -132
  88. data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +0 -140
  89. data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +0 -167
  90. data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +0 -52
  91. data/spec/mysql/migrate/migrate_drop_column_spec.rb +0 -158
  92. data/spec/mysql/migrate/migrate_drop_index_spec.rb +0 -160
  93. data/spec/mysql/migrate/migrate_drop_table_spec.rb +0 -123
  94. data/spec/mysql/migrate/migrate_duplicate_index_spec.rb +0 -27
  95. data/spec/mysql/migrate/migrate_duplicate_table_spec.rb +0 -37
  96. data/spec/mysql/migrate/migrate_empty_spec.rb +0 -78
  97. data/spec/mysql/migrate/migrate_execute_spec.rb +0 -288
  98. data/spec/mysql/migrate/migrate_ignore_column_spec.rb +0 -98
  99. data/spec/mysql/migrate/migrate_ignore_index_spec.rb +0 -92
  100. data/spec/mysql/migrate/migrate_log_file_spec.rb +0 -125
  101. data/spec/mysql/migrate/migrate_merge_mode_spec.rb +0 -145
  102. data/spec/mysql/migrate/migrate_noop_spec.rb +0 -234
  103. data/spec/mysql/migrate/migrate_primary_key_spec.rb +0 -104
  104. data/spec/mysql/migrate/migrate_rename_column_spec.rb +0 -184
  105. data/spec/mysql/migrate/migrate_rename_table_spec.rb +0 -241
  106. data/spec/mysql/migrate/migrate_same_default_null_spec.rb +0 -77
  107. data/spec/mysql/migrate/migrate_same_spec.rb +0 -82
  108. data/spec/mysql/migrate/migrate_script_error_spec.rb +0 -91
  109. data/spec/mysql/migrate/migrate_skip_column_comment_change_spec.rb +0 -39
  110. data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +0 -145
  111. data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +0 -140
  112. data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +0 -141
  113. data/spec/mysql/migrate/migrate_with_ignore_tables_spec.rb +0 -307
  114. data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +0 -153
  115. data/spec/mysql/migrate/migrate_with_tables_spec.rb +0 -149
  116. data/spec/mysql/migrate/migrate_with_verbose_log_spec.rb +0 -60
  117. data/spec/mysql/ridgepole_test_database.sql +0 -2
  118. data/spec/mysql/ridgepole_test_tables.sql +0 -79
  119. data/spec/mysql/ridgepole_test_tables_unknown_column_type.sql +0 -17
  120. data/spec/mysql/text_blob_types/text_blob_types_spec.rb +0 -131
  121. data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +0 -59
  122. data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +0 -133
  123. data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +0 -100
  124. data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +0 -43
  125. data/spec/mysql57/json/add_json_column_spec.rb +0 -35
  126. data/spec/mysql57/json/change_json_column_spec.rb +0 -102
  127. data/spec/mysql57/json/drop_json_column_spec.rb +0 -35
  128. data/spec/mysql57/virtual/add_virtual_column_spec.rb +0 -37
  129. data/spec/mysql57/virtual/change_virtual_column_spec.rb +0 -40
  130. data/spec/mysql57/virtual/drop_virtual_column_spec.rb +0 -37
  131. data/spec/postgresql/diff/diff_spec.rb +0 -216
  132. data/spec/postgresql/dump/dump_spec.rb +0 -69
  133. data/spec/postgresql/fk/migrate_change_fk_spec.rb +0 -115
  134. data/spec/postgresql/fk/migrate_create_fk_spec.rb +0 -176
  135. data/spec/postgresql/fk/migrate_drop_fk_spec.rb +0 -197
  136. data/spec/postgresql/migrate/migrate_add_column_spec.rb +0 -203
  137. data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +0 -25
  138. data/spec/postgresql/migrate/migrate_bigint_spec.rb +0 -53
  139. data/spec/postgresql/migrate/migrate_change_column_default_spec.rb +0 -38
  140. data/spec/postgresql/migrate/migrate_change_column_spec.rb +0 -185
  141. data/spec/postgresql/migrate/migrate_change_index_spec.rb +0 -164
  142. data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +0 -114
  143. data/spec/postgresql/migrate/migrate_create_table_spec.rb +0 -120
  144. data/spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb +0 -112
  145. data/spec/postgresql/migrate/migrate_drop_column_spec.rb +0 -163
  146. data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +0 -166
  147. data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +0 -59
  148. data/spec/postgresql/migrate/migrate_drop_index_spec.rb +0 -158
  149. data/spec/postgresql/migrate/migrate_drop_table_spec.rb +0 -122
  150. data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +0 -64
  151. data/spec/postgresql/migrate/migrate_primary_key2_spec.rb +0 -73
  152. data/spec/postgresql/migrate/migrate_primary_key_spec.rb +0 -99
  153. data/spec/postgresql/migrate/migrate_references_spec.rb +0 -90
  154. data/spec/postgresql/migrate/migrate_rename_column_spec.rb +0 -155
  155. data/spec/postgresql/migrate/migrate_rename_table_spec.rb +0 -175
  156. data/spec/postgresql/migrate/migrate_same_spec.rb +0 -77
  157. data/spec/postgresql/ridgepole_test_database.sql +0 -16
  158. data/spec/postgresql/ridgepole_test_tables.sql +0 -75
  159. data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +0 -59
  160. data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +0 -134
  161. data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +0 -100
  162. data/spec/processing_for_ci.rb +0 -13
  163. data/spec/spec_condition.rb +0 -58
  164. data/spec/spec_const.rb +0 -20
  165. data/spec/spec_helper.rb +0 -173
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4309b6d60e99651b74a3a54dc7600d59a9f4ce195bc3922b1abca232ed02009e
4
- data.tar.gz: 73bb8b3ed77c18e4f5d51439aefed10980afe7d9371808787832758d0248c88d
3
+ metadata.gz: a14d5a37589fdd2639feba516071c7593f98f05f485c96401dca5f3021674330
4
+ data.tar.gz: 96747ebd0c5da3c8e77726e839b721aeb78c088d7d6dfd25476ac6f34421d7fb
5
5
  SHA512:
6
- metadata.gz: f4133de20d4427bc17fd033aeb6bfb5507c730da1c947954b46fece10e0c51c6b855017ef98e6d681f7bb442c26699eef094ca6572871e0be4a34de784fb701d
7
- data.tar.gz: 11943e7e1f26c9486542279e270d546c2455bc97b813f22e6dd390cf18217a07a8873301138af70e254b84380db3bba1f3f6b0ba450842ae29c6a881b22ad0c3
6
+ metadata.gz: 946b32832ab928d03a22caa78fe4bd6379778732817de10d9df12eb976d1feb0260cacb436ae848f47e98cae923542b4494e26690a78069dd5559a6278799286
7
+ data.tar.gz: 3bd4e975d7aa90162d3813f57215db79c5c0680553cb46e62cf820c4dfe6500af8c8f0845fe4799e481dfad453698439e84362d5f19ee2c0aafa454d28eae62a
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ AllCops:
3
3
  - "gemfiles/**/*"
4
4
  - "omnibus-ridgepole/**/*"
5
5
  - "vendor/bundle/**/*"
6
- TargetRubyVersion: 2.4
6
+ TargetRubyVersion: 2.5
7
7
  NewCops: enable
8
8
  Bundler/OrderedGems:
9
9
  Include:
@@ -24,10 +24,18 @@ Layout/LineLength:
24
24
  Enabled: false
25
25
  Metrics/MethodLength:
26
26
  Enabled: false
27
+ Metrics/ModuleLength:
28
+ Max: 106
27
29
  Metrics/ParameterLists:
28
30
  Enabled: false
29
31
  Metrics/PerceivedComplexity:
30
32
  Enabled: false
33
+ Naming/MethodName:
34
+ Exclude:
35
+ - "lib/ridgepole/ext/abstract_mysql_adapter/schema_creation.rb"
36
+ Naming/MethodParameterName:
37
+ Exclude:
38
+ - "lib/ridgepole/ext/abstract_mysql_adapter/schema_creation.rb"
31
39
  Style/Documentation:
32
40
  Enabled: false
33
41
  Style/GuardClause:
data/.simplecov CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- SimpleCov.start do
3
+ SimpleCov.configure do
4
4
  # exclude directories and files
5
5
  add_filter '/spec/'
6
6
  end
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,251 @@
1
+ # Changelog
2
+
3
+ ## 1.0
4
+
5
+ ### 1.0.2 (Unreleased)
6
+
7
+ * Add support for partitioning ([pull#374](https://github.com/ridgepole/ridgepole/pull/374))
8
+ * Suppress warning of table option differences ([pull#378](https://github.com/ridgepole/ridgepole/pull/378))
9
+
10
+ ### 1.0.1 (2022/01/15)
11
+
12
+ * Fix code for RuboCop 1.24.1
13
+ * Fix PostgreSQL spec for Rails 7.0
14
+ * Update ERBh gem (for development)
15
+
16
+ ### 1.0.0 (2021/12/19)
17
+
18
+ * Support Rails 7.0
19
+ * `--skip-drop-table` by default ([pull#363](https://github.com/ridgepole/ridgepole/pull/363))
20
+
21
+ ## 0.9
22
+
23
+ ### 0.9.6
24
+
25
+ * Fix malformed error ([pull#362](https://github.com/ridgepole/ridgepole/pull/362))
26
+
27
+ ### 0.9.5
28
+
29
+ * Call `super` in `disable_table_options.rb` ([pull#357](https://github.com/ridgepole/ridgepole/pull/357))
30
+
31
+ ### 0.9.4
32
+
33
+ * Fix `--alter-extra` option for unique index ([pull#356](https://github.com/ridgepole/ridgepole/pull/356))
34
+
35
+ ### 0.9.3
36
+
37
+ * Fix `limit` option for `t.integer` ([pull#354](https://github.com/ridgepole/ridgepole/pull/354))
38
+
39
+ ### 0.9.2
40
+
41
+ * Support `t.column index option` ([pull#353](https://github.com/ridgepole/ridgepole/pull/353))
42
+
43
+ ### 0.9.1
44
+
45
+ * Support `t.foreign_key` ([pull#348](https://github.com/ridgepole/ridgepole/pull/348))
46
+
47
+ ### 0.9.0
48
+
49
+ * Remove `--mysql-use-alter` option ([pull#330](https://github.com/ridgepole/ridgepole/pull/330))
50
+ * Add `--table-hash-options` option ([pull#331](https://github.com/ridgepole/ridgepole/pull/331))
51
+ * Support Rails 6.1 ([pull#323](https://github.com/ridgepole/ridgepole/pull/323))
52
+ * Disable Rails 5.0 support ([pull#335](https://github.com/ridgepole/ridgepole/pull/335))
53
+ * Fix PK AUTO_INCREMENT change bug ([pull#334](https://github.com/ridgepole/ridgepole/pull/334))
54
+
55
+ ## 0.8
56
+
57
+ ### 0.8.13
58
+
59
+ * Support `serial` and `bigserial` column types ([pull#321](https://github.com/ridgepole/ridgepole/pull/321))
60
+
61
+ ### 0.8.12
62
+
63
+ * Pluralize column specified by `references` ([pull#317](https://github.com/ridgepole/ridgepole/pull/317))
64
+
65
+ ### 0.8.11
66
+
67
+ * Fix FK index check support multiple PK ([pull#315](https://github.com/ridgepole/ridgepole/pull/315))
68
+ * Support t.reference() foreign_key option ([pull#316](https://github.com/ridgepole/ridgepole/pull/316))
69
+
70
+ ### 0.8.10
71
+
72
+ * Raise an error if an InnoDB column has a foreign key but no index ([pull#310](https://github.com/ridgepole/ridgepole/pull/310))
73
+
74
+ ### 0.8.9
75
+
76
+ * Fix unexpected differences on text types and blob types on Rails 6 ([pull#306](https://github.com/ridgepole/ridgepole/pull/306))
77
+ * Fix unexpected warning when a foreign key is added on the primary key ([pull#307](https://github.com/ridgepole/ridgepole/pull/307))
78
+
79
+ ### 0.8.8
80
+
81
+ * Fix keyword arguments warnings in Ruby 2.7 ([pull#303](https://github.com/ridgepole/ridgepole/pull/303))
82
+
83
+ ### 0.8.7
84
+
85
+ * Support `require_relative` ([pull#298](https://github.com/ridgepole/ridgepole/pull/298))
86
+
87
+ ### 0.8.6
88
+
89
+ * Support multiple databases feature ([pull#297](https://github.com/ridgepole/ridgepole/pull/297))
90
+
91
+ ### 0.8.5
92
+
93
+ * Improve warning message on table options ([pull#291](https://github.com/ridgepole/ridgepole/pull/291))
94
+
95
+ ### 0.8.4
96
+
97
+ * 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/ridgepole/ridgepole/pull/290))
98
+
99
+ ### 0.8.3
100
+
101
+ * Fix "topological sort failed" error ([pull#287](https://github.com/ridgepole/ridgepole/pull/287))
102
+
103
+ ### 0.8.2
104
+
105
+ * Support `postgres://` schema ([pull#285](https://github.com/ridgepole/ridgepole/pull/285))
106
+
107
+ ### 0.8.1
108
+
109
+ * Drop tables in an order considering foreign key constraints ([pull#284](https://github.com/ridgepole/ridgepole/pull/284))
110
+
111
+ ### 0.8.0
112
+
113
+ * Support Rails 6.0
114
+
115
+ ## 0.7
116
+
117
+ ### 0.7.8
118
+
119
+ * Fix for `add_foreign_key(..., column: ,,,)` ([pull#278](https://github.com/ridgepole/ridgepole/pull/278))
120
+
121
+ ### 0.7.7
122
+
123
+ * Support URI query string ([pull#273](https://github.com/ridgepole/ridgepole/pull/273))
124
+
125
+ ### 0.7.6
126
+
127
+ * Fix database url check ([pull#266](https://github.com/ridgepole/ridgepole/pull/266))
128
+ * Add ignore option ([pull#267](https://github.com/ridgepole/ridgepole/pull/267))
129
+
130
+ ### 0.7.5
131
+
132
+ * Fix polymorphic options ([pull#263](https://github.com/ridgepole/ridgepole/pull/263))
133
+ * Fix `--mysql-use-alter` option ([pull#246](https://github.com/ridgepole/ridgepole/pull/264))
134
+ * Fix Database URI parsing ([pull#265](https://github.com/ridgepole/ridgepole/pull/265))
135
+
136
+ ### 0.7.4
137
+
138
+ * Fix `add_foreign_key` options ([issue#250](https://github.com/ridgepole/ridgepole/issues/250))
139
+
140
+ ### 0.7.3
141
+
142
+ * Add `--mysql-change-table-comment option` ([pull#166](https://github.com/ridgepole/ridgepole/pull/166))
143
+ * Refactoring with RuboCop
144
+ * Support primary key adding/dropping ([issue#246](https://github.com/ridgepole/ridgepole/issues/246))
145
+
146
+ ### 0.7.2
147
+
148
+ * Support Rails 5.2
149
+
150
+ ### 0.7.1
151
+
152
+ * Remove `--reverse` option
153
+ * Add `--allow-pk-change` option
154
+ * Add `--create-table-with-index` option
155
+ * Add `--mysql-dump-auto-increment` option (`rails >= 5.1`)
156
+
157
+ ### 0.7.0
158
+
159
+ * Remove Rails 4.x support
160
+ * Add Rails 5.1 support
161
+ * Remove `--enable-mysql-awesome` option
162
+ * Add `--skip-drop-table` option
163
+ * Support foreign key without name
164
+ * Support MySQL JSON Type and Generated Columns
165
+ * Add `--mysql-change-table-options` option
166
+ * Pass config from env
167
+ * Fix change fk order
168
+ * Add `--check-relation-type` option
169
+ * Add `--skip-column-comment-change` option
170
+ * Add `--default-bigint-limit` option
171
+ * Add `--ignore-table-comment` option
172
+
173
+ ## 0.6
174
+
175
+ ### 0.6.6
176
+
177
+ * Use `t.column` for migration ([pull#114](https://github.com/ridgepole/ridgepole/pull/114))
178
+ * Support DATABASE_URL format ([pull#118](https://github.com/ridgepole/ridgepole/pull/118))
179
+ * Add Ruby2.4 CI ([pull#119](https://github.com/ridgepole/ridgepole/pull/119))
180
+
181
+ ### 0.6.5
182
+
183
+ * Fix rails version `'>= 4.2', '< 6'`
184
+ * Support new types ([pull#84](https://github.com/ridgepole/ridgepole/pull/84))
185
+ * Support `default: -> { ... }` ([pull#85](https://github.com/ridgepole/ridgepole/pull/85))
186
+ * Support DDL Comment (Rails5 only)
187
+ * Output schema diff when pass `--verbose`
188
+ * Support composite primary key (Rails5 only / [pull#97](https://github.com/ridgepole/ridgepole/pull/97))
189
+
190
+ ### 0.6.4
191
+
192
+ * Execute sql using external script ([pull#56](https://github.com/ridgepole/ridgepole/pull/56))
193
+ * Add `--mysql-use-alter` option
194
+ * Add `--alter-extra` option
195
+ * Add `--dump-with-default-fk-name` option
196
+ * Support `t.index` ([pull#64](https://github.com/ridgepole/ridgepole/pull/64))
197
+ * Remove migration_comments
198
+ * Fix foreign key apply order
199
+
200
+ ### 0.6.3
201
+
202
+ * Fix `default` option ([pull#48](https://github.com/ridgepole/ridgepole/pull/48))
203
+ * Add `--enable-migration-comments` option ([pull#50](https://github.com/ridgepole/ridgepole/pull/50))
204
+ * Disable `rename_table_indexes`
205
+
206
+ ### 0.6.1
207
+
208
+ * Support [PostgreSQL columns](https://github.com/winebarrel/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L79)
209
+
210
+ ### 0.6.0
211
+
212
+ * Fix rails version `~> 4.2.1`
213
+ * Disable following libraries support:
214
+ * activerecord-mysql-unsigned
215
+ * migration_comments
216
+ * foreigner
217
+ * Disable sqlite support
218
+ * Add PostgreSQL test
219
+ * Remove `--mysql-awesome-unsigned-pk` option
220
+
221
+ ## 0.5
222
+
223
+ ### 0.5.2
224
+
225
+ * Add `--enable-mysql-awesome` option ([activerecord-mysql-awesome](https://github.com/kamipo/activerecord-mysql-awesome) is required `>= 0.0.3`)
226
+ * 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`
227
+ * Fix foreigner version `<= 1.7.1`
228
+
229
+ ### 0.5.1
230
+
231
+ * Add `--enable-migration-comments` option ([migration_comments](https://github.com/pinnymz/migration_comments) is required)
232
+ * Fix rails version `< 4.2.0`
233
+
234
+ ### 0.5.0
235
+
236
+ * Fix `activerecord-mysql-unsigned` version: `~> 0.3.1`
237
+
238
+ ## 0.4
239
+
240
+ ### 0.4.12
241
+
242
+ * Fix `activerecord-mysql-unsigned` version: `~> 0.2.0`
243
+
244
+ ### 0.4.11
245
+
246
+ * Add `--enable-mysql-pkdump` option.
247
+
248
+ ### 0.4.8
249
+
250
+ * `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.
251
+ * 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,154 +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/354))
144
- * `>= 0.9.4`
145
- * Fix `--alter-extra` option for unique index ([pull#356](https://github.com/winebarrel/ridgepole/pull/356))
146
- * `>= 0.9.5`
147
- * Call `super` in `disable_table_options.rb` ([pull#357](https://github.com/winebarrel/ridgepole/pull/357))
148
- </details>
9
+ [![Build Status](https://github.com/ridgepole/ridgepole/workflows/test/badge.svg?branch=1.0)](https://github.com/ridgepole/ridgepole/actions)
10
+ [![Coverage Status](https://coveralls.io/repos/github/ridgepole/ridgepole/badge.svg?branch=1.0)](https://coveralls.io/github/ridgepole/ridgepole?branch=1.0)
149
11
 
150
12
  **Notice**
151
13
 
152
- 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.
153
-
154
- **If you use ActiveRecord 6.1, please modify Schemafile format**.
155
-
156
- 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/ridgepole/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
157
23
 
158
24
  ## Installation
159
25
 
@@ -204,7 +70,7 @@ Usage: ridgepole [options]
204
70
  --dump-without-table-options
205
71
  --dump-with-default-fk-name
206
72
  --index-removed-drop-column
207
- --skip-drop-table
73
+ --drop-table
208
74
  --mysql-change-table-options
209
75
  --mysql-change-table-comment
210
76
  --check-relation-type DEF_PK
@@ -435,18 +301,44 @@ Apply `Schemafile`
435
301
  ...
436
302
  ```
437
303
 
304
+ ## Partitioning
305
+
306
+ **Notice:** PostgreSQL `PARTITION BY` must be specified with the create_table option.
307
+
308
+ ### List Partitioning
309
+
310
+ ```ruby
311
+ create_table "articles", force: :cascade, options: "PARTITION BY LIST(id)" do |t|
312
+ end
313
+
314
+ add_partition("articles", :list, :id, partition_definitions: [{ name: 'p0', values: { in: [0,1,2] } }, { name: 'p1', values: { in: [3,4,5] } }])
315
+ ```
316
+
317
+ ### Range Partitioning
318
+
319
+ ```ruby
320
+ create_table "articles", force: :cascade, options: "PARTITION BY RANGE(id)" do |t|
321
+ end
322
+
323
+ # postgresql
324
+ add_partition("articles", :range, :id, partition_definitions: [{ name: 'p0', values: { from: 'MINVALUE', to: 5 }}, { name: 'p1', values: { from: 5, to: 10 } }])
325
+ # mysql
326
+ add_partition("articles", :range, :id, partition_definitions: [{ name: 'p0', values: { to: 5 }}, { name: 'p1', values: { to: 10 } }])
327
+ ```
328
+
438
329
  ## Run tests
439
330
 
331
+
440
332
  ```sh
441
333
  docker-compose up -d
442
334
  bundle install
443
335
  bundle exec appraisal install
444
- bundle exec appraisal activerecord-5.1 rake
445
- # POSTGRESQL=1 bundle exec appraisal activerecord-5.1 rake
446
- # MYSQL57=1 bundle exec appraisal activerecord-5.1 rake
336
+ bundle exec appraisal activerecord-7.0 rake
337
+ # POSTGRESQL=1 bundle exec appraisal activerecord-7.0 rake
338
+ # MYSQL57=1 bundle exec appraisal activerecord-7.0 rake
447
339
  ```
448
340
 
449
- **Notice:** mysql-client/postgresql-client is required.
341
+ **Notice:** Ruby 2.6 or above/mysql-client/postgresql-client is required.
450
342
 
451
343
  ## Demo
452
344
 
@@ -455,6 +347,6 @@ bundle exec appraisal activerecord-5.1 rake
455
347
 
456
348
  ## Example project
457
349
 
458
- * https://github.com/winebarrel/ridgepole-example
459
- * https://github.com/winebarrel/ridgepole-example/pull/1
460
- * https://github.com/winebarrel/ridgepole-example/pull/2
350
+ * https://github.com/ridgepole/ridgepole-example
351
+ * https://github.com/ridgepole/ridgepole-example/pull/1
352
+ * https://github.com/ridgepole/ridgepole-example/pull/2