torque-postgresql 4.0.1 → 4.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/Rakefile +52 -0
- data/lib/generators/torque/skill_generator.rb +17 -0
- data/lib/generators/torque/templates/trigger.sql.erb +3 -0
- data/lib/generators/torque/trigger_generator.rb +13 -0
- data/lib/torque/postgresql/adapter/database_statements.rb +98 -7
- data/lib/torque/postgresql/adapter/inheritance_statements.rb +297 -0
- data/lib/torque/postgresql/adapter/oid/array.rb +13 -0
- data/lib/torque/postgresql/adapter/oid/box.rb +1 -1
- data/lib/torque/postgresql/adapter/oid/circle.rb +1 -1
- data/lib/torque/postgresql/adapter/oid/composite.rb +117 -0
- data/lib/torque/postgresql/adapter/oid/enum.rb +1 -1
- data/lib/torque/postgresql/adapter/oid/enum_set.rb +2 -2
- data/lib/torque/postgresql/adapter/oid/interval.rb +1 -1
- data/lib/torque/postgresql/adapter/oid/line.rb +1 -1
- data/lib/torque/postgresql/adapter/oid/lquery.rb +70 -0
- data/lib/torque/postgresql/adapter/oid/ltree.rb +111 -0
- data/lib/torque/postgresql/adapter/oid/segment.rb +1 -1
- data/lib/torque/postgresql/adapter/oid/struct.rb +150 -0
- data/lib/torque/postgresql/adapter/oid/struct_list.rb +52 -0
- data/lib/torque/postgresql/adapter/oid/struct_set.rb +38 -0
- data/lib/torque/postgresql/adapter/oid.rb +13 -0
- data/lib/torque/postgresql/adapter/quoting.rb +11 -2
- data/lib/torque/postgresql/adapter/schema_definitions.rb +51 -0
- data/lib/torque/postgresql/adapter/schema_dumper.rb +27 -0
- data/lib/torque/postgresql/adapter/schema_statements.rb +207 -0
- data/lib/torque/postgresql/adapter.rb +2 -5
- data/lib/torque/postgresql/arel/nodes.rb +114 -1
- data/lib/torque/postgresql/arel/visitors.rb +65 -8
- data/lib/torque/postgresql/associations/join_dependency.rb +55 -0
- data/lib/torque/postgresql/associations.rb +3 -0
- data/lib/torque/postgresql/attributes/base.rb +97 -0
- data/lib/torque/postgresql/attributes/composite.rb +98 -0
- data/lib/torque/postgresql/attributes/enum.rb +13 -7
- data/lib/torque/postgresql/attributes/lquery.rb +120 -0
- data/lib/torque/postgresql/attributes/ltree.rb +121 -0
- data/lib/torque/postgresql/attributes/simple_enum.rb +72 -0
- data/lib/torque/postgresql/attributes/struct.rb +137 -0
- data/lib/torque/postgresql/base.rb +26 -15
- data/lib/torque/postgresql/config.rb +100 -15
- data/lib/torque/postgresql/geometry_builder.rb +4 -10
- data/lib/torque/postgresql/inheritance/expander.rb +66 -0
- data/lib/torque/postgresql/inheritance/record.rb +52 -0
- data/lib/torque/postgresql/inheritance.rb +141 -68
- data/lib/torque/postgresql/migration/command_recorder.rb +76 -0
- data/lib/torque/postgresql/predicate_builder/arel_attribute_handler.rb +1 -1
- data/lib/torque/postgresql/predicate_builder/array_handler.rb +16 -8
- data/lib/torque/postgresql/predicate_builder/composite_handler.rb +122 -0
- data/lib/torque/postgresql/predicate_builder/ltree_handler.rb +112 -0
- data/lib/torque/postgresql/predicate_builder/struct_handler.rb +88 -0
- data/lib/torque/postgresql/predicate_builder.rb +53 -0
- data/lib/torque/postgresql/predicate_table.rb +61 -0
- data/lib/torque/postgresql/railtie.rb +52 -0
- data/lib/torque/postgresql/relation/auxiliary_statement.rb +7 -3
- data/lib/torque/postgresql/relation/buckets.rb +2 -1
- data/lib/torque/postgresql/relation/cross_join.rb +193 -0
- data/lib/torque/postgresql/relation/inheritance.rb +145 -28
- data/lib/torque/postgresql/relation/join_series.rb +1 -0
- data/lib/torque/postgresql/relation/merger.rb +30 -5
- data/lib/torque/postgresql/relation/segments.rb +140 -0
- data/lib/torque/postgresql/relation.rb +32 -12
- data/lib/torque/postgresql/schema_cache.rb +1 -0
- data/lib/torque/postgresql/validations.rb +29 -0
- data/lib/torque/postgresql/version.rb +1 -1
- data/lib/torque/postgresql/versioned_commands/command_migration.rb +24 -1
- data/lib/torque/postgresql/versioned_commands.rb +39 -0
- data/lib/torque/postgresql.rb +4 -0
- data/sig/generators/torque/function_generator.rbs +9 -0
- data/sig/generators/torque/skill_generator.rbs +7 -0
- data/sig/generators/torque/trigger_generator.rbs +9 -0
- data/sig/generators/torque/type_generator.rbs +9 -0
- data/sig/generators/torque/view_generator.rbs +9 -0
- data/sig/manifest.yaml +7 -0
- data/sig/torque/postgresql/adapter/database_statements.rbs +42 -0
- data/sig/torque/postgresql/adapter/inheritance_statements.rbs +36 -0
- data/sig/torque/postgresql/adapter/oid/array.rbs +20 -0
- data/sig/torque/postgresql/adapter/oid/box.rbs +28 -0
- data/sig/torque/postgresql/adapter/oid/circle.rbs +33 -0
- data/sig/torque/postgresql/adapter/oid/composite.rbs +35 -0
- data/sig/torque/postgresql/adapter/oid/enum.rbs +28 -0
- data/sig/torque/postgresql/adapter/oid/enum_set.rbs +19 -0
- data/sig/torque/postgresql/adapter/oid/interval.rbs +20 -0
- data/sig/torque/postgresql/adapter/oid/line.rbs +33 -0
- data/sig/torque/postgresql/adapter/oid/lquery.rbs +21 -0
- data/sig/torque/postgresql/adapter/oid/ltree.rbs +32 -0
- data/sig/torque/postgresql/adapter/oid/range.rbs +28 -0
- data/sig/torque/postgresql/adapter/oid/segment.rbs +38 -0
- data/sig/torque/postgresql/adapter/oid/struct.rbs +41 -0
- data/sig/torque/postgresql/adapter/oid/struct_list.rbs +20 -0
- data/sig/torque/postgresql/adapter/oid/struct_set.rbs +18 -0
- data/sig/torque/postgresql/adapter/oid.rbs +9 -0
- data/sig/torque/postgresql/adapter/quoting.rbs +20 -0
- data/sig/torque/postgresql/adapter/schema_creation.rbs +13 -0
- data/sig/torque/postgresql/adapter/schema_definitions.rbs +55 -0
- data/sig/torque/postgresql/adapter/schema_dumper.rbs +37 -0
- data/sig/torque/postgresql/adapter/schema_overrides.rbs +46 -0
- data/sig/torque/postgresql/adapter/schema_statements.rbs +50 -0
- data/sig/torque/postgresql/adapter.rbs +24 -0
- data/sig/torque/postgresql/arel/infix_operation.rbs +79 -0
- data/sig/torque/postgresql/arel/join_source.rbs +19 -0
- data/sig/torque/postgresql/arel/nodes.rbs +83 -0
- data/sig/torque/postgresql/arel/operations.rbs +28 -0
- data/sig/torque/postgresql/arel/select_manager.rbs +15 -0
- data/sig/torque/postgresql/arel/visitors.rbs +30 -0
- data/sig/torque/postgresql/arel.rbs +6 -0
- data/sig/torque/postgresql/associations/association_scope.rbs +28 -0
- data/sig/torque/postgresql/associations/belongs_to_many_association.rbs +51 -0
- data/sig/torque/postgresql/associations/builder/belongs_to_many.rbs +24 -0
- data/sig/torque/postgresql/associations/builder/has_many.rbs +15 -0
- data/sig/torque/postgresql/associations/builder.rbs +8 -0
- data/sig/torque/postgresql/associations/foreign_association.rbs +16 -0
- data/sig/torque/postgresql/associations/join_dependency.rbs +16 -0
- data/sig/torque/postgresql/associations/preloader/association.rbs +32 -0
- data/sig/torque/postgresql/associations/preloader/loader_query.rbs +20 -0
- data/sig/torque/postgresql/associations/preloader.rbs +8 -0
- data/sig/torque/postgresql/associations.rbs +17 -0
- data/sig/torque/postgresql/attributes/base.rbs +37 -0
- data/sig/torque/postgresql/attributes/builder/enum.rbs +38 -0
- data/sig/torque/postgresql/attributes/builder/full_text_search.rbs +27 -0
- data/sig/torque/postgresql/attributes/builder/period.rbs +106 -0
- data/sig/torque/postgresql/attributes/builder.rbs +19 -0
- data/sig/torque/postgresql/attributes/composite.rbs +28 -0
- data/sig/torque/postgresql/attributes/enum.rbs +69 -0
- data/sig/torque/postgresql/attributes/enum_set.rbs +75 -0
- data/sig/torque/postgresql/attributes/full_text_search.rbs +13 -0
- data/sig/torque/postgresql/attributes/lazy.rbs +17 -0
- data/sig/torque/postgresql/attributes/lquery.rbs +48 -0
- data/sig/torque/postgresql/attributes/ltree.rbs +46 -0
- data/sig/torque/postgresql/attributes/period.rbs +13 -0
- data/sig/torque/postgresql/attributes/simple_enum.rbs +39 -0
- data/sig/torque/postgresql/attributes/struct.rbs +38 -0
- data/sig/torque/postgresql/attributes.rbs +6 -0
- data/sig/torque/postgresql/autosave_association.rbs +16 -0
- data/sig/torque/postgresql/auxiliary_statement/recursive.rbs +22 -0
- data/sig/torque/postgresql/auxiliary_statement/settings.rbs +63 -0
- data/sig/torque/postgresql/auxiliary_statement.rbs +57 -0
- data/sig/torque/postgresql/base.rbs +41 -0
- data/sig/torque/postgresql/collector.rbs +7 -0
- data/sig/torque/postgresql/config.rbs +9 -0
- data/sig/torque/postgresql/function.rbs +21 -0
- data/sig/torque/postgresql/geometry_builder.rbs +20 -0
- data/sig/torque/postgresql/i18n.rbs +15 -0
- data/sig/torque/postgresql/inheritance/expander.rbs +23 -0
- data/sig/torque/postgresql/inheritance/record.rbs +20 -0
- data/sig/torque/postgresql/inheritance.rbs +47 -0
- data/sig/torque/postgresql/insert_all.rbs +22 -0
- data/sig/torque/postgresql/migration/command_recorder.rbs +30 -0
- data/sig/torque/postgresql/migration.rbs +6 -0
- data/sig/torque/postgresql/predicate_builder/arel_attribute_handler.rbs +15 -0
- data/sig/torque/postgresql/predicate_builder/array_handler.rbs +26 -0
- data/sig/torque/postgresql/predicate_builder/composite_handler.rbs +26 -0
- data/sig/torque/postgresql/predicate_builder/enumerator_lazy_handler.rbs +18 -0
- data/sig/torque/postgresql/predicate_builder/ltree_handler.rbs +36 -0
- data/sig/torque/postgresql/predicate_builder/regexp_handler.rbs +16 -0
- data/sig/torque/postgresql/predicate_builder/struct_handler.rbs +24 -0
- data/sig/torque/postgresql/predicate_builder.rbs +23 -0
- data/sig/torque/postgresql/predicate_table.rbs +24 -0
- data/sig/torque/postgresql/railtie.rbs +10 -0
- data/sig/torque/postgresql/reflection/abstract_reflection.rbs +22 -0
- data/sig/torque/postgresql/reflection/association_reflection.rbs +18 -0
- data/sig/torque/postgresql/reflection/belongs_to_many_reflection.rbs +30 -0
- data/sig/torque/postgresql/reflection/has_many_reflection.rbs +14 -0
- data/sig/torque/postgresql/reflection/runtime_reflection.rbs +18 -0
- data/sig/torque/postgresql/reflection/through_reflection.rbs +14 -0
- data/sig/torque/postgresql/reflection.rbs +11 -0
- data/sig/torque/postgresql/relation/auxiliary_statement.rbs +29 -0
- data/sig/torque/postgresql/relation/buckets.rbs +35 -0
- data/sig/torque/postgresql/relation/cross_join.rbs +63 -0
- data/sig/torque/postgresql/relation/distinct_on.rbs +16 -0
- data/sig/torque/postgresql/relation/inheritance.rbs +48 -0
- data/sig/torque/postgresql/relation/join_series.rbs +28 -0
- data/sig/torque/postgresql/relation/merger.rbs +23 -0
- data/sig/torque/postgresql/relation/segments.rbs +27 -0
- data/sig/torque/postgresql/relation.rbs +48 -0
- data/sig/torque/postgresql/schema_cache/bound_schema_reflection.rbs +14 -0
- data/sig/torque/postgresql/schema_cache/inheritance.rbs +12 -0
- data/sig/torque/postgresql/schema_cache/schema_reflection.rbs +14 -0
- data/sig/torque/postgresql/schema_cache.rbs +43 -0
- data/sig/torque/postgresql/table_name.rbs +20 -0
- data/sig/torque/postgresql/validations.rbs +13 -0
- data/sig/torque/postgresql/version.rbs +5 -0
- data/sig/torque/postgresql/versioned_commands/command_migration.rbs +54 -0
- data/sig/torque/postgresql/versioned_commands/generator.rbs +17 -0
- data/sig/torque/postgresql/versioned_commands/migration_context.rbs +30 -0
- data/sig/torque/postgresql/versioned_commands/migrator.rbs +19 -0
- data/sig/torque/postgresql/versioned_commands/schema_table.rbs +23 -0
- data/sig/torque/postgresql/versioned_commands.rbs +25 -0
- data/sig/torque/postgresql.rbs +26 -0
- data/skills/torque-postgresql/SKILL.md +70 -0
- data/spec/fixtures/migrations/20250101000008_create_trigger_audit_users_v1.sql +3 -0
- data/spec/initialize.rb +29 -2
- data/spec/mocks/cache_query.rb +13 -1
- data/spec/models/author.rb +1 -1
- data/spec/models/comment.rb +2 -0
- data/spec/models/place.rb +2 -0
- data/spec/models/profile.rb +31 -0
- data/spec/rbs_helper.rb +8 -0
- data/spec/schema.rb +35 -4
- data/spec/spec_helper.rb +1 -0
- data/spec/tests/arel_spec.rb +3 -3
- data/spec/tests/auxiliary_statement_spec.rb +12 -0
- data/spec/tests/buckets_spec.rb +122 -0
- data/spec/tests/composite_spec.rb +867 -0
- data/spec/tests/cross_join_spec.rb +185 -0
- data/spec/tests/distinct_on_spec.rb +5 -0
- data/spec/tests/enum_set_spec.rb +4 -0
- data/spec/tests/enum_spec.rb +20 -4
- data/spec/tests/geometric_builder_spec.rb +16 -5
- data/spec/tests/has_many_spec.rb +2 -1
- data/spec/tests/interval_spec.rb +6 -0
- data/spec/tests/ltree_spec.rb +886 -0
- data/spec/tests/predicate_builder_spec.rb +120 -0
- data/spec/tests/relation_spec.rb +25 -69
- data/spec/tests/segments_spec.rb +264 -0
- data/spec/tests/struct_spec.rb +1170 -0
- data/spec/tests/table_inheritance_spec.rb +1037 -56
- data/spec/tests/versioned_commands_spec.rb +145 -0
- metadata +198 -2
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
type search_columns = column_ref | Array[column_ref] | Hash[column_ref, String]
|
|
5
|
+
type column_options = { ?limit: Integer, ?precision: Integer, ?scale: Integer, ?array: bool, ?null: bool, ?default: untyped, ?enum_type: table_ref, ?composite_type: table_ref, ?comment: String }
|
|
6
|
+
|
|
7
|
+
module ColumnMethods
|
|
8
|
+
def search_language: (*column_ref names, **untyped options) -> Array[column_ref]
|
|
9
|
+
def search_vector: (*column_ref names, columns: search_columns, **untyped options) -> Array[column_ref]
|
|
10
|
+
def composite: (*column_ref names, composite_type: table_ref, **untyped options) -> Array[column_ref]
|
|
11
|
+
def ltree: (*column_ref names, **untyped options) -> Array[column_ref]
|
|
12
|
+
def lquery: (*column_ref names, **untyped options) -> Array[column_ref]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
module TableDefinition
|
|
16
|
+
include ColumnMethods
|
|
17
|
+
|
|
18
|
+
attr_reader inherits: Array[table_ref]?
|
|
19
|
+
|
|
20
|
+
def initialize: (*untyped args, **untyped options) -> void
|
|
21
|
+
def set_primary_key: (table_ref tn, untyped id, untyped primary_key, *untyped, **untyped) -> untyped
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def create_column_definition: (column_ref name, Symbol | String type, Hash[Symbol, untyped]? options) -> untyped
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class CompositeTypeDefinition < ActiveRecord::ConnectionAdapters::PostgreSQL::TableDefinition
|
|
29
|
+
attr_reader changes: Array[untyped]
|
|
30
|
+
attr_reader removals: Array[String]
|
|
31
|
+
attr_reader renames: Array[[String, String]]
|
|
32
|
+
|
|
33
|
+
def initialize: (*untyped args, **untyped xargs) -> void
|
|
34
|
+
def change: (column_ref name, Symbol | String type, **untyped options) -> Array[untyped]
|
|
35
|
+
def remove: (*column_ref names) -> Array[String]
|
|
36
|
+
def rename: (column_ref name, column_ref new_name) -> Array[[String, String]]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
module Definition
|
|
40
|
+
def create_function: (String name, version: Integer, ?dir: String | Array[String]) -> untyped
|
|
41
|
+
def create_type: (String name, version: Integer, ?dir: String | Array[String]) -> untyped
|
|
42
|
+
def create_view: (String name, version: Integer, ?dir: String | Array[String]) -> untyped
|
|
43
|
+
def create_trigger: (String name, version: Integer, ?dir: String | Array[String]) -> untyped
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class ActiveRecord::ConnectionAdapters::PostgreSQL::Table
|
|
50
|
+
include Torque::PostgreSQL::Adapter::ColumnMethods
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
class ActiveRecord::ConnectionAdapters::PostgreSQL::TableDefinition
|
|
54
|
+
include Torque::PostgreSQL::Adapter::TableDefinition
|
|
55
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module SchemaDumper
|
|
5
|
+
SEARCH_VECTOR_SCANNER: Regexp
|
|
6
|
+
|
|
7
|
+
@versioned_commands: VersionedCommands::SchemaTable
|
|
8
|
+
|
|
9
|
+
def initialize: (*untyped) -> void
|
|
10
|
+
def dump: (stream stream) -> stream
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def types: (stream stream) -> untyped
|
|
15
|
+
def composite_types: (stream stream) -> untyped
|
|
16
|
+
def tables: (stream stream) -> untyped
|
|
17
|
+
def around_tables: (stream stream) { () -> void } -> untyped
|
|
18
|
+
def dump_tables: (stream stream) -> untyped
|
|
19
|
+
def remove_prefix_and_suffix: (String table) -> String
|
|
20
|
+
def schemas: (stream stream) -> untyped
|
|
21
|
+
def schema_type_with_virtual: (column column) -> Symbol
|
|
22
|
+
def schema_type: (column column) -> Symbol
|
|
23
|
+
def prepare_column_options: (column column) -> Hash[Symbol, untyped]
|
|
24
|
+
def parse_search_vector_options: (column column, Hash[Symbol, untyped] options) -> Hash[Symbol, untyped]?
|
|
25
|
+
def parse_search_vector_columns: (Array[Array[String?]] settings) -> (String | Hash[String, String])
|
|
26
|
+
def versioned_commands: (stream stream, Symbol type, ?bool add_newline) -> untyped
|
|
27
|
+
def list_existing_versioned_commands: (Symbol type) -> Set[String]
|
|
28
|
+
def with_versioned_commands?: () -> bool
|
|
29
|
+
def fx_functions_position: () -> Symbol?
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaDumper
|
|
36
|
+
prepend Torque::PostgreSQL::Adapter::SchemaDumper
|
|
37
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module SchemaOverrides
|
|
5
|
+
def quote_table_name: (table_ref name) -> String
|
|
6
|
+
def table_exists?: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
7
|
+
def indexes: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
8
|
+
def index_exists?: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
9
|
+
def columns: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
10
|
+
def column_exists?: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
11
|
+
def primary_key: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
12
|
+
def create_table: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
13
|
+
def change_table: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
14
|
+
def add_column: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
15
|
+
def add_columns: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
16
|
+
def remove_columns: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
17
|
+
def remove_column: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
18
|
+
def change_column: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
19
|
+
def change_column_default: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
20
|
+
def change_column_null: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
21
|
+
def rename_column: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
22
|
+
def add_index: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
23
|
+
def remove_index: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
24
|
+
def rename_index: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
25
|
+
def index_name_exists?: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
26
|
+
def foreign_keys: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
27
|
+
def add_timestamps: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
28
|
+
def remove_timestamps: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
29
|
+
def change_table_comment: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
30
|
+
def change_column_comment: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
31
|
+
def bulk_change_table: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
32
|
+
def rename_table: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
33
|
+
def add_foreign_key: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
34
|
+
def remove_foreign_key: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
35
|
+
def foreign_key_exists?: (table_ref table_name, *untyped args, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
36
|
+
def drop_table: (*table_ref table_names, **untyped options) -> untyped
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def validate_table_length!: (table_ref table_name) -> untyped
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
include SchemaOverrides
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module SchemaStatements
|
|
5
|
+
type schema_options = { ?schema: table_ref }
|
|
6
|
+
type drop_options = { ?force: Symbol | String | nil, ?check: bool, ?schema: table_ref? }
|
|
7
|
+
type create_type_options = { ?force: Symbol | bool | nil, ?schema: table_ref }
|
|
8
|
+
type composite_column_options = { ?schema: table_ref, ?limit: Integer, ?precision: Integer, ?scale: Integer, ?array: bool, ?enum_type: table_ref, ?composite_type: table_ref }
|
|
9
|
+
type search_vector_options = { ?language: String | Symbol, ?stored: bool, ?index: bool | Hash[Symbol, untyped] }
|
|
10
|
+
type enum_values_options = { ?before: String | Symbol | false, ?after: String | Symbol | false, ?prepend: bool, ?prefix: String | bool, ?suffix: String | bool, ?schema: table_ref }
|
|
11
|
+
|
|
12
|
+
def drop_type: (table_ref name, ?drop_options options) -> untyped
|
|
13
|
+
def rename_type: (table_ref type_name, table_ref new_name, ?schema_options options) -> untyped
|
|
14
|
+
def create_composite_type: (table_ref name, ?create_type_options options) ?{ (CompositeTypeDefinition td) -> void } -> untyped
|
|
15
|
+
def change_composite_type: (table_ref name, ?schema_options options) { (CompositeTypeDefinition td) -> void } -> untyped
|
|
16
|
+
def add_composite_column: (table_ref type_name, column_ref column_name, Symbol | String type, ?composite_column_options options) -> untyped
|
|
17
|
+
def remove_composite_column: (table_ref type_name, column_ref column_name, ?Symbol | String | nil type, ?schema_options options) -> untyped
|
|
18
|
+
def change_composite_column: (table_ref type_name, column_ref column_name, Symbol | String type, ?composite_column_options options) -> untyped
|
|
19
|
+
def rename_composite_column: (table_ref type_name, column_ref column_name, column_ref new_name, ?schema_options options) -> untyped
|
|
20
|
+
def add_search_language: (table_ref table, column_ref name, ?Hash[Symbol, untyped] options) -> untyped
|
|
21
|
+
def add_search_vector: (table_ref table, column_ref name, search_columns columns, ?search_vector_options options) -> untyped
|
|
22
|
+
def add_enum_values: (table_ref name, Array[String | Symbol] values, ?enum_values_options options) -> Array[String]
|
|
23
|
+
def enum_values: (table_ref name) -> Array[String]
|
|
24
|
+
def create_table: (table_ref table_name, ?sync: bool | Hash[Symbol, bool], ?inherits: table_ref | Array[table_ref], ?schema: table_ref, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
25
|
+
def primary_key: (table_ref table_name) -> (String | Array[String] | nil)
|
|
26
|
+
def table_options: (table_ref table_name) -> Hash[Symbol, untyped]
|
|
27
|
+
def quoted_scope: (?table_ref? name, ?type: String?) -> Hash[Symbol, String]
|
|
28
|
+
def data_source_sql: (?table_ref? name, ?type: String?) -> String
|
|
29
|
+
def valid_table_definition_options: () -> Array[Symbol]
|
|
30
|
+
def valid_column_definition_options: () -> Array[Symbol]
|
|
31
|
+
def type_to_sql: (Symbol | String type, ?composite_type: table_ref?, **untyped options) -> untyped
|
|
32
|
+
def assume_migrated_upto_version: (Integer | String version) -> untyped
|
|
33
|
+
def insert_versions_sql: (Array[Integer] versions) -> String
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
def sequence_name_from_parts: (String table_name, column_ref column_name, String suffix) -> String
|
|
38
|
+
def sanitize_name_with_schema: (table_ref name, Hash[Symbol, untyped]? options) -> table_ref
|
|
39
|
+
def create_composite_type_definition: (table_ref name) -> CompositeTypeDefinition
|
|
40
|
+
def alter_composite_type: (table_ref name, table_ref? schema, Array[String] actions) -> untyped
|
|
41
|
+
def composite_type_actions: (table_ref name, CompositeTypeDefinition td) -> Array[String]
|
|
42
|
+
def validate_composite_type!: (table_ref name, CompositeTypeDefinition td) -> nil
|
|
43
|
+
def composite_column_definition: (table_ref name, untyped column) -> String
|
|
44
|
+
def composite_column_type: (table_ref name, untyped column) -> untyped
|
|
45
|
+
def reset_composite_type: (table_ref name) -> untyped
|
|
46
|
+
def quote_enum_values: (table_ref name, Array[String | Symbol] values, enum_values_options options) -> Array[String]
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
include Quoting
|
|
5
|
+
include DatabaseStatements
|
|
6
|
+
include InheritanceStatements
|
|
7
|
+
include SchemaStatements
|
|
8
|
+
|
|
9
|
+
@version: Gem::Version
|
|
10
|
+
|
|
11
|
+
class DeduplicatableArray < ::Array[untyped]
|
|
12
|
+
def deduplicate: () -> Array[untyped]
|
|
13
|
+
alias -@ deduplicate
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def version: () -> Gem::Version
|
|
17
|
+
def build_insert_sql: (ActiveRecord::InsertAll::Builder insert) -> String
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
|
|
23
|
+
prepend Torque::PostgreSQL::Adapter
|
|
24
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Arel
|
|
4
|
+
module Math
|
|
5
|
+
def contained_by: (untyped other) -> ::Arel::Nodes::ContainedBy
|
|
6
|
+
def has_key: (untyped other) -> ::Arel::Nodes::HasKey
|
|
7
|
+
def has_all_keys: (untyped other) -> ::Arel::Nodes::HasAllKeys
|
|
8
|
+
def has_any_keys: (untyped other) -> ::Arel::Nodes::HasAnyKeys
|
|
9
|
+
def strictly_left: (untyped other) -> ::Arel::Nodes::StrictlyLeft
|
|
10
|
+
def strictly_right: (untyped other) -> ::Arel::Nodes::StrictlyRight
|
|
11
|
+
def doesnt_right_extend: (untyped other) -> ::Arel::Nodes::DoesntRightExtend
|
|
12
|
+
def doesnt_left_extend: (untyped other) -> ::Arel::Nodes::DoesntLeftExtend
|
|
13
|
+
def adjacent_to: (untyped other) -> ::Arel::Nodes::AdjacentTo
|
|
14
|
+
def matches_lquery: (untyped other) -> ::Arel::Nodes::MatchesLquery
|
|
15
|
+
def matches_any_lquery: (untyped other) -> ::Arel::Nodes::MatchesAnyLquery
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.build_operations: (Hash[Symbol | String, String]? operations) -> Hash[Symbol | String, String]?
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
module Arel
|
|
24
|
+
module Nodes
|
|
25
|
+
class ContainedBy < InfixOperation
|
|
26
|
+
def initialize: (untyped left, untyped right) -> void
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class HasKey < InfixOperation
|
|
30
|
+
def initialize: (untyped left, untyped right) -> void
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class HasAllKeys < InfixOperation
|
|
34
|
+
def initialize: (untyped left, untyped right) -> void
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class HasAnyKeys < InfixOperation
|
|
38
|
+
def initialize: (untyped left, untyped right) -> void
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class StrictlyLeft < InfixOperation
|
|
42
|
+
def initialize: (untyped left, untyped right) -> void
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class StrictlyRight < InfixOperation
|
|
46
|
+
def initialize: (untyped left, untyped right) -> void
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class DoesntRightExtend < InfixOperation
|
|
50
|
+
def initialize: (untyped left, untyped right) -> void
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
class DoesntLeftExtend < InfixOperation
|
|
54
|
+
def initialize: (untyped left, untyped right) -> void
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
class AdjacentTo < InfixOperation
|
|
58
|
+
def initialize: (untyped left, untyped right) -> void
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class MatchesLquery < InfixOperation
|
|
62
|
+
def initialize: (untyped left, untyped right) -> void
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
class MatchesAnyLquery < InfixOperation
|
|
66
|
+
def initialize: (untyped left, untyped right) -> void
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
class Node
|
|
70
|
+
include Torque::PostgreSQL::Arel::Math
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
module Attributes
|
|
75
|
+
class Attribute
|
|
76
|
+
include Torque::PostgreSQL::Arel::Math
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Arel
|
|
4
|
+
module JoinSource
|
|
5
|
+
attr_accessor only: bool?
|
|
6
|
+
|
|
7
|
+
def only?: () -> bool
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
module Arel
|
|
14
|
+
module Nodes
|
|
15
|
+
class JoinSource
|
|
16
|
+
include Torque::PostgreSQL::Arel::JoinSource
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Arel
|
|
4
|
+
module Nodes
|
|
5
|
+
class Cast < ::Arel::Nodes::Binary
|
|
6
|
+
include ::Arel::Expressions
|
|
7
|
+
include ::Arel::Predications
|
|
8
|
+
include ::Arel::AliasPredication
|
|
9
|
+
include ::Arel::OrderPredications
|
|
10
|
+
include ::Arel::Math
|
|
11
|
+
|
|
12
|
+
def initialize: (arel_node left, column_ref right, ?bool | Symbol array) -> void
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class Column < ::Arel::Nodes::Binary
|
|
16
|
+
include ::Arel::Expressions
|
|
17
|
+
include ::Arel::Predications
|
|
18
|
+
include ::Arel::AliasPredication
|
|
19
|
+
include ::Arel::OrderPredications
|
|
20
|
+
include ::Arel::Math
|
|
21
|
+
|
|
22
|
+
attr_reader type_caster: type_caster?
|
|
23
|
+
alias name right
|
|
24
|
+
|
|
25
|
+
def initialize: (arel_node source, column_ref name, type_caster? type_caster) -> void
|
|
26
|
+
def able_to_type_cast?: () -> true
|
|
27
|
+
def type_cast_for_database: (untyped value) -> untyped
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class Property < ::Arel::Nodes::Binary
|
|
31
|
+
include ::Arel::Expressions
|
|
32
|
+
include ::Arel::Predications
|
|
33
|
+
include ::Arel::AliasPredication
|
|
34
|
+
include ::Arel::OrderPredications
|
|
35
|
+
include ::Arel::Math
|
|
36
|
+
|
|
37
|
+
attr_reader type_caster: type_caster?
|
|
38
|
+
attr_reader cast: column_ref?
|
|
39
|
+
alias path right
|
|
40
|
+
|
|
41
|
+
def initialize: (arel_node source, path_key key, type_caster? type_caster, ?column_ref? cast) -> void
|
|
42
|
+
def name: () -> String
|
|
43
|
+
def able_to_type_cast?: () -> true
|
|
44
|
+
def type_cast_for_database: (untyped value) -> untyped
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class CrossJoin < ::Arel::Nodes::Join
|
|
48
|
+
def initialize: (arel_node left, ?arel_node? right) -> void
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class FromItem < ::Arel::Nodes::Binary
|
|
52
|
+
attr_reader columns: Array[column_ref]?
|
|
53
|
+
attr_reader definitions: Hash[column_ref, String?]?
|
|
54
|
+
attr_reader ordinality: String?
|
|
55
|
+
attr_reader lateral: bool
|
|
56
|
+
alias name right
|
|
57
|
+
|
|
58
|
+
def initialize: (arel_node source, column_ref name, ?columns: Array[column_ref] | column_ref | nil, ?definitions: Hash[column_ref, String?]?, ?ordinality: column_ref?, ?lateral: bool) -> void
|
|
59
|
+
def rows_from?: () -> bool
|
|
60
|
+
def alias_columns: () -> Hash[column_ref, String?]
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
class Ref < ::Arel::Nodes::Unary
|
|
64
|
+
attr_reader reference: arel_node?
|
|
65
|
+
alias to_s expr
|
|
66
|
+
|
|
67
|
+
def initialize: (String | arel_node expr, ?arel_node? reference) -> void
|
|
68
|
+
def as: (column_ref other) -> ::Arel::Nodes::As
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
module Arel
|
|
76
|
+
def self.array: (*untyped values, ?cast: Torque::PostgreSQL::column_ref?) -> (::Arel::Nodes::Quoted | Torque::PostgreSQL::Arel::Nodes::Cast)
|
|
77
|
+
|
|
78
|
+
module Nodes
|
|
79
|
+
class Function
|
|
80
|
+
include ::Arel::Math
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Arel
|
|
4
|
+
module Operations
|
|
5
|
+
def pg_cast: (column_ref type, ?bool | Symbol array) -> Nodes::Cast
|
|
6
|
+
def cast: (column_ref type, ?bool | Symbol array) -> untyped
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module Arel
|
|
13
|
+
module Attributes
|
|
14
|
+
class Attribute
|
|
15
|
+
include Torque::PostgreSQL::Arel::Operations
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
module Nodes
|
|
20
|
+
class SqlLiteral
|
|
21
|
+
include Torque::PostgreSQL::Arel::Operations
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class Node
|
|
25
|
+
include Torque::PostgreSQL::Arel::Operations
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Arel
|
|
4
|
+
module Visitors
|
|
5
|
+
def visit_Arel_Nodes_JoinSource: (::Arel::Nodes::JoinSource o, collector collector) -> collector
|
|
6
|
+
def visit_Arel_Nodes_Quoted: (::Arel::Nodes::Quoted o, collector collector) -> collector
|
|
7
|
+
def visit_Torque_PostgreSQL_Arel_Nodes_Ref: (Nodes::Ref o, collector collector) -> collector
|
|
8
|
+
def visit_Torque_PostgreSQL_Arel_Nodes_Column: (Nodes::Column o, collector collector) -> collector
|
|
9
|
+
def visit_Torque_PostgreSQL_Arel_Nodes_Property: (Nodes::Property o, collector collector) -> collector
|
|
10
|
+
def visit_Torque_PostgreSQL_Arel_Nodes_CrossJoin: (Nodes::CrossJoin o, collector collector) -> collector
|
|
11
|
+
def visit_Torque_PostgreSQL_Arel_Nodes_FromItem: (Nodes::FromItem o, collector collector) -> collector
|
|
12
|
+
def visit_Torque_PostgreSQL_Arel_Nodes_Cast: (Nodes::Cast o, collector collector) -> collector
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def visit_definitions: (Hash[column_ref, String?] definitions, collector collector) -> collector
|
|
17
|
+
def visit_alias_columns: (Hash[column_ref, String?] columns, collector collector) -> collector
|
|
18
|
+
def quote_array: (Enumerable[untyped] value, collector collector) -> collector
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
module Arel
|
|
25
|
+
module Visitors
|
|
26
|
+
class PostgreSQL
|
|
27
|
+
prepend Torque::PostgreSQL::Arel::Visitors
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Associations
|
|
4
|
+
module AssociationScope
|
|
5
|
+
class PredicateBuilderArray
|
|
6
|
+
include PredicateBuilder::ArrayHandler
|
|
7
|
+
|
|
8
|
+
def call_with_empty: (arel_node attribute) -> String
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
module ClassMethods
|
|
12
|
+
def get_bind_values: (*untyped) -> Array[untyped]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def last_chain_scope: (relation scope, any_reflection reflection, record owner) -> relation
|
|
18
|
+
def next_chain_scope: (relation scope, any_reflection reflection, any_reflection next_reflection) -> relation
|
|
19
|
+
def transform_value: (untyped value) -> untyped
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class ActiveRecord::Associations::AssociationScope
|
|
26
|
+
extend Torque::PostgreSQL::Associations::AssociationScope::ClassMethods
|
|
27
|
+
prepend Torque::PostgreSQL::Associations::AssociationScope
|
|
28
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Associations
|
|
4
|
+
class BelongsToManyAssociation < ::ActiveRecord::Associations::CollectionAssociation
|
|
5
|
+
include ::ActiveRecord::Associations::ForeignAssociation
|
|
6
|
+
|
|
7
|
+
type ids = Array[untyped]
|
|
8
|
+
|
|
9
|
+
@_building_changes: bool?
|
|
10
|
+
@_was_loaded: bool
|
|
11
|
+
|
|
12
|
+
def ids_reader: () -> ids
|
|
13
|
+
def ids_writer: (ids? ids) -> untyped
|
|
14
|
+
def size: () -> Integer
|
|
15
|
+
def empty?: () -> bool
|
|
16
|
+
def include?: (record record) -> untyped
|
|
17
|
+
def load_target: () -> Array[record]
|
|
18
|
+
def build_changes: (?bool from_target) { () -> untyped } -> untyped
|
|
19
|
+
def trigger: (Symbol prefix, ids before_ids, ids after_ids) -> untyped
|
|
20
|
+
def handle_dependency: () -> untyped
|
|
21
|
+
def insert_record: (record record, *untyped) ?{ (?) -> untyped } -> bool
|
|
22
|
+
def default: () { (?) -> untyped } -> untyped
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def _create_record: (Hash[untyped, untyped] | Array[Hash[untyped, untyped]] attributes, ?bool raises) ?{ (record) -> void } -> (record | Array[record])
|
|
27
|
+
def delete_count: (Symbol? method, relation scope, ids ids) -> Integer
|
|
28
|
+
def delete_or_nullify_all_records: (Symbol? method) -> Integer
|
|
29
|
+
def delete_records: (Array[record] records, Symbol? method) -> untyped
|
|
30
|
+
def source_attr: () -> String
|
|
31
|
+
def klass_attr: () -> String
|
|
32
|
+
def read_records_ids: (Array[record] | record | nil records) -> ids?
|
|
33
|
+
def ids_rewriter: (untyped ids, Symbol operator) -> untyped
|
|
34
|
+
def column_default_value: () -> untyped
|
|
35
|
+
def callback: (*untyped) -> true
|
|
36
|
+
def replace_records: (*untyped) -> untyped
|
|
37
|
+
def concat_records: (*untyped) -> untyped
|
|
38
|
+
def delete_or_destroy: (*untyped) -> untyped
|
|
39
|
+
def difference: (Array[untyped] a, Array[untyped] b) -> Array[untyped]
|
|
40
|
+
def intersection: (Array[untyped] a, Array[untyped] b) -> Array[untyped]
|
|
41
|
+
def scope_for_create: () -> Hash[String, untyped]
|
|
42
|
+
def find_target?: () -> untyped
|
|
43
|
+
def foreign_key_present?: () -> bool
|
|
44
|
+
def invertible_for?: (record record) -> untyped
|
|
45
|
+
def stale_state: () -> ids?
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class ActiveRecord::Associations::BelongsToManyAssociation = Torque::PostgreSQL::Associations::BelongsToManyAssociation
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Associations
|
|
4
|
+
module Builder
|
|
5
|
+
class BelongsToMany < ::ActiveRecord::Associations::Builder::CollectionAssociation
|
|
6
|
+
def self.macro: () -> :belongs_to_many
|
|
7
|
+
def self.valid_options: (Hash[Symbol, untyped] options) -> Array[Symbol]
|
|
8
|
+
def self.valid_dependent_options: () -> Array[Symbol]
|
|
9
|
+
def self.define_callbacks: (model model, Reflection::BelongsToManyReflection reflection) -> untyped
|
|
10
|
+
def self.define_readers: (Module mixin, Symbol name) -> untyped
|
|
11
|
+
def self.define_writers: (Module mixin, Symbol name) -> untyped
|
|
12
|
+
def self.add_default_callbacks: (model model, Reflection::BelongsToManyReflection reflection) -> untyped
|
|
13
|
+
def self.add_touch_callbacks: (model model, Reflection::BelongsToManyReflection reflection) -> untyped
|
|
14
|
+
def self.touch_record: (record o, Hash[String, untyped] changes, String foreign_key, Symbol name, bool | Symbol touch, Symbol touch_method) -> untyped
|
|
15
|
+
def self.add_change_callbacks: (model model, Reflection::BelongsToManyReflection reflection) -> untyped
|
|
16
|
+
def self.add_destroy_callbacks: (model model, Reflection::BelongsToManyReflection reflection) -> untyped
|
|
17
|
+
def self.define_validations: (model model, Reflection::BelongsToManyReflection reflection) -> untyped
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class ActiveRecord::Associations::Builder::BelongsToMany = Torque::PostgreSQL::Associations::Builder::BelongsToMany
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Associations
|
|
4
|
+
module Builder
|
|
5
|
+
module HasMany
|
|
6
|
+
def valid_options: (Hash[Symbol, untyped] options) -> Array[Symbol]
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class ActiveRecord::Associations::Builder::HasMany
|
|
14
|
+
extend Torque::PostgreSQL::Associations::Builder::HasMany
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Associations
|
|
4
|
+
module ForeignAssociation
|
|
5
|
+
@inversed: bool
|
|
6
|
+
|
|
7
|
+
def inversed_from: (record record) -> untyped
|
|
8
|
+
def skip_statement_cache?: (*untyped) -> untyped
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def set_owner_attributes: (record record) -> untyped
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Associations
|
|
4
|
+
module JoinDependency
|
|
5
|
+
def apply_column_aliases: (relation relation) -> untyped
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def cast_join_root?: (relation relation) -> bool
|
|
10
|
+
def root_record_class_marker: () -> ::Arel::Nodes::As
|
|
11
|
+
def joined_record_class_markers: () -> Array[::Arel::Nodes::As]
|
|
12
|
+
def record_class_column_name: () -> String
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|