dynamic_migrations 3.4.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/lib/dynamic_migrations/active_record/migrators/foreign_key_constraint.rb +14 -14
  4. data/lib/dynamic_migrations/postgres/generator/extension.rb +2 -2
  5. data/lib/dynamic_migrations/postgres/generator/migration.rb +2 -2
  6. data/lib/dynamic_migrations/postgres/server/database/schema/table/column.rb +3 -0
  7. data/lib/dynamic_migrations/version.rb +1 -1
  8. data/sig/dynamic_migrations/active_record/migrators/column.rbs +18 -0
  9. data/sig/dynamic_migrations/active_record/migrators/enum.rbs +22 -0
  10. data/sig/dynamic_migrations/active_record/migrators/foreign_key_constraint.rbs +29 -0
  11. data/sig/dynamic_migrations/active_record/migrators/function.rbs +28 -0
  12. data/sig/dynamic_migrations/active_record/migrators/index.rbs +17 -0
  13. data/sig/dynamic_migrations/active_record/migrators/schema.rbs +17 -0
  14. data/sig/dynamic_migrations/active_record/migrators/table.rbs +18 -0
  15. data/sig/dynamic_migrations/active_record/migrators/trigger.rbs +32 -0
  16. data/sig/dynamic_migrations/active_record/migrators/unique_constraint.rbs +20 -0
  17. data/sig/dynamic_migrations/active_record/migrators/validation.rbs +24 -0
  18. data/sig/dynamic_migrations/active_record/migrators.rbs +37 -0
  19. data/sig/dynamic_migrations/expected_boolean_error.rbs +4 -0
  20. data/sig/dynamic_migrations/expected_integer_error.rbs +4 -0
  21. data/sig/dynamic_migrations/expected_string_error.rbs +4 -0
  22. data/sig/dynamic_migrations/expected_symbol_error.rbs +4 -0
  23. data/sig/dynamic_migrations/invalid_source_error.rbs +5 -0
  24. data/sig/dynamic_migrations/module_included_into_unexpected_target_error.rbs +7 -0
  25. data/sig/dynamic_migrations/name_helper.rbs +5 -0
  26. data/sig/dynamic_migrations/postgres/connections.rbs +12 -0
  27. data/sig/dynamic_migrations/postgres/generator/column.rbs +24 -0
  28. data/sig/dynamic_migrations/postgres/generator/database_migration.rbs +12 -0
  29. data/sig/dynamic_migrations/postgres/generator/enum.rbs +23 -0
  30. data/sig/dynamic_migrations/postgres/generator/extension.rbs +16 -0
  31. data/sig/dynamic_migrations/postgres/generator/foreign_key_constraint.rbs +21 -0
  32. data/sig/dynamic_migrations/postgres/generator/fragment.rbs +32 -0
  33. data/sig/dynamic_migrations/postgres/generator/function.rbs +21 -0
  34. data/sig/dynamic_migrations/postgres/generator/index.rbs +21 -0
  35. data/sig/dynamic_migrations/postgres/generator/migration.rbs +58 -0
  36. data/sig/dynamic_migrations/postgres/generator/migration_dependency_sorter.rbs +12 -0
  37. data/sig/dynamic_migrations/postgres/generator/primary_key.rbs +20 -0
  38. data/sig/dynamic_migrations/postgres/generator/schema.rbs +17 -0
  39. data/sig/dynamic_migrations/postgres/generator/schema_migration.rbs +13 -0
  40. data/sig/dynamic_migrations/postgres/generator/table.rbs +30 -0
  41. data/sig/dynamic_migrations/postgres/generator/table_migration.rbs +12 -0
  42. data/sig/dynamic_migrations/postgres/generator/trigger.rbs +22 -0
  43. data/sig/dynamic_migrations/postgres/generator/unique_constraint.rbs +21 -0
  44. data/sig/dynamic_migrations/postgres/generator/validation.rbs +21 -0
  45. data/sig/dynamic_migrations/postgres/generator.rbs +57 -0
  46. data/sig/dynamic_migrations/postgres/server/database/configured_extensions.rbs +18 -0
  47. data/sig/dynamic_migrations/postgres/server/database/configured_schemas.rbs +23 -0
  48. data/sig/dynamic_migrations/postgres/server/database/connection.rbs +29 -0
  49. data/sig/dynamic_migrations/postgres/server/database/differences/to_migrations/extensions.rbs +22 -0
  50. data/sig/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/enums.rbs +24 -0
  51. data/sig/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/functions.rbs +24 -0
  52. data/sig/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/columns.rbs +26 -0
  53. data/sig/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/foreign_key_constraints.rbs +26 -0
  54. data/sig/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/indexes.rbs +26 -0
  55. data/sig/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/primary_key.rbs +25 -0
  56. data/sig/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/triggers.rbs +26 -0
  57. data/sig/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/unique_constraints.rbs +26 -0
  58. data/sig/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/validations.rbs +26 -0
  59. data/sig/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables.rbs +33 -0
  60. data/sig/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas.rbs +30 -0
  61. data/sig/dynamic_migrations/postgres/server/database/differences/to_migrations.rbs +47 -0
  62. data/sig/dynamic_migrations/postgres/server/database/differences.rbs +54 -0
  63. data/sig/dynamic_migrations/postgres/server/database/enums_loader.rbs +18 -0
  64. data/sig/dynamic_migrations/postgres/server/database/extensions_loader.rbs +17 -0
  65. data/sig/dynamic_migrations/postgres/server/database/keys_and_unique_constraints_loader.rbs +15 -0
  66. data/sig/dynamic_migrations/postgres/server/database/loaded_extensions.rbs +19 -0
  67. data/sig/dynamic_migrations/postgres/server/database/loaded_schemas.rbs +23 -0
  68. data/sig/dynamic_migrations/postgres/server/database/loaded_schemas_builder.rbs +27 -0
  69. data/sig/dynamic_migrations/postgres/server/database/schema/enum.rbs +28 -0
  70. data/sig/dynamic_migrations/postgres/server/database/schema/enums.rbs +31 -0
  71. data/sig/dynamic_migrations/postgres/server/database/schema/function.rbs +30 -0
  72. data/sig/dynamic_migrations/postgres/server/database/schema/functions.rbs +31 -0
  73. data/sig/dynamic_migrations/postgres/server/database/schema/table/column.rbs +28 -0
  74. data/sig/dynamic_migrations/postgres/server/database/schema/table/columns.rbs +30 -0
  75. data/sig/dynamic_migrations/postgres/server/database/schema/table/foreign_key_constraint.rbs +55 -0
  76. data/sig/dynamic_migrations/postgres/server/database/schema/table/foreign_key_constraints.rbs +32 -0
  77. data/sig/dynamic_migrations/postgres/server/database/schema/table/index.rbs +62 -0
  78. data/sig/dynamic_migrations/postgres/server/database/schema/table/indexes.rbs +31 -0
  79. data/sig/dynamic_migrations/postgres/server/database/schema/table/primary_key.rbs +40 -0
  80. data/sig/dynamic_migrations/postgres/server/database/schema/table/trigger.rbs +61 -0
  81. data/sig/dynamic_migrations/postgres/server/database/schema/table/triggers.rbs +33 -0
  82. data/sig/dynamic_migrations/postgres/server/database/schema/table/unique_constraint.rbs +49 -0
  83. data/sig/dynamic_migrations/postgres/server/database/schema/table/unique_constraints.rbs +31 -0
  84. data/sig/dynamic_migrations/postgres/server/database/schema/table/validation.rbs +43 -0
  85. data/sig/dynamic_migrations/postgres/server/database/schema/table/validations.rbs +31 -0
  86. data/sig/dynamic_migrations/postgres/server/database/schema/table.rbs +38 -0
  87. data/sig/dynamic_migrations/postgres/server/database/schema/tables.rbs +28 -0
  88. data/sig/dynamic_migrations/postgres/server/database/schema.rbs +21 -0
  89. data/sig/dynamic_migrations/postgres/server/database/source.rbs +18 -0
  90. data/sig/dynamic_migrations/postgres/server/database/structure_loader.rbs +19 -0
  91. data/sig/dynamic_migrations/postgres/server/database/triggers_and_functions_loader.rbs +20 -0
  92. data/sig/dynamic_migrations/postgres/server/database/validations_loader.rbs +15 -0
  93. data/sig/dynamic_migrations/postgres/server/database.rbs +34 -0
  94. data/sig/dynamic_migrations/postgres/server.rbs +19 -0
  95. data/sig/dynamic_migrations/postgres.rbs +4 -0
  96. data/sig/dynamic_migrations.rbs +6 -0
  97. data/sig/pg.rbs +20 -0
  98. data/sig/tsort.rbs +3 -0
  99. metadata +93 -2
@@ -0,0 +1,33 @@
1
+ # TypeProf 0.21.7
2
+
3
+ # Classes
4
+ module DynamicMigrations
5
+ module Postgres
6
+ class Server
7
+ class Database
8
+ class Differences
9
+ class ToMigrations
10
+ module Schemas
11
+ module Tables
12
+
13
+ private
14
+ def process_tables: (Symbol schema_name, untyped configuration_tables, untyped database_tables) -> void
15
+ def process_table: (Symbol schema_name, Symbol table_name, untyped configuration_table, untyped database_table) -> void
16
+ # this method comes from the Columns module
17
+ def process_dependents: (Symbol schema_name, Symbol table_name, untyped configuration_columns, untyped database_columns) -> void
18
+ def process_columns: (Symbol schema_name, Symbol table_name, untyped configuration_columns, untyped database_columns) -> void
19
+ def process_foreign_key_constraints: (Symbol schema_name, Symbol table_name, untyped configuration_foreign_key_constraints, untyped database_foreign_key_constraints) -> void
20
+ def process_indexes: (Symbol schema_name, Symbol table_name, untyped configuration_indexes, untyped database_indexes) -> void
21
+ def process_primary_key: (Symbol schema_name, Symbol table_name, untyped configuration_primary_key, untyped database_primary_key) -> void
22
+ def process_triggers: (Symbol schema_name, Symbol table_name, untyped configuration_triggers, untyped database_triggers) -> void
23
+ def process_unique_constraints: (Symbol schema_name, Symbol table_name, untyped configuration_unique_constraints, untyped database_unique_constraints) -> void
24
+ def process_validations: (Symbol schema_name, Symbol table_name, untyped configuration_validations, untyped database_validations) -> void
25
+
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,30 @@
1
+ # TypeProf 0.21.7
2
+
3
+ # Classes
4
+ module DynamicMigrations
5
+ module Postgres
6
+ class Server
7
+ class Database
8
+ class Differences
9
+ class ToMigrations
10
+ module Schemas
11
+
12
+ private
13
+ def process_schema: (Symbol schema_name, untyped configuration_schema, untyped database_schema) -> void
14
+
15
+ # this method comes from the Functions module
16
+ def process_functions: (Symbol schema_name, untyped configuration_functions, untyped database_functions) -> void
17
+
18
+ # this method comes from the Enums module
19
+ def process_enums: (Symbol schema_name, untyped configuration_enums, untyped database_enums) -> void
20
+
21
+ # this method comes from the Tables module
22
+ def process_tables: (Symbol schema_name, untyped configuration_tables, untyped database_tables) -> void
23
+
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,47 @@
1
+ # TypeProf 0.21.7
2
+
3
+ # Classes
4
+ module DynamicMigrations
5
+ module Postgres
6
+ class Server
7
+ class Database
8
+ class Differences
9
+ class ToMigrations
10
+ @database: Database
11
+ @differences_hash: untyped
12
+ @generator: Generator
13
+ @differences: Differences
14
+ @differences_hash: Hash[untyped, untyped]
15
+
16
+ include Extensions
17
+ include Schemas
18
+ include Schemas::Functions
19
+ include Schemas::Tables
20
+ include Schemas::Tables::Columns
21
+ include Schemas::Tables::ForeignKeyConstraints
22
+ include Schemas::Tables::Indexes
23
+ include Schemas::Tables::PrimaryKey
24
+ include Schemas::Tables::Triggers
25
+ include Schemas::Tables::UniqueConstraints
26
+ include Schemas::Tables::Validations
27
+
28
+ def initialize: (Database database, Differences differences) -> void
29
+ def migrations: -> untyped
30
+
31
+ private
32
+ def differences: -> Hash[untyped, untyped]
33
+
34
+ # this method comes from the Schemas module
35
+ def process_schema: (Symbol schema_name, untyped configuration_schema, untyped database_schema) -> void
36
+
37
+ class UnexpectedDatabaseObjectError < StandardError
38
+ end
39
+
40
+ class UnexpectedDifferencesObjectError < StandardError
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,54 @@
1
+ module DynamicMigrations
2
+ module Postgres
3
+ class Server
4
+ class Database
5
+ class Differences
6
+ @database: Database
7
+
8
+ def initialize: (Database database) -> void
9
+ def to_h: -> {
10
+ configuration: {
11
+ schemas: Hash[Symbol, untyped],
12
+ extensions: Hash[Symbol, {exists: bool}]
13
+ },
14
+ database: {
15
+ schemas: Hash[Symbol, untyped],
16
+ extensions: Hash[Symbol, {exists: bool}]
17
+ }
18
+ }
19
+ def to_migrations: -> Hash[Symbol, Array[{name: Symbol, content: String}]]
20
+
21
+ def self.compare_schemas: (Hash[Symbol, Schema] schemas, Hash[Symbol, Schema] comparison_schemas) -> Hash[Symbol, untyped]
22
+ def self.compare_extensions: (Array[Symbol] extensions, Array[Symbol] comparison_extensions) -> Hash[Symbol, untyped]
23
+ def self.compare_schema: (Schema schema, Schema comparison_schema) -> {
24
+ exists: true,
25
+ tables: Hash[Symbol, untyped]
26
+ }
27
+ def self.compare_tables: (Hash[Symbol, Schema::Table] tables, Hash[Symbol, Schema::Table] comparison_tables) -> Hash[Symbol, untyped]
28
+ def self.compare_functions: (Hash[Symbol, Schema::Function] functions, Hash[Symbol, Schema::Function] comparison_functions) -> Hash[Symbol, untyped]
29
+ def self.compare_enums: (Hash[Symbol, Schema::Enum] enums, Hash[Symbol, Schema::Enum] comparison_enums) -> Hash[Symbol, untyped]
30
+ def self.compare_table: (Schema::Table table, Schema::Table comparison_table) -> Hash[Symbol, untyped]
31
+ def self.compare_columns: (Hash[Symbol, Schema::Table::Column] columns, Hash[Symbol, Schema::Table::Column] comparison_columns) -> Hash[Symbol, untyped]
32
+ def self.compare_triggers: (Hash[Symbol, Schema::Table::Trigger] triggers, Hash[Symbol, Schema::Table::Trigger] comparison_triggers) -> Hash[Symbol, untyped]
33
+ def self.compare_unique_constraints: (Hash[Symbol, Schema::Table::UniqueConstraint] unique_constraints, Hash[Symbol, Schema::Table::UniqueConstraint] comparison_unique_constraints) -> Hash[Symbol, untyped]
34
+ def self.compare_indexes: (Hash[Symbol, Schema::Table::Index] indexes, Hash[Symbol, Schema::Table::Index] comparison_indexes) -> Hash[Symbol, untyped]
35
+ def self.compare_validations: (Hash[Symbol, Schema::Table::Validation] validations, Hash[Symbol, Schema::Table::Validation] comparison_validations) -> Hash[Symbol, untyped]
36
+ def self.compare_foreign_key_constraints: (Hash[Symbol, Schema::Table::ForeignKeyConstraint] foreign_key_constraints, Hash[Symbol, Schema::Table::ForeignKeyConstraint] comparison_foreign_key_constraints) -> Hash[Symbol, untyped]
37
+ def self.compare_record: (Object | nil base, Object | nil comparison, Array[Symbol] method_list) -> Hash[Symbol, untyped]
38
+
39
+ class ExpectedDatabaseError < StandardError
40
+ end
41
+
42
+ class TableRequiredError < StandardError
43
+ end
44
+
45
+ class SchemaRequiredError < StandardError
46
+ end
47
+
48
+ class FunctionRequiredError < StandardError
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,18 @@
1
+ # TypeProf 0.21.7
2
+
3
+ # Classes
4
+ module DynamicMigrations
5
+ module Postgres
6
+ class Server
7
+ class Database
8
+ module EnumsLoader
9
+ def fetch_enums: -> Hash[Symbol, Hash[Symbol, Array[{values: Array[Symbol], description: String?}]]]
10
+
11
+ # these come from the database object (which this module is included into)
12
+ def connection: -> PG::Connection
13
+
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ # TypeProf 0.21.7
2
+
3
+ # Classes
4
+ module DynamicMigrations
5
+ module Postgres
6
+ class Server
7
+ class Database
8
+ module ExtensionsLoader
9
+ def fetch_extensions: -> Array[Symbol]
10
+
11
+ # these come from the database object (which this module is included into)
12
+ def connection: -> PG::Connection
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ module DynamicMigrations
2
+ module Postgres
3
+ class Server
4
+ class Database
5
+ module KeysAndUniqueConstraintsLoader
6
+ def create_database_keys_and_unique_constraints_cache: -> void
7
+ def fetch_keys_and_unique_constraints: -> Hash[untyped, untyped]
8
+
9
+ # these come from the database object (which this module is included into)
10
+ def connection: -> PG::Connection
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ module DynamicMigrations
2
+ module Postgres
3
+ class Server
4
+ class Database
5
+ module LoadedExtensions
6
+ @loaded_extensions: Hash[Symbol, true]
7
+
8
+ def add_loaded_extension: (Symbol extension_name) -> void
9
+ def has_loaded_extension?: (Symbol extension_name) -> bool
10
+ def loaded_extensions: -> Array[Symbol]
11
+
12
+ class LoadedExtensionAlreadyExistsError < StandardError
13
+ end
14
+
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ module DynamicMigrations
2
+ module Postgres
3
+ class Server
4
+ class Database
5
+ module LoadedSchemas
6
+ @loaded_schemas: Hash[Symbol, Schema]
7
+
8
+ def add_loaded_schema: (Symbol schema_name) -> Schema
9
+ def loaded_schema: (Symbol schema_name) -> Schema
10
+ def has_loaded_schema?: (Symbol schema_name) -> bool
11
+ def loaded_schemas: -> Array[Schema]
12
+ def loaded_schemas_hash: -> Hash[Symbol, Schema]
13
+
14
+ class LoadedSchemaAlreadyExistsError < StandardError
15
+ end
16
+
17
+ class LoadedSchemaDoesNotExistError < StandardError
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ module DynamicMigrations
2
+ module Postgres
3
+ class Server
4
+ class Database
5
+ module LoadedSchemasBuilder
6
+ def recursively_load_database_structure: -> void
7
+
8
+ # these come from the database object (which this module is included into)
9
+ def fetch_validations: -> untyped
10
+ def fetch_structure: -> untyped
11
+ def add_loaded_schema: (Symbol schema_name) -> untyped
12
+ def fetch_keys_and_unique_constraints: -> untyped
13
+ def loaded_schema: (Symbol schema_name) -> Schema
14
+ def fetch_triggers_and_functions: -> untyped
15
+ def fetch_extensions: -> untyped
16
+ def fetch_enums: -> untyped
17
+ def add_loaded_extension: (Symbol extension_name) -> void
18
+ class UnexpectedConstrintTypeError < StandardError
19
+ end
20
+
21
+ class UnexpectedTriggerSchema < StandardError
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,28 @@
1
+ # TypeProf 0.21.7
2
+
3
+ # Classes
4
+ module DynamicMigrations
5
+ module Postgres
6
+ class Server
7
+ class Database
8
+ class Schema
9
+ class Enum < Source
10
+ attr_reader schema: Schema
11
+ attr_reader name: Symbol
12
+ attr_reader values: Array[Symbol]
13
+ attr_reader description: String?
14
+ def initialize: (database_or_configuration source, Schema schema, Symbol name, Array[Symbol] values, ?description: String?) -> void
15
+ def has_description?: -> bool
16
+ def differences_descriptions: (Enum other_enum) -> Array[String]
17
+
18
+ class ExpectedSchemaError < StandardError
19
+ end
20
+
21
+ class ExpectedValuesError < StandardError
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,31 @@
1
+ # TypeProf 0.21.7
2
+
3
+ # Classes
4
+ module DynamicMigrations
5
+ module Postgres
6
+ class Server
7
+ class Database
8
+ class Schema
9
+ module Enums
10
+ @enums: Hash[Symbol, Enum]
11
+
12
+ def add_enum: (Symbol enum_name, Array[Symbol] values, ?description: String?) -> nil
13
+ def enum: (Symbol enum_name) -> Enum
14
+ def has_enum?: (Symbol enum_name) -> bool
15
+ def enums: -> Array[Enum]
16
+ def enums_hash: -> Hash[Symbol, Enum]
17
+
18
+ # these come from the schema object (which this module is included into)
19
+ def source: -> database_or_configuration
20
+
21
+ class EnumAlreadyExistsError < StandardError
22
+ end
23
+
24
+ class EnumDoesNotExistError < StandardError
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,30 @@
1
+ # TypeProf 0.21.7
2
+
3
+ # Classes
4
+ module DynamicMigrations
5
+ module Postgres
6
+ class Server
7
+ class Database
8
+ class Schema
9
+ class Function < Source
10
+ attr_reader schema: Schema
11
+ attr_reader name: Symbol
12
+ attr_reader definition: String
13
+ attr_reader description: String?
14
+ attr_reader triggers: Array[Schema::Table::Trigger]
15
+ def initialize: (database_or_configuration source, Schema schema, Symbol name, String definition, ?description: String?) -> void
16
+ def has_description?: -> bool
17
+ def add_trigger: (Schema::Table::Trigger trigger) -> void
18
+ def differences_descriptions: (Function other_function) -> Array[String]
19
+
20
+ class ExpectedSchemaError < StandardError
21
+ end
22
+
23
+ class ExpectedDefinitionError < StandardError
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,31 @@
1
+ # TypeProf 0.21.7
2
+
3
+ # Classes
4
+ module DynamicMigrations
5
+ module Postgres
6
+ class Server
7
+ class Database
8
+ class Schema
9
+ module Functions
10
+ @functions: Hash[Symbol, Function]
11
+
12
+ def add_function: (Symbol function_name, String definition, ?description: String?) -> nil
13
+ def function: (Symbol function_name) -> Function
14
+ def has_function?: (Symbol function_name) -> bool
15
+ def functions: -> Array[Function]
16
+ def functions_hash: -> Hash[Symbol, Function]
17
+
18
+ # these come from the schema object (which this module is included into)
19
+ def source: -> database_or_configuration
20
+
21
+ class FunctionAlreadyExistsError < StandardError
22
+ end
23
+
24
+ class FunctionDoesNotExistError < StandardError
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,28 @@
1
+ module DynamicMigrations
2
+ module Postgres
3
+ class Server
4
+ class Database
5
+ class Schema
6
+ class Table
7
+ class Column < Source
8
+ attr_reader table: Table
9
+ attr_reader name: Symbol
10
+ attr_reader description: String?
11
+ attr_reader null: bool
12
+ attr_reader default: untyped
13
+ attr_reader data_type: Symbol
14
+ attr_reader array: bool
15
+ attr_reader interval_type: Symbol?
16
+ def initialize: (database_or_configuration source, Table table, Symbol name, Symbol data_type, ?null: bool, ?default: untyped, ?description: String?, ?interval_type: Symbol?) -> void
17
+ def has_description?: -> bool
18
+ def array?: -> bool
19
+
20
+ class ExpectedTableError < StandardError
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,30 @@
1
+ module DynamicMigrations
2
+ module Postgres
3
+ class Server
4
+ class Database
5
+ class Schema
6
+ class Table
7
+ module Columns
8
+ @columns: Hash[Symbol, Column]
9
+
10
+ def column: (Symbol name) -> Column
11
+ def has_column?: (Symbol name) -> bool
12
+ def columns: -> Array[Column]
13
+ def columns_hash: -> Hash[Symbol, Column]
14
+ def add_column: (Symbol name, Symbol data_type, **untyped) -> untyped
15
+
16
+ # these come from the table object (which this module is included into)
17
+ def source: -> database_or_configuration
18
+
19
+ class ColumnDoesNotExistError < StandardError
20
+ end
21
+
22
+ class DuplicateColumnError < StandardError
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,55 @@
1
+ module DynamicMigrations
2
+ module Postgres
3
+ class Server
4
+ class Database
5
+ class Schema
6
+ class Table
7
+ class ForeignKeyConstraint < Source
8
+ type referential_actions = :no_action | :restrict | :cascade | :set_null | :set_default
9
+
10
+ @columns: Hash[Symbol, Column]
11
+ @foreign_columns: Hash[Symbol, Column]
12
+
13
+ attr_reader table: Table
14
+ attr_reader foreign_table: Table
15
+ attr_reader name: Symbol
16
+ attr_reader deferrable: bool
17
+ attr_reader initially_deferred: bool
18
+ attr_reader on_delete: referential_actions
19
+ attr_reader on_update: referential_actions
20
+ attr_reader description: String?
21
+
22
+ def initialize: (database_or_configuration source, Table table, Array[Column] columns, Table foreign_table, Array[Column] foreign_columns, Symbol name, ?deferrable: bool, ?initially_deferred: bool, ?description: String?, ?on_delete: referential_actions, ?on_update: referential_actions) -> void
23
+ def columns: -> Array[Column]
24
+ def column_names: -> Array[Symbol]
25
+ def foreign_columns: -> Array[Column]
26
+ def foreign_column_names: -> Array[Symbol]
27
+ def foreign_schema_name: -> Symbol
28
+ def foreign_table_name: -> Symbol
29
+ def has_description?: -> bool
30
+ def differences_descriptions: (ForeignKeyConstraint other_foreign_key_constraint) -> Array[String]
31
+
32
+ private
33
+ def add_column: (Column column, ?bool foreign) -> void
34
+
35
+ class ExpectedTableError < StandardError
36
+ end
37
+
38
+ class ExpectedArrayOfColumnsError < StandardError
39
+ end
40
+
41
+ class ExpectedDifferentTablesError < StandardError
42
+ end
43
+
44
+ class DuplicateColumnError < StandardError
45
+ end
46
+
47
+ class UnexpectedReferentialActionError < StandardError
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,32 @@
1
+ module DynamicMigrations
2
+ module Postgres
3
+ class Server
4
+ class Database
5
+ class Schema
6
+ class Table
7
+ module ForeignKeyConstraints
8
+ @foreign_key_constraints: Hash[Symbol, ForeignKeyConstraint]
9
+
10
+ def foreign_key_constraint: (Symbol name) -> ForeignKeyConstraint
11
+ def has_foreign_key_constraint?: (Symbol name) -> bool
12
+ def foreign_key_constraints: -> Array[ForeignKeyConstraint]
13
+ def foreign_key_constraints_hash: -> Hash[Symbol, ForeignKeyConstraint]
14
+ def add_foreign_key_constraint: (Symbol name, Array[Symbol] column_names, Symbol foreign_schema_name, Symbol foreign_table_name, Array[Symbol] foreign_column_names, **untyped) -> untyped
15
+
16
+ # these come from the table object (which this module is included into)
17
+ def source: -> database_or_configuration
18
+ def column: (Symbol column_name) -> Column
19
+ def schema: -> Schema
20
+
21
+ class ForeignKeyConstraintDoesNotExistError < StandardError
22
+ end
23
+
24
+ class ForeignKeyConstraintAlreadyExistsError < StandardError
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,62 @@
1
+ module DynamicMigrations
2
+ module Postgres
3
+ class Server
4
+ class Database
5
+ class Schema
6
+ class Table
7
+ class Index < Source
8
+ INDEX_TYPES: [:btree, :hash, :gist, :gin, :bring, :spgist]
9
+ ORDERS: [:asc, :desc]
10
+ NULL_POSITIONS: [:first, :last]
11
+
12
+ type index_types = :btree | :hash | :gist | :gin | :bring | :spgist
13
+ type index_orders = :asc | :desc
14
+ type index_null_positions = :first | :last
15
+
16
+ @columns: Hash[untyped, untyped]
17
+ @include_columns: Hash[untyped, untyped]
18
+
19
+ attr_reader table: Table
20
+ attr_reader name: Symbol
21
+ attr_reader unique: bool
22
+ attr_reader where: String?
23
+ attr_reader type: index_types
24
+ attr_reader order: index_orders
25
+ attr_reader nulls_position: index_null_positions
26
+ attr_reader description: String?
27
+
28
+ def initialize: (database_or_configuration source, Table table, Array[Column] columns, Symbol name, ?unique: bool, ?where: String?, ?type: index_types, ?include_columns: Array[Column], ?order: index_orders, ?nulls_position: index_null_positions, ?description: String?) -> void
29
+ def columns: -> Array[Column]
30
+ def column_names: -> Array[Symbol]
31
+ def include_columns: -> Array[Column]
32
+ def include_column_names: -> Array[Symbol]
33
+ def has_description?: -> bool
34
+ def differences_descriptions: (Index other_index) -> Array[String]
35
+
36
+ private
37
+ def add_column: (Column column, ?is_include_column: bool) -> void
38
+
39
+ class ExpectedTableError < StandardError
40
+ end
41
+
42
+ class ExpectedArrayOfColumnsError < StandardError
43
+ end
44
+
45
+ class UnexpectedIndexTypeError < StandardError
46
+ end
47
+
48
+ class UnexpectedOrderError < StandardError
49
+ end
50
+
51
+ class UnexpectedNullsPositionError < StandardError
52
+ end
53
+
54
+ class DuplicateColumnError < StandardError
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,31 @@
1
+ module DynamicMigrations
2
+ module Postgres
3
+ class Server
4
+ class Database
5
+ class Schema
6
+ class Table
7
+ module Indexes
8
+ @indexes: Hash[Symbol, Index]
9
+
10
+ def index: (Symbol name) -> Index
11
+ def has_index?: (Symbol name) -> bool
12
+ def indexes: -> Array[Index]
13
+ def indexes_hash: -> Hash[Symbol, Index]
14
+ def add_index: (Symbol name, Array[Symbol] column_names, ?include_column_names: Array[Symbol], **untyped) -> Index
15
+
16
+ # these come from the table object (which this module is included into)
17
+ def source: -> database_or_configuration
18
+ def column: (Symbol column_name) -> Column
19
+
20
+ class IndexDoesNotExistError < StandardError
21
+ end
22
+
23
+ class IndexAlreadyExistsError < StandardError
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end