ridgepole 0.8.12 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +27 -20
  3. data/.rubocop.yml +5 -4
  4. data/.simplecov +6 -0
  5. data/Appraisals +4 -5
  6. data/README.md +22 -41
  7. data/bin/ridgepole +13 -3
  8. data/gemfiles/{activerecord_5.0.gemfile → activerecord_6.1.gemfile} +1 -2
  9. data/lib/ridgepole/client.rb +8 -3
  10. data/lib/ridgepole/default_limit.rb +1 -1
  11. data/lib/ridgepole/delta.rb +16 -1
  12. data/lib/ridgepole/diff.rb +50 -31
  13. data/lib/ridgepole/dsl_parser/table_definition.rb +49 -42
  14. data/lib/ridgepole/execute_expander.rb +10 -1
  15. data/lib/ridgepole/ext/abstract_adapter/disable_table_options.rb +9 -1
  16. data/lib/ridgepole/external_sql_executer.rb +12 -1
  17. data/lib/ridgepole/version.rb +1 -1
  18. data/ridgepole.gemspec +6 -3
  19. data/spec/erb_helper.rb +1 -1
  20. data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +2 -2
  21. data/spec/mysql/bigint_pk/int_pk_spec.rb +1 -1
  22. data/spec/mysql/cli/ridgepole_spec.rb +35 -1
  23. data/spec/mysql/collation/collation_spec.rb +14 -14
  24. data/spec/mysql/comment/comment_spec.rb +9 -9
  25. data/spec/mysql/diff/diff2_spec.rb +5 -5
  26. data/spec/mysql/diff/diff_spec.rb +3 -3
  27. data/spec/mysql/dump/dump_class_method_spec.rb +13 -13
  28. data/spec/mysql/dump/dump_some_tables_spec.rb +4 -4
  29. data/spec/mysql/dump/dump_spec.rb +13 -13
  30. data/spec/mysql/dump/dump_unknown_column_type_spec.rb +2 -2
  31. data/spec/mysql/dump/dump_without_table_options_spec.rb +2 -2
  32. data/spec/mysql/fk/migrate_change_fk2_spec.rb +2 -2
  33. data/spec/mysql/fk/migrate_change_fk_spec.rb +88 -20
  34. data/spec/mysql/fk/migrate_create_fk_spec.rb +77 -22
  35. data/spec/mysql/fk/migrate_drop_fk_spec.rb +81 -26
  36. data/spec/mysql/fk/migrate_fk_with_column_spec.rb +16 -16
  37. data/spec/mysql/fk/migrate_ignore_fk_spec.rb +6 -6
  38. data/spec/mysql/migrate/migrate_add_column_order_spec.rb +2 -2
  39. data/spec/mysql/migrate/migrate_add_column_spec.rb +18 -18
  40. data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +106 -18
  41. data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +18 -18
  42. data/spec/mysql/migrate/migrate_change_column2_spec.rb +5 -5
  43. data/spec/mysql/migrate/migrate_change_column3_spec.rb +10 -10
  44. data/spec/mysql/migrate/migrate_change_column5_spec.rb +3 -3
  45. data/spec/mysql/migrate/migrate_change_column6_spec.rb +7 -7
  46. data/spec/mysql/migrate/migrate_change_column8_spec.rb +38 -5
  47. data/spec/mysql/migrate/migrate_change_column_default_spec.rb +2 -14
  48. data/spec/mysql/migrate/migrate_change_column_spec.rb +21 -21
  49. data/spec/mysql/migrate/migrate_change_index2_spec.rb +5 -5
  50. data/spec/mysql/migrate/migrate_change_index3_spec.rb +7 -7
  51. data/spec/mysql/migrate/migrate_change_index4_spec.rb +6 -6
  52. data/spec/mysql/migrate/migrate_change_index5_spec.rb +4 -4
  53. data/spec/mysql/migrate/migrate_change_index6_spec.rb +27 -27
  54. data/spec/mysql/migrate/migrate_change_index7_spec.rb +4 -4
  55. data/spec/mysql/migrate/migrate_change_index8_spec.rb +4 -4
  56. data/spec/mysql/migrate/migrate_change_index_spec.rb +34 -28
  57. data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +5 -5
  58. data/spec/mysql/migrate/migrate_create_index2_spec.rb +24 -24
  59. data/spec/mysql/migrate/migrate_create_index_spec.rb +18 -18
  60. data/spec/mysql/migrate/migrate_create_table_spec.rb +16 -16
  61. data/spec/mysql/migrate/migrate_create_table_with_ignore_spec.rb +4 -4
  62. data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +4 -4
  63. data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +16 -16
  64. data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +18 -18
  65. data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +16 -16
  66. data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +1 -1
  67. data/spec/mysql/migrate/migrate_drop_column_spec.rb +18 -18
  68. data/spec/mysql/migrate/migrate_drop_index_spec.rb +15 -15
  69. data/spec/mysql/migrate/migrate_drop_table_spec.rb +16 -16
  70. data/spec/mysql/migrate/migrate_empty_spec.rb +9 -9
  71. data/spec/mysql/migrate/migrate_execute_spec.rb +32 -32
  72. data/spec/mysql/migrate/migrate_ignore_column_spec.rb +4 -4
  73. data/spec/mysql/migrate/migrate_ignore_index_spec.rb +5 -5
  74. data/spec/mysql/migrate/migrate_log_file_spec.rb +16 -16
  75. data/spec/mysql/migrate/migrate_merge_mode_spec.rb +18 -18
  76. data/spec/mysql/migrate/migrate_noop_spec.rb +12 -12
  77. data/spec/mysql/migrate/migrate_primary_key_spec.rb +31 -6
  78. data/spec/mysql/migrate/migrate_rename_column_spec.rb +18 -18
  79. data/spec/mysql/migrate/migrate_rename_table_spec.rb +22 -22
  80. data/spec/mysql/migrate/migrate_same_spec.rb +13 -13
  81. data/spec/mysql/migrate/migrate_skip_column_comment_change_spec.rb +2 -2
  82. data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +18 -18
  83. data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +18 -18
  84. data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +18 -18
  85. data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +18 -18
  86. data/spec/mysql/text_blob_types/text_blob_types_spec.rb +2 -2
  87. data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +6 -6
  88. data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +9 -9
  89. data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +8 -8
  90. data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +5 -5
  91. data/spec/mysql57/json/add_json_column_spec.rb +2 -2
  92. data/spec/mysql57/json/change_json_column_spec.rb +6 -6
  93. data/spec/mysql57/json/drop_json_column_spec.rb +2 -2
  94. data/spec/mysql57/virtual/add_virtual_column_spec.rb +1 -1
  95. data/spec/mysql57/virtual/change_virtual_column_spec.rb +1 -1
  96. data/spec/mysql57/virtual/drop_virtual_column_spec.rb +1 -1
  97. data/spec/postgresql/dump/dump_spec.rb +13 -13
  98. data/spec/postgresql/fk/migrate_change_fk_spec.rb +6 -6
  99. data/spec/postgresql/fk/migrate_create_fk_spec.rb +5 -5
  100. data/spec/postgresql/fk/migrate_drop_fk_spec.rb +8 -8
  101. data/spec/postgresql/migrate/migrate_add_column_spec.rb +27 -20
  102. data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +1 -1
  103. data/spec/postgresql/migrate/migrate_change_column_spec.rb +20 -16
  104. data/spec/postgresql/migrate/migrate_change_index_spec.rb +18 -18
  105. data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +1 -1
  106. data/spec/postgresql/migrate/migrate_create_table_spec.rb +14 -14
  107. data/spec/postgresql/migrate/migrate_drop_column_spec.rb +29 -22
  108. data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +17 -17
  109. data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +3 -3
  110. data/spec/postgresql/migrate/migrate_drop_index_spec.rb +15 -15
  111. data/spec/postgresql/migrate/migrate_drop_table_spec.rb +16 -16
  112. data/spec/postgresql/migrate/migrate_primary_key2_spec.rb +1 -1
  113. data/spec/postgresql/migrate/migrate_primary_key_spec.rb +1 -1
  114. data/spec/postgresql/migrate/migrate_references_spec.rb +6 -6
  115. data/spec/postgresql/migrate/migrate_rename_column_spec.rb +18 -18
  116. data/spec/postgresql/migrate/migrate_rename_table_spec.rb +20 -20
  117. data/spec/postgresql/migrate/migrate_same_spec.rb +13 -13
  118. data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +3 -3
  119. data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +4 -4
  120. data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +4 -4
  121. data/spec/processing_for_ci.rb +13 -0
  122. data/spec/spec_const.rb +1 -1
  123. data/spec/spec_helper.rb +2 -1
  124. metadata +68 -43
  125. data/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb +0 -31
  126. data/omnibus-ridgepole/.gitignore +0 -10
  127. data/omnibus-ridgepole/Dockerfile.centos +0 -25
  128. data/omnibus-ridgepole/Dockerfile.ubuntu +0 -21
  129. data/omnibus-ridgepole/Gemfile +0 -24
  130. data/omnibus-ridgepole/README.md +0 -15
  131. data/omnibus-ridgepole/Rakefile +0 -38
  132. data/omnibus-ridgepole/config/projects/ridgepole.rb +0 -27
  133. data/omnibus-ridgepole/config/software/ridgepole.rb +0 -13
  134. data/omnibus-ridgepole/omnibus.rb +0 -54
  135. data/omnibus-ridgepole/package-scripts/ridgepole/postinst +0 -1
  136. data/omnibus-ridgepole/package-scripts/ridgepole/postrm +0 -1
  137. data/spec/mysql/bigint_pk/bigint_pk_spec.rb +0 -47
  138. data/spec/mysql/migrate_/migrate_create_index_with_alter_spec.rb +0 -141
  139. data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +0 -141
  140. data/spec/processing_for_travis.rb +0 -11
@@ -1,141 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe 'Ridgepole::Client#diff -> migrate' do
4
- context 'when drop index' do
5
- let(:dsl) do
6
- erbh(<<-ERB)
7
- create_table "clubs", force: :cascade do |t|
8
- t.string "name", default: "", null: false
9
- t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
10
- end
11
-
12
- create_table "departments", primary_key: "dept_no", force: :cascade do |t|
13
- t.string "dept_name", limit: 40, null: false
14
- t.index ["dept_name"], name: "dept_name", unique: true, <%= i cond(5.0, using: :btree) %>
15
- end
16
-
17
- create_table "dept_emp", id: false, force: :cascade do |t|
18
- t.integer "emp_no", null: false
19
- t.string "dept_no", null: false
20
- t.date "from_date", null: false
21
- t.date "to_date", null: false
22
- t.index ["dept_no"], name: "dept_no", <%= i cond(5.0, using: :btree) %>
23
- t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
24
- end
25
-
26
- create_table "dept_manager", id: false, force: :cascade do |t|
27
- t.string "dept_no", null: false
28
- t.integer "emp_no", null: false
29
- t.date "from_date", null: false
30
- t.date "to_date", null: false
31
- t.index ["dept_no"], name: "dept_no", <%= i cond(5.0, using: :btree) %>
32
- t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
33
- end
34
-
35
- create_table "employee_clubs", force: :cascade do |t|
36
- t.integer "emp_no", null: false
37
- t.integer "club_id", null: false
38
- t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id", <%= i cond(5.0, using: :btree) %>
39
- end
40
-
41
- create_table "employees", primary_key: "emp_no", force: :cascade do |t|
42
- t.date "birth_date", null: false
43
- t.string "first_name", limit: 14, null: false
44
- t.string "last_name", limit: 16, null: false
45
- t.string "gender", limit: 1, null: false
46
- t.date "hire_date", null: false
47
- end
48
-
49
- create_table "salaries", id: false, force: :cascade do |t|
50
- t.integer "emp_no", null: false
51
- t.integer "salary", null: false
52
- t.date "from_date", null: false
53
- t.date "to_date", null: false
54
- t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
55
- end
56
-
57
- create_table "titles", id: false, force: :cascade do |t|
58
- t.integer "emp_no", null: false
59
- t.string "title", limit: 50, null: false
60
- t.date "from_date", null: false
61
- t.date "to_date"
62
- t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
63
- end
64
- ERB
65
- end
66
-
67
- let(:actual_dsl) { dsl }
68
-
69
- let(:expected_dsl) do
70
- erbh(<<-ERB)
71
- create_table "clubs", force: :cascade do |t|
72
- t.string "name", default: "", null: false
73
- end
74
-
75
- create_table "departments", primary_key: "dept_no", force: :cascade do |t|
76
- t.string "dept_name", limit: 40, null: false
77
- t.index ["dept_name"], name: "dept_name", unique: true, <%= i cond(5.0, using: :btree) %>
78
- end
79
-
80
- create_table "dept_emp", id: false, force: :cascade do |t|
81
- t.integer "emp_no", null: false
82
- t.string "dept_no", null: false
83
- t.date "from_date", null: false
84
- t.date "to_date", null: false
85
- t.index ["dept_no"], name: "dept_no", <%= i cond(5.0, using: :btree) %>
86
- t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
87
- end
88
-
89
- create_table "dept_manager", id: false, force: :cascade do |t|
90
- t.string "dept_no", null: false
91
- t.integer "emp_no", null: false
92
- t.date "from_date", null: false
93
- t.date "to_date", null: false
94
- t.index ["dept_no"], name: "dept_no", <%= i cond(5.0, using: :btree) %>
95
- t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
96
- end
97
-
98
- create_table "employee_clubs", force: :cascade do |t|
99
- t.integer "emp_no", null: false
100
- t.integer "club_id", null: false
101
- end
102
-
103
- create_table "employees", primary_key: "emp_no", force: :cascade do |t|
104
- t.date "birth_date", null: false
105
- t.string "first_name", limit: 14, null: false
106
- t.string "last_name", limit: 16, null: false
107
- t.string "gender", limit: 1, null: false
108
- t.date "hire_date", null: false
109
- end
110
-
111
- create_table "salaries", id: false, force: :cascade do |t|
112
- t.integer "emp_no", null: false
113
- t.integer "salary", null: false
114
- t.date "from_date", null: false
115
- t.date "to_date", null: false
116
- t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
117
- end
118
-
119
- create_table "titles", id: false, force: :cascade do |t|
120
- t.integer "emp_no", null: false
121
- t.string "title", limit: 50, null: false
122
- t.date "from_date", null: false
123
- t.date "to_date"
124
- end
125
- ERB
126
- end
127
-
128
- before { subject.diff(actual_dsl).migrate }
129
- subject { client(mysql_use_alter: true) }
130
-
131
- it {
132
- delta = subject.diff(expected_dsl)
133
- expect(delta.differ?).to be_truthy
134
- expect(subject.dump).to match_ruby actual_dsl
135
- _migrated, sql = delta.migrate(noop: true)
136
- expect(sql).to match(/ALTER/)
137
- delta.migrate
138
- expect(subject.dump).to match_ruby expected_dsl
139
- }
140
- end
141
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- if ENV['TRAVIS']
4
- require 'simplecov'
5
- require 'coveralls'
6
-
7
- SimpleCov.formatter = Coveralls::SimpleCov::Formatter
8
- SimpleCov.start do
9
- add_filter 'spec/'
10
- end
11
- end