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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/pg_trunk/operations/check_constraints/add_check_constraint.rb +36 -33
- data/lib/pg_trunk/operations/check_constraints/drop_check_constraint.rb +43 -40
- data/lib/pg_trunk/operations/check_constraints/rename_check_constraint.rb +33 -30
- data/lib/pg_trunk/operations/check_constraints/validate_check_constraint.rb +24 -21
- data/lib/pg_trunk/operations/composite_types/change_composite_type.rb +53 -50
- data/lib/pg_trunk/operations/composite_types/create_composite_type.rb +22 -19
- data/lib/pg_trunk/operations/composite_types/drop_composite_type.rb +46 -43
- data/lib/pg_trunk/operations/composite_types/rename_composite_type.rb +15 -12
- data/lib/pg_trunk/operations/domains/change_domain.rb +50 -47
- data/lib/pg_trunk/operations/domains/create_domain.rb +28 -25
- data/lib/pg_trunk/operations/domains/drop_domain.rb +44 -41
- data/lib/pg_trunk/operations/domains/rename_domain.rb +15 -12
- data/lib/pg_trunk/operations/enums/change_enum.rb +35 -32
- data/lib/pg_trunk/operations/enums/create_enum.rb +23 -20
- data/lib/pg_trunk/operations/enums/drop_enum.rb +42 -39
- data/lib/pg_trunk/operations/enums/rename_enum.rb +15 -12
- data/lib/pg_trunk/operations/foreign_keys/add_foreign_key.rb +52 -49
- data/lib/pg_trunk/operations/foreign_keys/drop_foreign_key.rb +51 -48
- data/lib/pg_trunk/operations/foreign_keys/rename_foreign_key.rb +32 -29
- data/lib/pg_trunk/operations/functions/change_function.rb +50 -47
- data/lib/pg_trunk/operations/functions/create_function.rb +67 -64
- data/lib/pg_trunk/operations/functions/drop_function.rb +68 -65
- data/lib/pg_trunk/operations/functions/rename_function.rb +25 -22
- data/lib/pg_trunk/operations/materialized_views/change_materialized_view.rb +58 -55
- data/lib/pg_trunk/operations/materialized_views/create_materialized_view.rb +74 -71
- data/lib/pg_trunk/operations/materialized_views/drop_materialized_view.rb +49 -46
- data/lib/pg_trunk/operations/materialized_views/refresh_materialized_view.rb +27 -24
- data/lib/pg_trunk/operations/materialized_views/rename_materialized_view.rb +25 -22
- data/lib/pg_trunk/operations/procedures/change_procedure.rb +49 -46
- data/lib/pg_trunk/operations/procedures/create_procedure.rb +55 -52
- data/lib/pg_trunk/operations/procedures/drop_procedure.rb +48 -45
- data/lib/pg_trunk/operations/procedures/rename_procedure.rb +25 -22
- data/lib/pg_trunk/operations/statistics/create_statistics.rb +59 -56
- data/lib/pg_trunk/operations/statistics/drop_statistics.rb +56 -53
- data/lib/pg_trunk/operations/statistics/rename_statistics.rb +16 -13
- data/lib/pg_trunk/operations/triggers/change_trigger.rb +21 -18
- data/lib/pg_trunk/operations/triggers/create_trigger.rb +57 -54
- data/lib/pg_trunk/operations/triggers/drop_trigger.rb +49 -46
- data/lib/pg_trunk/operations/triggers/rename_trigger.rb +51 -48
- data/lib/pg_trunk/operations/views/change_view.rb +41 -38
- data/lib/pg_trunk/operations/views/create_view.rb +48 -45
- data/lib/pg_trunk/operations/views/drop_view.rb +49 -46
- data/lib/pg_trunk/operations/views/rename_view.rb +23 -20
- data/lib/pg_trunk/version.rb +1 -1
- metadata +2 -2
@@ -1,53 +1,56 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
-
# @!
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# @
|
8
|
-
# @
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
# #
|
17
|
-
# d.
|
18
|
-
#
|
19
|
-
# SQL
|
20
|
-
#
|
21
|
-
#
|
22
|
-
# SQL
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
# COMMENT
|
27
|
-
#
|
28
|
-
# COMMENT
|
3
|
+
# @!parse
|
4
|
+
# class ActiveRecord::Migration
|
5
|
+
# # Modify a domain type
|
6
|
+
# #
|
7
|
+
# # @param [#to_s] name (nil) The qualified name of the type
|
8
|
+
# # @yield [d] the block with the type's definition
|
9
|
+
# # @yieldparam Object receiver of methods specifying the type
|
10
|
+
# # @return [void]
|
11
|
+
# #
|
12
|
+
# # The operation can be used to add or remove constraints,
|
13
|
+
# # modify the default_sql value, or the description of the domain type.
|
14
|
+
# # Neither the underlying type nor the collation can be changed.
|
15
|
+
# #
|
16
|
+
# # change_domain "dict.us_postal_code" do |d|
|
17
|
+
# # d.null true # from: false
|
18
|
+
# # # check is added for inversion
|
19
|
+
# # d.drop_constraint "postal_code_length", check: <<~SQL
|
20
|
+
# # length(VALUE) > 3 AND length(VALUE) < 6
|
21
|
+
# # SQL
|
22
|
+
# # d.add_constraint <<~SQL, name: "postal_code_valid"
|
23
|
+
# # VALUE ~ '^\d{5}$' OR VALUE ~ '^\d{5}-\d{4}$'
|
24
|
+
# # SQL
|
25
|
+
# # d.default_sql "'00000'::text", from: "'0000'::text"
|
26
|
+
# # d.comment <<~COMMENT, from: <<~COMMENT
|
27
|
+
# # Supported currencies
|
28
|
+
# # COMMENT
|
29
|
+
# # Currencies
|
30
|
+
# # COMMENT
|
31
|
+
# # end
|
32
|
+
# #
|
33
|
+
# # Use blank string (not a `nil` value) to reset either a default_sql,
|
34
|
+
# # or the comment. `nil`-s here will be ignored.
|
35
|
+
# #
|
36
|
+
# # When dropping a constraint you can use a `check` expression.
|
37
|
+
# # In the same manner, use `from` option with `comment` or `default_sql`
|
38
|
+
# # to make the operation invertible.
|
39
|
+
# #
|
40
|
+
# # It is irreversible in case any `drop_constraint` clause
|
41
|
+
# # has `if_exists: true` or `force: :cascade` option -- due to
|
42
|
+
# # uncertainty of the previous state of the database:
|
43
|
+
# #
|
44
|
+
# # # Irreversible change
|
45
|
+
# # change_domain "dict.us_postal_code", force: :cascade do |d|
|
46
|
+
# # d.drop_constraint "postal_code_valid" # missed `:check` option
|
47
|
+
# # d.drop_constraint "postal_code_length"
|
48
|
+
# # d.drop_constraint "postal_code_format", if_exists: true
|
49
|
+
# # d.default_sql "'0000'::text" # missed `:from` option
|
50
|
+
# # d.comment "New comment" # missed `:from` option
|
51
|
+
# # end
|
52
|
+
# def change_domain(name, &block); end
|
29
53
|
# end
|
30
|
-
#
|
31
|
-
# Use blank string (not a `nil` value) to reset either a default_sql,
|
32
|
-
# or the comment. `nil`-s here will be ignored.
|
33
|
-
#
|
34
|
-
# When dropping a constraint you can use a `check` expression.
|
35
|
-
# In the same manner, use `from` option with `comment` or `default_sql`
|
36
|
-
# to make the operation invertible.
|
37
|
-
#
|
38
|
-
# It is irreversible in case any `drop_constraint` clause
|
39
|
-
# has `if_exists: true` or `force: :cascade` option -- due to
|
40
|
-
# uncertainty of the previous state of the database:
|
41
|
-
#
|
42
|
-
# # Irreversible change
|
43
|
-
# change_domain "dict.us_postal_code", force: :cascade do |d|
|
44
|
-
# d.drop_constraint "postal_code_valid" # missed `:check` option
|
45
|
-
# d.drop_constraint "postal_code_length"
|
46
|
-
# d.drop_constraint "postal_code_format", if_exists: true
|
47
|
-
# d.default_sql "'0000'::text" # missed `:from` option
|
48
|
-
# d.comment "New comment" # missed `:from` option
|
49
|
-
# end
|
50
|
-
|
51
54
|
module PGTrunk::Operations::Domains
|
52
55
|
# @private
|
53
56
|
class ChangeDomain < Base
|
@@ -1,31 +1,34 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
-
# @!
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# @
|
8
|
-
# @option [#to_s] :
|
9
|
-
# @option [
|
10
|
-
# @option [
|
11
|
-
# @option [#to_s] :
|
12
|
-
# @
|
13
|
-
# @
|
14
|
-
#
|
15
|
-
# @
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
# d.
|
21
|
-
# d.
|
22
|
-
#
|
23
|
-
# SQL
|
24
|
-
# d
|
3
|
+
# @!parse
|
4
|
+
# class ActiveRecord::Migration
|
5
|
+
# # Create a domain type
|
6
|
+
# #
|
7
|
+
# # @param [#to_s] name (nil) The qualified name of the type
|
8
|
+
# # @option [#to_s] :as (nil) The base type for the domain (alias: :type)
|
9
|
+
# # @option [#to_s] :collation (nil) The collation
|
10
|
+
# # @option [Boolean] :null (true) If a value of this type can be NULL
|
11
|
+
# # @option [#to_s] :default_sql (nil) The snippet for the default value of the domain
|
12
|
+
# # @option [#to_s] :comment (nil) The comment describing the constraint
|
13
|
+
# # @yield [d] the block with the type's definition
|
14
|
+
# # @yieldparam Object receiver of methods specifying the type
|
15
|
+
# # @return [void]
|
16
|
+
# #
|
17
|
+
# # @example:
|
18
|
+
# #
|
19
|
+
# # create_domain "dict.us_postal_code", as: "text" do |d|
|
20
|
+
# # d.collation "en_US"
|
21
|
+
# # d.default_sql "'0000'::text"
|
22
|
+
# # d.null false
|
23
|
+
# # d.constraint <<~SQL, name: "code_valid"
|
24
|
+
# # VALUE ~ '^\d{5}$' OR VALUE ~ '^\d{5}-\d{4}$'
|
25
|
+
# # SQL
|
26
|
+
# # d.comment "US postal code"
|
27
|
+
# # end
|
28
|
+
# #
|
29
|
+
# # It is always reversible.
|
30
|
+
# def create_domain(name, **options, &block); end
|
25
31
|
# end
|
26
|
-
#
|
27
|
-
# It is always reversible.
|
28
|
-
|
29
32
|
module PGTrunk::Operations::Domains
|
30
33
|
# @private
|
31
34
|
class CreateDomain < Base
|
@@ -1,47 +1,50 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
-
# @!
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# @
|
8
|
-
# @option [
|
9
|
-
# @option [
|
10
|
-
# @option [#to_s] :
|
11
|
-
# @option [#to_s] :
|
12
|
-
# @option [#to_s] :
|
13
|
-
# @
|
14
|
-
# @
|
15
|
-
#
|
16
|
-
# @
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
# SQL
|
27
|
-
# d
|
28
|
-
#
|
29
|
-
# COMMENT
|
3
|
+
# @!parse
|
4
|
+
# class ActiveRecord::Migration
|
5
|
+
# # Drop a domain type by qualified name
|
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] :as (nil) The base type for the domain (alias: :type)
|
11
|
+
# # @option [#to_s] :collation (nil) The collation
|
12
|
+
# # @option [#to_s] :default_sql (nil) The snippet for the default value of the domain
|
13
|
+
# # @option [#to_s] :comment (nil) The comment describing the constraint
|
14
|
+
# # @yield [d] the block with the type's definition
|
15
|
+
# # @yieldparam Object receiver of methods specifying the type
|
16
|
+
# # @return [void]
|
17
|
+
# #
|
18
|
+
# # @example:
|
19
|
+
# #
|
20
|
+
# # drop_domain "dict.us_postal_code"
|
21
|
+
# #
|
22
|
+
# # To make the operation invertible, use the same options
|
23
|
+
# # as in the `create_domain` operation.
|
24
|
+
# #
|
25
|
+
# # drop_domain "dict.us_postal_code", as: "string" do |d|
|
26
|
+
# # d.constraint <<~SQL, name: "code_valid"
|
27
|
+
# # VALUE ~ '^\d{5}$' OR VALUE ~ '^\d{5}-\d{4}$'
|
28
|
+
# # SQL
|
29
|
+
# # d.comment <<~COMMENT
|
30
|
+
# # US postal code
|
31
|
+
# # COMMENT
|
32
|
+
# # end
|
33
|
+
# #
|
34
|
+
# # With the `force: :cascade` option the operation would remove
|
35
|
+
# # all the objects that use the type.
|
36
|
+
# #
|
37
|
+
# # drop_domain "dict.us_postal_code", 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_domain "dict.us_postal_code", if_exists: true
|
43
|
+
# #
|
44
|
+
# # Both options make a migration irreversible due to uncertainty
|
45
|
+
# # of the previous state of the database.
|
46
|
+
# def drop_domain(name, **options, &block); end
|
30
47
|
# end
|
31
|
-
#
|
32
|
-
# With the `force: :cascade` option the operation would remove
|
33
|
-
# all the objects that use the type.
|
34
|
-
#
|
35
|
-
# drop_domain "dict.us_postal_code", force: :cascade
|
36
|
-
#
|
37
|
-
# With the `if_exists: true` option the operation won't fail
|
38
|
-
# even when the view was absent in the database.
|
39
|
-
#
|
40
|
-
# drop_domain "dict.us_postal_code", if_exists: true
|
41
|
-
#
|
42
|
-
# Both options make a migration irreversible due to uncertainty
|
43
|
-
# of the previous state of the database.
|
44
|
-
|
45
48
|
module PGTrunk::Operations::Domains
|
46
49
|
# @private
|
47
50
|
class DropDomain < Base
|
@@ -1,17 +1,20 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
-
# @!
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# @
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
|
3
|
+
# @!parse
|
4
|
+
# class ActiveRecord::Migration
|
5
|
+
# # Change the name and/or schema of a domain 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
|
+
# # A domain type can be both renamed and moved to another schema.
|
12
|
+
# #
|
13
|
+
# # rename_domain "us_code", to: "dict.us_postal_code"
|
14
|
+
# #
|
15
|
+
# # The operation is always reversible.
|
16
|
+
# def rename_domain(name, to:); end
|
17
|
+
# end
|
15
18
|
module PGTrunk::Operations::Domains
|
16
19
|
# @private
|
17
20
|
class RenameDomain < Base
|
@@ -1,38 +1,41 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
-
# @!
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# @
|
8
|
-
# @
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
# e.add_value "
|
17
|
-
# e.
|
18
|
-
# e.
|
19
|
-
#
|
20
|
-
# COMMENT
|
21
|
-
#
|
22
|
-
# COMMENT
|
3
|
+
# @!parse
|
4
|
+
# class ActiveRecord::Migration
|
5
|
+
# # Modify an enumerated type
|
6
|
+
# #
|
7
|
+
# # @param [#to_s] name (nil) The qualified name of the type
|
8
|
+
# # @yield [e] the block with the type's definition
|
9
|
+
# # @yieldparam Object receiver of methods specifying the type
|
10
|
+
# # @return [void]
|
11
|
+
# #
|
12
|
+
# # The operation can be used to rename or add values to the
|
13
|
+
# # enumerated type. The commend can be changed as well.
|
14
|
+
# #
|
15
|
+
# # change_enum "currencies" do |e|
|
16
|
+
# # e.add_value "EUR", after: "BTC"
|
17
|
+
# # e.add_value "GBP", before: "usd"
|
18
|
+
# # e.add_value "JPY" # to the end of the list
|
19
|
+
# # e.rename_value "usd", to: "USD"
|
20
|
+
# # e.comment <<~COMMENT, from: <<~COMMENT
|
21
|
+
# # Supported currencies
|
22
|
+
# # COMMENT
|
23
|
+
# # Currencies
|
24
|
+
# # COMMENT
|
25
|
+
# # end
|
26
|
+
# #
|
27
|
+
# # Please, keep in mind that all values will be added before
|
28
|
+
# # the first rename. That's why you should use old values
|
29
|
+
# # (like the `usd` instead of the `USD` in the example above)
|
30
|
+
# # in `before` and `after` options.
|
31
|
+
# #
|
32
|
+
# # Also notice that PostgreSQL doesn't support value deletion,
|
33
|
+
# # that's why adding any value makes the migration irreversible.
|
34
|
+
# #
|
35
|
+
# # It is also irreversible if you changed the comment, but
|
36
|
+
# # not defined its previous value.
|
37
|
+
# def change_enum(name, &block); end
|
23
38
|
# end
|
24
|
-
#
|
25
|
-
# Please, keep in mind that all values will be added before
|
26
|
-
# the first rename. That's why you should use old values
|
27
|
-
# (like the `usd` instead of the `USD` in the example above)
|
28
|
-
# in `before` and `after` options.
|
29
|
-
#
|
30
|
-
# Also notice that PostgreSQL doesn't support value deletion,
|
31
|
-
# that's why adding any value makes the migration irreversible.
|
32
|
-
#
|
33
|
-
# It is also irreversible if you changed the comment, but
|
34
|
-
# not defined its previous value.
|
35
|
-
|
36
39
|
module PGTrunk::Operations::Enums
|
37
40
|
# @private
|
38
41
|
class ChangeEnum < Base
|
@@ -1,26 +1,29 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
-
# @!
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# @
|
8
|
-
# @option [
|
9
|
-
# @
|
10
|
-
# @
|
11
|
-
#
|
12
|
-
# @
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
# e.
|
18
|
-
#
|
19
|
-
# COMMENT
|
3
|
+
# @!parse
|
4
|
+
# class ActiveRecord::Migration
|
5
|
+
# # Create an enumerated type by qualified name
|
6
|
+
# #
|
7
|
+
# # @param [#to_s] name (nil) The qualified name of the type
|
8
|
+
# # @option [Array<#to_s>] :values ([]) The list of values
|
9
|
+
# # @option [#to_s] :comment (nil) The comment describing the constraint
|
10
|
+
# # @yield [e] the block with the type's definition
|
11
|
+
# # @yieldparam Object receiver of methods specifying the type
|
12
|
+
# # @return [void]
|
13
|
+
# #
|
14
|
+
# # @example
|
15
|
+
# #
|
16
|
+
# # create_enum "finances.currency" do |e|
|
17
|
+
# # e.values "BTC", "EUR", "GBP", "USD"
|
18
|
+
# # e.value "JPY" # the alternative way to add a value to the tail
|
19
|
+
# # e.comment <<~COMMENT
|
20
|
+
# # The list of values for supported currencies.
|
21
|
+
# # COMMENT
|
22
|
+
# # end
|
23
|
+
# #
|
24
|
+
# # It is always reversible.
|
25
|
+
# def create_enum(name, **options, &block); end
|
20
26
|
# end
|
21
|
-
#
|
22
|
-
# It is always reversible.
|
23
|
-
|
24
27
|
module PGTrunk::Operations::Enums
|
25
28
|
# @private
|
26
29
|
class CreateEnum < Base
|
@@ -1,45 +1,48 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
-
# @!
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# @
|
8
|
-
# @option [
|
9
|
-
# @option [
|
10
|
-
# @option [
|
11
|
-
# @
|
12
|
-
# @
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
# e.
|
26
|
-
#
|
27
|
-
# COMMENT
|
3
|
+
# @!parse
|
4
|
+
# class ActiveRecord::Migration
|
5
|
+
# # Drop an enumerated type by qualified name
|
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 [Array<#to_s>] :values ([]) The list of values
|
11
|
+
# # @option [#to_s] :comment (nil) The comment describing the constraint
|
12
|
+
# # @yield [e] the block with the type's definition
|
13
|
+
# # @yieldparam Object receiver of methods specifying the type
|
14
|
+
# # @return [void]
|
15
|
+
# #
|
16
|
+
# # The operation drops a enumerated type identified by its
|
17
|
+
# # qualified name (it can include a schema).
|
18
|
+
# #
|
19
|
+
# # drop_enum "finances.currency"
|
20
|
+
# #
|
21
|
+
# # To make the operation invertible, use the same options
|
22
|
+
# # as in the `create_enum` operation.
|
23
|
+
# #
|
24
|
+
# # drop_enum "finances.currency" do |e|
|
25
|
+
# # e.values "BTC", "EUR", "GBP", "USD"
|
26
|
+
# # e.value "JPY" # the alternative way to add a value
|
27
|
+
# # e.comment <<~COMMENT
|
28
|
+
# # The list of values for supported currencies.
|
29
|
+
# # COMMENT
|
30
|
+
# # end
|
31
|
+
# #
|
32
|
+
# # With the `force: :cascade` option the operation would remove
|
33
|
+
# # all the objects that use the type.
|
34
|
+
# #
|
35
|
+
# # drop_enum "finances.currency", force: :cascade
|
36
|
+
# #
|
37
|
+
# # With the `if_exists: true` option the operation won't fail
|
38
|
+
# # even when the view was absent in the database.
|
39
|
+
# #
|
40
|
+
# # drop_enum "finances.currency", if_exists: true
|
41
|
+
# #
|
42
|
+
# # Both options make a migration irreversible due to uncertainty
|
43
|
+
# # of the previous state of the database.
|
44
|
+
# def drop_enum(name, **options, &block); end
|
28
45
|
# end
|
29
|
-
#
|
30
|
-
# With the `force: :cascade` option the operation would remove
|
31
|
-
# all the objects that use the type.
|
32
|
-
#
|
33
|
-
# drop_enum "finances.currency", force: :cascade
|
34
|
-
#
|
35
|
-
# With the `if_exists: true` option the operation won't fail
|
36
|
-
# even when the view was absent in the database.
|
37
|
-
#
|
38
|
-
# drop_enum "finances.currency", if_exists: true
|
39
|
-
#
|
40
|
-
# Both options make a migration irreversible due to uncertainty
|
41
|
-
# of the previous state of the database.
|
42
|
-
|
43
46
|
module PGTrunk::Operations::Enums
|
44
47
|
# @private
|
45
48
|
class DropEnum < Base
|
@@ -1,17 +1,20 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
-
# @!
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# @
|
8
|
-
#
|
9
|
-
# @
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
|
3
|
+
# @!parse
|
4
|
+
# class ActiveRecord::Migration
|
5
|
+
# # Change the name and/or schema of an enumerated 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_enum "currencies", to: "finances.currency"
|
14
|
+
# #
|
15
|
+
# # The operation is always reversible.
|
16
|
+
# def rename_enum(name, to:); end
|
17
|
+
# end
|
15
18
|
module PGTrunk::Operations::Enums
|
16
19
|
# @private
|
17
20
|
class RenameEnum < Base
|