pg_trunk 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/pg_trunk/operations/check_constraints/add_check_constraint.rb +36 -33
  4. data/lib/pg_trunk/operations/check_constraints/drop_check_constraint.rb +43 -40
  5. data/lib/pg_trunk/operations/check_constraints/rename_check_constraint.rb +33 -30
  6. data/lib/pg_trunk/operations/check_constraints/validate_check_constraint.rb +24 -21
  7. data/lib/pg_trunk/operations/composite_types/change_composite_type.rb +53 -50
  8. data/lib/pg_trunk/operations/composite_types/create_composite_type.rb +22 -19
  9. data/lib/pg_trunk/operations/composite_types/drop_composite_type.rb +46 -43
  10. data/lib/pg_trunk/operations/composite_types/rename_composite_type.rb +15 -12
  11. data/lib/pg_trunk/operations/domains/change_domain.rb +50 -47
  12. data/lib/pg_trunk/operations/domains/create_domain.rb +28 -25
  13. data/lib/pg_trunk/operations/domains/drop_domain.rb +44 -41
  14. data/lib/pg_trunk/operations/domains/rename_domain.rb +15 -12
  15. data/lib/pg_trunk/operations/enums/change_enum.rb +35 -32
  16. data/lib/pg_trunk/operations/enums/create_enum.rb +23 -20
  17. data/lib/pg_trunk/operations/enums/drop_enum.rb +42 -39
  18. data/lib/pg_trunk/operations/enums/rename_enum.rb +15 -12
  19. data/lib/pg_trunk/operations/foreign_keys/add_foreign_key.rb +52 -49
  20. data/lib/pg_trunk/operations/foreign_keys/drop_foreign_key.rb +51 -48
  21. data/lib/pg_trunk/operations/foreign_keys/rename_foreign_key.rb +32 -29
  22. data/lib/pg_trunk/operations/functions/change_function.rb +50 -47
  23. data/lib/pg_trunk/operations/functions/create_function.rb +67 -64
  24. data/lib/pg_trunk/operations/functions/drop_function.rb +68 -65
  25. data/lib/pg_trunk/operations/functions/rename_function.rb +25 -22
  26. data/lib/pg_trunk/operations/materialized_views/change_materialized_view.rb +58 -55
  27. data/lib/pg_trunk/operations/materialized_views/create_materialized_view.rb +74 -71
  28. data/lib/pg_trunk/operations/materialized_views/drop_materialized_view.rb +49 -46
  29. data/lib/pg_trunk/operations/materialized_views/refresh_materialized_view.rb +27 -24
  30. data/lib/pg_trunk/operations/materialized_views/rename_materialized_view.rb +25 -22
  31. data/lib/pg_trunk/operations/procedures/change_procedure.rb +49 -46
  32. data/lib/pg_trunk/operations/procedures/create_procedure.rb +55 -52
  33. data/lib/pg_trunk/operations/procedures/drop_procedure.rb +48 -45
  34. data/lib/pg_trunk/operations/procedures/rename_procedure.rb +25 -22
  35. data/lib/pg_trunk/operations/statistics/create_statistics.rb +59 -56
  36. data/lib/pg_trunk/operations/statistics/drop_statistics.rb +56 -53
  37. data/lib/pg_trunk/operations/statistics/rename_statistics.rb +16 -13
  38. data/lib/pg_trunk/operations/triggers/change_trigger.rb +21 -18
  39. data/lib/pg_trunk/operations/triggers/create_trigger.rb +57 -54
  40. data/lib/pg_trunk/operations/triggers/drop_trigger.rb +49 -46
  41. data/lib/pg_trunk/operations/triggers/rename_trigger.rb +51 -48
  42. data/lib/pg_trunk/operations/views/change_view.rb +41 -38
  43. data/lib/pg_trunk/operations/views/create_view.rb +48 -45
  44. data/lib/pg_trunk/operations/views/drop_view.rb +49 -46
  45. data/lib/pg_trunk/operations/views/rename_view.rb +23 -20
  46. data/lib/pg_trunk/version.rb +1 -1
  47. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98c9050bc62e8f9a33f87ff77a836189fca018a968ff1fd487f1e5b613b1278f
4
- data.tar.gz: 30bcc2a1d61cc3343a95e752d8307c20b1326b57969ac0479a3e4ef161026747
3
+ metadata.gz: 27719617c7b0d1c1fbd927d07012f218a48a6a02183334766f4defde22c3a7eb
4
+ data.tar.gz: 8c1d90a98ea419a38a1f0971c5d122432488e7677872c79f637e3d99c93e9a85
5
5
  SHA512:
6
- metadata.gz: a4ba64e08cb9a12ce958e1a4a13a88370e4a20e8fe25cf9da19731c5e77ea8d952decabaebd89c6c0af545f34e955f274a768ad28282345e0365ef57f314d69b
7
- data.tar.gz: 62289de65886d00d28a979149909839f237afdd9e1144f61710306f4da4258e9487da36e07ef21f46e90b86f63cd6b18a17db59317728eac56ce37524cdbc60a
6
+ metadata.gz: 787ec0229602b9abf5d31e684175a44dd5dfb3c4ccb449dc3145eee365bed8e0ac0c7c8f18def6251b0fa2c51ea550cf2ae204b22a63bd1c347c03938376cf11
7
+ data.tar.gz: 46bf35d7204f8497622168743cbd1ade98d63802d33f5634109df45b2e25d34f070922c2d00dd45926e033f066f9b0fe412bbe7257a1af14a8f38eb9abd6c459
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ The noteworthy changes for each PGTrunk version are included here.
4
4
  The format is based on [Keep a Changelog] and this project adheres to [Semantic Versioning].
5
5
  For a complete changelog, see the [commits] for each version via the version links.
6
6
 
7
+ ## [0.1.1] (2022-01-16)
8
+
9
+ * Fix inline documentation for methods added to ActiveRecord::Migration
10
+
7
11
  ## [0.1.0] (2022-01-14)
8
12
 
9
13
  This is a first public release (nepalez)
@@ -24,6 +28,7 @@ Supported features:
24
28
  - composite types
25
29
  - domains types
26
30
 
31
+ [0.1.1]: https://github.com/nepalez/pg_trunk/releases/tag/v0.1.1
27
32
  [0.1.0]: https://github.com/nepalez/pg_trunk/releases/tag/v0.1.0
28
33
 
29
34
  [Keep a Changelog]: http://keepachangelog.com/
@@ -1,39 +1,42 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- # @!method ActiveRecord::Migration#add_check_constraint(table, expression = nil, **options, &block)
4
- # Add a check constraint to the table
5
- #
6
- # @param [#to_s] table (nil) The qualified name of the table
7
- # @param [#to_s] expression (nil) The SQL expression
8
- # @option [#to_s] :name (nil) The optional name of the constraint
9
- # @option [Boolean] :inherit (true) If the constraint should be inherited by subtables
10
- # @option [#to_s] :comment (nil) The comment describing the constraint
11
- # @yield [Proc] the block with the constraint's definition
12
- # @yieldparam The receiver of methods specifying the constraint
13
- #
14
- # The name of the new constraint can be set explicitly
15
- #
16
- # add_check_constraint :users, "length(phone) > 10",
17
- # name: "phone_is_long_enough",
18
- # inherit: false,
19
- # comment: "Phone is 10+ chars long"
20
- #
21
- # The name can also be skipped (it will be generated by default):
22
- #
23
- # add_check_constraint :users, "length(phone) > 1"
24
- #
25
- # The block syntax can be used for any argument as usual:
26
- #
27
- # add_check_constraint do |c|
28
- # c.table "users"
29
- # c.expression "length(phone) > 10"
30
- # c.name "phone_is_long_enough"
31
- # c.inherit false
32
- # c.comment "Phone is 10+ chars long"
3
+ # @!parse
4
+ # class ActiveRecord::Migration
5
+ # # Add a check constraint to the table
6
+ # #
7
+ # # @param [#to_s] table (nil) The qualified name of the table
8
+ # # @param [#to_s] expression (nil) The SQL expression
9
+ # # @option [#to_s] :name (nil) The optional name of the constraint
10
+ # # @option [Boolean] :inherit (true) If the constraint should be inherited by subtables
11
+ # # @option [#to_s] :comment (nil) The comment describing the constraint
12
+ # # @yield [c] the block with the constraint's definition
13
+ # # @yieldparam Object receiver of methods specifying the constraint
14
+ # # @return [void]
15
+ # #
16
+ # # The name of the new constraint can be set explicitly
17
+ # #
18
+ # # add_check_constraint :users, "length(phone) > 10",
19
+ # # name: "phone_is_long_enough",
20
+ # # inherit: false,
21
+ # # comment: "Phone is 10+ chars long"
22
+ # #
23
+ # # The name can also be skipped (it will be generated by default):
24
+ # #
25
+ # # add_check_constraint :users, "length(phone) > 1"
26
+ # #
27
+ # # The block syntax can be used for any argument as usual:
28
+ # #
29
+ # # add_check_constraint do |c|
30
+ # # c.table "users"
31
+ # # c.expression "length(phone) > 10"
32
+ # # c.name "phone_is_long_enough"
33
+ # # c.inherit false
34
+ # # c.comment "Phone is 10+ chars long"
35
+ # # end
36
+ # #
37
+ # # The operation is always reversible.
38
+ # def add_check_constraint(table, expression = nil, **options, &block); end
33
39
  # end
34
- #
35
- # The operation is always reversible.
36
-
37
40
  module PGTrunk::Operations::CheckConstraints
38
41
  # @private
39
42
  class AddCheckConstraint < Base
@@ -1,46 +1,49 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- # @!method ActiveRecord::Migration#drop_check_constraint(table, expression = nil, **options, &block)
4
- # Remove a check constraint from the table
5
- #
6
- # @param [#to_s] table (nil) The qualified name of the table
7
- # @param [#to_s] expression (nil) The SQL expression
8
- # @option [Boolean] :if_exists (false) Suppress the error when the constraint is absent
9
- # @option [#to_s] :name (nil) The optional name of the constraint
10
- # @option [Boolean] :inherit (true) If the constraint should be inherited by subtables
11
- # @option [#to_s] :comment (nil) The comment describing the constraint
12
- # @yield [Proc] the block with the constraint's definition
13
- # @yieldparam The receiver of methods specifying the constraint
14
- #
15
- # Definition for the `drop_check_constraint` operation
16
- #
17
- # The constraint can be identified by the table and explicit name
18
- #
19
- # drop_check_constraint :users, name: "phone_is_long_enough"
20
- #
21
- # Alternatively the name can be got from the expression.
22
- # Be careful! the expression must have exactly the same form
23
- # as stored in the database:
24
- #
25
- # drop_check_constraint :users, "length((phone::text) > 10)"
26
- #
27
- # To made operation reversible the expression must be provided:
28
- #
29
- # drop_check_constraint "users" do |c|
30
- # c.expression "length((phone::text) > 10)"
31
- # c.inherit false
32
- # c.comment "The phone is 10+ chars long"
3
+ # @!parse
4
+ # class ActiveRecord::Migration
5
+ # # Remove a check constraint from the table
6
+ # #
7
+ # # @param [#to_s] table (nil) The qualified name of the table
8
+ # # @param [#to_s] expression (nil) The SQL expression
9
+ # # @option [Boolean] :if_exists (false) Suppress the error when the constraint is absent
10
+ # # @option [#to_s] :name (nil) The optional name of the constraint
11
+ # # @option [Boolean] :inherit (true) If the constraint should be inherited by subtables
12
+ # # @option [#to_s] :comment (nil) The comment describing the constraint
13
+ # # @yield [c] the block with the constraint's definition
14
+ # # @yieldparam Object receiver of methods specifying the constraint
15
+ # # @return [void]
16
+ # #
17
+ # # Definition for the `drop_check_constraint` operation
18
+ # #
19
+ # # The constraint can be identified by the table and explicit name
20
+ # #
21
+ # # drop_check_constraint :users, name: "phone_is_long_enough"
22
+ # #
23
+ # # Alternatively the name can be got from the expression.
24
+ # # Be careful! the expression must have exactly the same form
25
+ # # as stored in the database:
26
+ # #
27
+ # # drop_check_constraint :users, "length((phone::text) > 10)"
28
+ # #
29
+ # # To made operation reversible the expression must be provided:
30
+ # #
31
+ # # drop_check_constraint "users" do |c|
32
+ # # c.expression "length((phone::text) > 10)"
33
+ # # c.inherit false
34
+ # # c.comment "The phone is 10+ chars long"
35
+ # # end
36
+ # #
37
+ # # The operation can be called with `if_exists` option.
38
+ # #
39
+ # # drop_check_constraint :users,
40
+ # # name: "phone_is_long_enough",
41
+ # # if_exists: true
42
+ # #
43
+ # # In this case the operation is always irreversible due to
44
+ # # uncertainty of the previous state of the database.
45
+ # def drop_check_constraint(table, expression = nil, **options, &block); end
33
46
  # end
34
- #
35
- # The operation can be called with `if_exists` option.
36
- #
37
- # drop_check_constraint :users,
38
- # name: "phone_is_long_enough",
39
- # if_exists: true
40
- #
41
- # In this case the operation is always irreversible due to
42
- # uncertainty of the previous state of the database.
43
-
44
47
  module PGTrunk::Operations::CheckConstraints
45
48
  # @private
46
49
  class DropCheckConstraint < Base
@@ -1,35 +1,38 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- # @!method ActiveRecord::Migration#rename_check_constraint(table, expression = nil, **options, &block)
4
- # Rename a check constraint
5
- #
6
- # @param [#to_s] table (nil) The qualified name of the table
7
- # @param [#to_s] expression (nil) The SQL expression
8
- # @option [#to_s] :name (nil) The current name of the constraint
9
- # @option [#to_s] :to (nil) The new name for the constraint
10
- # @yield [Proc] the block with the constraint's definition
11
- # @yieldparam The receiver of methods specifying the constraint
12
- #
13
- # A constraint can be identified by the table and explicit name
14
- #
15
- # rename_check_constraint :users,
16
- # name: "phone_is_long_enough",
17
- # to: "phones.long_enough"
18
- #
19
- # Alternatively the name can be got from the expression.
20
- # Be careful! the expression must have exactly the same form
21
- # as stored in the database:
22
- #
23
- # rename_check_constraint :users, "length((phone::text) > 10)",
24
- # to: "long_enough"
25
- #
26
- # The name can be reset to auto-generated when
27
- # the `:to` option is missed or blank:
28
- #
29
- # rename_check_constraint :users, "phone_is_long_enough"
30
- #
31
- # The operation is always reversible.
32
-
3
+ # @!parse
4
+ # class ActiveRecord::Migration
5
+ # # Rename a check constraint
6
+ # #
7
+ # # @param [#to_s] table (nil) The qualified name of the table
8
+ # # @param [#to_s] expression (nil) The SQL expression
9
+ # # @option [#to_s] :name (nil) The current name of the constraint
10
+ # # @option [#to_s] :to (nil) The new name for the constraint
11
+ # # @yield [c] the block with the constraint's definition
12
+ # # @yieldparam Object receiver of methods specifying the constraint
13
+ # # @return [void]
14
+ # #
15
+ # # A constraint can be identified by the table and explicit name
16
+ # #
17
+ # # rename_check_constraint :users,
18
+ # # name: "phone_is_long_enough",
19
+ # # to: "phones.long_enough"
20
+ # #
21
+ # # Alternatively the name can be got from the expression.
22
+ # # Be careful! the expression must have exactly the same form
23
+ # # as stored in the database:
24
+ # #
25
+ # # rename_check_constraint :users, "length((phone::text) > 10)",
26
+ # # to: "long_enough"
27
+ # #
28
+ # # The name can be reset to auto-generated when
29
+ # # the `:to` option is missed or blank:
30
+ # #
31
+ # # rename_check_constraint :users, "phone_is_long_enough"
32
+ # #
33
+ # # The operation is always reversible.
34
+ # def rename_check_constraint(table, expression = nil, **options, &block); end
35
+ # end
33
36
  module PGTrunk::Operations::CheckConstraints
34
37
  # @private
35
38
  class RenameCheckConstraint < Base
@@ -1,26 +1,29 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- # @!method ActiveRecord::Migration#validate_check_constraint(table, expression = nil, **options, &block)
4
- # Validate an invalid check constraint
5
- #
6
- # @param [#to_s] table (nil) The qualified name of the table
7
- # @param [#to_s] expression (nil) The SQL expression
8
- # @option [#to_s] :name (nil) The optional name of the constraint
9
- # @yield [Proc] the block with the constraint's definition
10
- # @yieldparam The receiver of methods specifying the constraint
11
- #
12
- # The invalid constraint can be identified by table and explicit name:
13
- #
14
- # validate_check_constraint :users, name: "phone_is_long_enough"
15
- #
16
- # Alternatively it can be specified by expression. In this case
17
- # you must ensure the expression has the same form as it is stored
18
- # in the database (after parsing the source).
19
- #
20
- # validate_check_constraint :users, "length((phone::text) > 10)"
21
- #
22
- # Notice that it is invertible but the inverted operation does nothing.
23
-
3
+ # @!parse
4
+ # class ActiveRecord::Migration
5
+ # # Validate an invalid check constraint
6
+ # #
7
+ # # @param [#to_s] table (nil) The qualified name of the table
8
+ # # @param [#to_s] expression (nil) The SQL expression
9
+ # # @option [#to_s] :name (nil) The optional name of the constraint
10
+ # # @yield [c] the block with the constraint's definition
11
+ # # @yieldparam Object receiver of methods specifying the constraint
12
+ # # @return [void]
13
+ # #
14
+ # # The invalid constraint can be identified by table and explicit name:
15
+ # #
16
+ # # validate_check_constraint :users, name: "phone_is_long_enough"
17
+ # #
18
+ # # Alternatively it can be specified by expression. In this case
19
+ # # you must ensure the expression has the same form as it is stored
20
+ # # in the database (after parsing the source).
21
+ # #
22
+ # # validate_check_constraint :users, "length((phone::text) > 10)"
23
+ # #
24
+ # # Notice that it is invertible but the inverted operation does nothing.
25
+ # def validate_check_constraint(table, expression = nil, **options, &block); end
26
+ # end
24
27
  module PGTrunk::Operations::CheckConstraints
25
28
  # @private
26
29
  class ValidateCheckConstraint < Base
@@ -1,56 +1,59 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- # @!method ActiveRecord::Migration#change_composite_type(name, **options, &block)
4
- # Modify a composite type
5
- #
6
- # @param [#to_s] name (nil) The qualified name of the type
7
- # @option [Symbol] :force (:restrict) How to process dependent objects (`:cascade` or `:restrict`)
8
- # @option [#to_s] :comment (nil) The comment describing the constraint
9
- # @yield [Proc] the block with the type's definition
10
- # @yieldparam The receiver of methods specifying the type
11
- #
12
- # The operation can be used to add, drop, rename or change columns.
13
- # The comment can be changed as well.
14
- #
15
- # Providing a type "paint.colored_point":
16
- #
17
- # create_composite_type "paint.colored_point" do |t|
18
- # t.column "color", "text", collation: "en_US"
19
- # t.column "x", "integer"
20
- # t.column "z", "integer"
3
+ # @!parse
4
+ # class ActiveRecord::Migration
5
+ # # Modify a composite type
6
+ # #
7
+ # # @param [#to_s] name (nil) The qualified name of the type
8
+ # # @option [Symbol] :force (:restrict) How to process dependent objects (`:cascade` or `:restrict`)
9
+ # # @option [#to_s] :comment (nil) The comment describing the constraint
10
+ # # @yield [t] the block with the type's definition
11
+ # # @yieldparam Object receiver of methods specifying the type
12
+ # # @return [void]
13
+ # #
14
+ # # The operation can be used to add, drop, rename or change columns.
15
+ # # The comment can be changed as well.
16
+ # #
17
+ # # Providing a type "paint.colored_point":
18
+ # #
19
+ # # create_composite_type "paint.colored_point" do |t|
20
+ # # t.column "color", "text", collation: "en_US"
21
+ # # t.column "x", "integer"
22
+ # # t.column "z", "integer"
23
+ # # end
24
+ # #
25
+ # # After the following change:
26
+ # #
27
+ # # change_composite_type "paint.colored_point" do |t|
28
+ # # t.change_column "color", "text", collation: "ru_RU", from_collation: "en_US"
29
+ # # t.change_column "x", "bigint", from_type: "integer"
30
+ # # t.drop_column "z", "integer"
31
+ # # t.add_column "Y", "bigint"
32
+ # # t.rename_column "x", to: "X"
33
+ # # t.comment "2D point with a color", from: "2D point"
34
+ # # end
35
+ # #
36
+ # # The definition became:
37
+ # #
38
+ # # create_composite_type "paint.colored_point" do |t|
39
+ # # t.column "color", "text", collation: "ru_RU"
40
+ # # t.column "X", "bigint"
41
+ # # t.column "Y", "integer"
42
+ # # end
43
+ # #
44
+ # # Notice, that all renames will be done AFTER other changes,
45
+ # # so in `change_column` you should use the old names.
46
+ # #
47
+ # # In several cases the operation is not invertible:
48
+ # #
49
+ # # - when a column was dropped
50
+ # # - when `force: :cascade` option is used (to update
51
+ # # objects that use the type)
52
+ # # - when `if_exists: true` is added to the `drop_column` clause
53
+ # # - when a previous state of the column type, collation or comment
54
+ # # is not specified.
55
+ # def change_composite_type(name, **options, &block); end
21
56
  # end
22
- #
23
- # After the following change:
24
- #
25
- # change_composite_type "paint.colored_point" do |t|
26
- # t.change_column "color", "text", collation: "ru_RU", from_collation: "en_US"
27
- # t.change_column "x", "bigint", from_type: "integer"
28
- # t.drop_column "z", "integer"
29
- # t.add_column "Y", "bigint"
30
- # t.rename_column "x", to: "X"
31
- # t.comment "2D point with a color", from: "2D point"
32
- # end
33
- #
34
- # The definition became:
35
- #
36
- # create_composite_type "paint.colored_point" do |t|
37
- # t.column "color", "text", collation: "ru_RU"
38
- # t.column "X", "bigint"
39
- # t.column "Y", "integer"
40
- # end
41
- #
42
- # Notice, that all renames will be done AFTER other changes,
43
- # so in `change_column` you should use the old names.
44
- #
45
- # In several cases the operation is not invertible:
46
- #
47
- # - when a column was dropped
48
- # - when `force: :cascade` option is used (to update
49
- # objects that use the type)
50
- # - when `if_exists: true` is added to the `drop_column` clause
51
- # - when a previous state of the column type, collation or comment
52
- # is not specified.
53
-
54
57
  module PGTrunk::Operations::CompositeTypes
55
58
  # @private
56
59
  class ChangeCompositeType < Base
@@ -1,25 +1,28 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- # @!method ActiveRecord::Migration#create_composite_type(name, **options, &block)
4
- # Create a composite type
5
- #
6
- # @param [#to_s] name (nil) The qualified name of the type
7
- # @option [#to_s] :comment (nil) The comment describing the constraint
8
- # @yield [Proc] the block with the type's definition
9
- # @yieldparam The receiver of methods specifying the type
10
- #
11
- # @example
12
- # create_composite_type "paint.colored_point" do |d|
13
- # d.column "x", "integer"
14
- # d.column "y", "integer"
15
- # d.column "color", "text", collation: "en_US"
16
- # d.comment <<~COMMENT
17
- # 2D point with color
18
- # COMMENT
3
+ # @!parse
4
+ # class ActiveRecord::Migration
5
+ # # Create a composite type
6
+ # #
7
+ # # @param [#to_s] name (nil) The qualified name of the type
8
+ # # @option [#to_s] :comment (nil) The comment describing the constraint
9
+ # # @yield [t] the block with the type's definition
10
+ # # @yieldparam Object receiver of methods specifying the type
11
+ # # @return [void]
12
+ # #
13
+ # # @example
14
+ # # create_composite_type "paint.colored_point" do |d|
15
+ # # d.column "x", "integer"
16
+ # # d.column "y", "integer"
17
+ # # d.column "color", "text", collation: "en_US"
18
+ # # d.comment <<~COMMENT
19
+ # # 2D point with color
20
+ # # COMMENT
21
+ # # end
22
+ # #
23
+ # # It is always reversible.
24
+ # def create_composite_type(name, **options, &block); end
19
25
  # end
20
- #
21
- # It is always reversible.
22
-
23
26
  module PGTrunk::Operations::CompositeTypes
24
27
  # @private
25
28
  class CreateCompositeType < Base
@@ -1,49 +1,52 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- # @!method ActiveRecord::Migration#drop_composite_type(name, **options, &block)
4
- # Drop a composite type
5
- #
6
- # @param [#to_s] name (nil) The qualified name of the type
7
- # @option [Boolean] :if_exists (false) Suppress the error when the type is absent
8
- # @option [Symbol] :force (:restrict) How to process dependent objects (`:cascade` or `:restrict`)
9
- # @option [#to_s] :comment (nil) The comment describing the constraint
10
- # @yield [Proc] the block with the type's definition
11
- # @yieldparam The receiver of methods specifying the type
12
- #
13
- # The operation drops a composite_type type identified by its
14
- # qualified name (it can include a schema).
15
- #
16
- # For inversion use the same options as in the
17
- # `create_composite_type` operation.
18
- #
19
- # drop_composite_type "paint.colored_point" do |d|
20
- # d.column "x", "integer"
21
- # d.column "y", "integer"
22
- # d.column "color", "text", collation: "en_US"
23
- # d.comment <<~COMMENT
24
- # 2D point with color
25
- # COMMENT
3
+ # @!parse
4
+ # class ActiveRecord::Migration
5
+ # # Drop a composite type
6
+ # #
7
+ # # @param [#to_s] name (nil) The qualified name of the type
8
+ # # @option [Boolean] :if_exists (false) Suppress the error when the type is absent
9
+ # # @option [Symbol] :force (:restrict) How to process dependent objects (`:cascade` or `:restrict`)
10
+ # # @option [#to_s] :comment (nil) The comment describing the constraint
11
+ # # @yield [t] the block with the type's definition
12
+ # # @yieldparam Object receiver of methods specifying the type
13
+ # # @return [void]
14
+ # #
15
+ # # The operation drops a composite_type type identified by its
16
+ # # qualified name (it can include a schema).
17
+ # #
18
+ # # For inversion use the same options as in the
19
+ # # `create_composite_type` operation.
20
+ # #
21
+ # # drop_composite_type "paint.colored_point" do |d|
22
+ # # d.column "x", "integer"
23
+ # # d.column "y", "integer"
24
+ # # d.column "color", "text", collation: "en_US"
25
+ # # d.comment <<~COMMENT
26
+ # # 2D point with color
27
+ # # COMMENT
28
+ # # end
29
+ # #
30
+ # # Notice, that the composite type creation can use no attributes.
31
+ # # That's why dropping it is always reversible; though the reversion
32
+ # # would provide a type without columns:
33
+ # #
34
+ # # drop_composite_type "paint.colored_point"
35
+ # #
36
+ # # With the `force: :cascade` option the operation would remove
37
+ # # all objects using the type.
38
+ # #
39
+ # # drop_composite_type "paint.colored_point", force: :cascade
40
+ # #
41
+ # # With the `if_exists: true` option the operation won't fail
42
+ # # even when the view was absent in the database.
43
+ # #
44
+ # # drop_composite_type "paint.colored_point", if_exists: true
45
+ # #
46
+ # # Both options make a migration irreversible due to uncertainty
47
+ # # of the previous state of the database.
48
+ # def drop_composite_type(name, **options, &block); end
26
49
  # end
27
- #
28
- # Notice, that the composite type creation can use no attributes.
29
- # That's why dropping it is always reversible; though the reversion
30
- # would provide a type without columns:
31
- #
32
- # drop_composite_type "paint.colored_point"
33
- #
34
- # With the `force: :cascade` option the operation would remove
35
- # all objects using the type.
36
- #
37
- # drop_composite_type "paint.colored_point", force: :cascade
38
- #
39
- # With the `if_exists: true` option the operation won't fail
40
- # even when the view was absent in the database.
41
- #
42
- # drop_composite_type "paint.colored_point", if_exists: true
43
- #
44
- # Both options make a migration irreversible due to uncertainty
45
- # of the previous state of the database.
46
-
47
50
  module PGTrunk::Operations::CompositeTypes
48
51
  # @private
49
52
  class DropCompositeType < Base
@@ -1,17 +1,20 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- # @!method ActiveRecord::Migration#rename_composite_type(name, to:)
4
- # Change the name and/or schema of a composite type
5
- #
6
- # @param [#to_s] name (nil) The qualified name of the type
7
- # @option [#to_s] :to (nil) The new qualified name for the type
8
- #
9
- # @example
10
- #
11
- # rename_composite_type "point", to: "paint.colored_point"
12
- #
13
- # The operation is always reversible.
14
-
3
+ # @!parse
4
+ # class ActiveRecord::Migration
5
+ # # Change the name and/or schema of a composite type
6
+ # #
7
+ # # @param [#to_s] name (nil) The qualified name of the type
8
+ # # @option [#to_s] :to (nil) The new qualified name for the type
9
+ # # @return [void]
10
+ # #
11
+ # # @example
12
+ # #
13
+ # # rename_composite_type "point", to: "paint.colored_point"
14
+ # #
15
+ # # The operation is always reversible.
16
+ # def rename_composite_type(name, to:); end
17
+ # end
15
18
  module PGTrunk::Operations::CompositeTypes
16
19
  # @private
17
20
  class RenameCompositeType < Base