sequel 4.30.0 → 4.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +18 -0
- data/MIT-LICENSE +1 -1
- data/bin/sequel +1 -0
- data/doc/opening_databases.rdoc +6 -0
- data/doc/release_notes/4.31.0.txt +57 -0
- data/lib/sequel.rb +2 -0
- data/lib/sequel/adapters/ado.rb +2 -0
- data/lib/sequel/adapters/ado/access.rb +2 -0
- data/lib/sequel/adapters/ado/mssql.rb +2 -0
- data/lib/sequel/adapters/amalgalite.rb +2 -0
- data/lib/sequel/adapters/cubrid.rb +2 -0
- data/lib/sequel/adapters/do.rb +2 -0
- data/lib/sequel/adapters/do/mysql.rb +2 -0
- data/lib/sequel/adapters/do/postgres.rb +2 -0
- data/lib/sequel/adapters/do/sqlite3.rb +2 -0
- data/lib/sequel/adapters/ibmdb.rb +3 -1
- data/lib/sequel/adapters/jdbc.rb +2 -0
- data/lib/sequel/adapters/jdbc/as400.rb +2 -0
- data/lib/sequel/adapters/jdbc/cubrid.rb +2 -0
- data/lib/sequel/adapters/jdbc/db2.rb +2 -0
- data/lib/sequel/adapters/jdbc/derby.rb +2 -0
- data/lib/sequel/adapters/jdbc/firebirdsql.rb +2 -0
- data/lib/sequel/adapters/jdbc/h2.rb +2 -0
- data/lib/sequel/adapters/jdbc/hsqldb.rb +2 -0
- data/lib/sequel/adapters/jdbc/informix-sqli.rb +2 -0
- data/lib/sequel/adapters/jdbc/jdbcprogress.rb +2 -0
- data/lib/sequel/adapters/jdbc/jtds.rb +2 -0
- data/lib/sequel/adapters/jdbc/mssql.rb +2 -0
- data/lib/sequel/adapters/jdbc/mysql.rb +2 -0
- data/lib/sequel/adapters/jdbc/oracle.rb +2 -0
- data/lib/sequel/adapters/jdbc/postgresql.rb +24 -1
- data/lib/sequel/adapters/jdbc/sqlanywhere.rb +2 -0
- data/lib/sequel/adapters/jdbc/sqlite.rb +2 -0
- data/lib/sequel/adapters/jdbc/sqlserver.rb +2 -0
- data/lib/sequel/adapters/jdbc/transactions.rb +2 -0
- data/lib/sequel/adapters/mock.rb +2 -0
- data/lib/sequel/adapters/mysql.rb +2 -0
- data/lib/sequel/adapters/mysql2.rb +2 -0
- data/lib/sequel/adapters/odbc.rb +2 -0
- data/lib/sequel/adapters/odbc/db2.rb +2 -0
- data/lib/sequel/adapters/odbc/mssql.rb +2 -0
- data/lib/sequel/adapters/odbc/progress.rb +2 -0
- data/lib/sequel/adapters/oracle.rb +4 -2
- data/lib/sequel/adapters/postgres.rb +5 -3
- data/lib/sequel/adapters/postgresql.rb +2 -0
- data/lib/sequel/adapters/shared/access.rb +2 -0
- data/lib/sequel/adapters/shared/cubrid.rb +2 -0
- data/lib/sequel/adapters/shared/db2.rb +2 -0
- data/lib/sequel/adapters/shared/firebird.rb +2 -0
- data/lib/sequel/adapters/shared/informix.rb +2 -0
- data/lib/sequel/adapters/shared/mssql.rb +2 -0
- data/lib/sequel/adapters/shared/mysql.rb +5 -1
- data/lib/sequel/adapters/shared/mysql_prepared_statements.rb +2 -0
- data/lib/sequel/adapters/shared/oracle.rb +5 -3
- data/lib/sequel/adapters/shared/postgres.rb +19 -12
- data/lib/sequel/adapters/shared/progress.rb +2 -0
- data/lib/sequel/adapters/shared/sqlanywhere.rb +3 -1
- data/lib/sequel/adapters/shared/sqlite.rb +2 -0
- data/lib/sequel/adapters/sqlanywhere.rb +2 -0
- data/lib/sequel/adapters/sqlite.rb +4 -1
- data/lib/sequel/adapters/swift.rb +2 -0
- data/lib/sequel/adapters/swift/mysql.rb +2 -0
- data/lib/sequel/adapters/swift/postgres.rb +2 -0
- data/lib/sequel/adapters/swift/sqlite.rb +2 -0
- data/lib/sequel/adapters/tinytds.rb +2 -0
- data/lib/sequel/adapters/utils/emulate_offset_with_reverse_and_count.rb +5 -3
- data/lib/sequel/adapters/utils/emulate_offset_with_row_number.rb +5 -3
- data/lib/sequel/adapters/utils/pg_types.rb +2 -0
- data/lib/sequel/adapters/utils/replace.rb +2 -0
- data/lib/sequel/adapters/utils/split_alter_table.rb +2 -0
- data/lib/sequel/adapters/utils/stored_procedures.rb +2 -0
- data/lib/sequel/ast_transformer.rb +2 -0
- data/lib/sequel/connection_pool.rb +2 -0
- data/lib/sequel/connection_pool/sharded_single.rb +2 -0
- data/lib/sequel/connection_pool/sharded_threaded.rb +2 -0
- data/lib/sequel/connection_pool/single.rb +2 -0
- data/lib/sequel/connection_pool/threaded.rb +2 -0
- data/lib/sequel/core.rb +2 -0
- data/lib/sequel/database.rb +2 -0
- data/lib/sequel/database/connecting.rb +2 -0
- data/lib/sequel/database/dataset.rb +2 -0
- data/lib/sequel/database/dataset_defaults.rb +2 -0
- data/lib/sequel/database/features.rb +2 -0
- data/lib/sequel/database/logging.rb +2 -0
- data/lib/sequel/database/misc.rb +2 -0
- data/lib/sequel/database/query.rb +2 -0
- data/lib/sequel/database/schema_generator.rb +2 -0
- data/lib/sequel/database/schema_methods.rb +11 -4
- data/lib/sequel/database/transactions.rb +2 -0
- data/lib/sequel/dataset.rb +2 -0
- data/lib/sequel/dataset/actions.rb +2 -0
- data/lib/sequel/dataset/features.rb +2 -0
- data/lib/sequel/dataset/graph.rb +2 -0
- data/lib/sequel/dataset/misc.rb +2 -0
- data/lib/sequel/dataset/mutation.rb +2 -0
- data/lib/sequel/dataset/placeholder_literalizer.rb +3 -1
- data/lib/sequel/dataset/prepared_statements.rb +2 -0
- data/lib/sequel/dataset/query.rb +2 -0
- data/lib/sequel/dataset/sql.rb +7 -5
- data/lib/sequel/deprecated.rb +2 -0
- data/lib/sequel/exceptions.rb +2 -0
- data/lib/sequel/extensions/_pretty_table.rb +5 -3
- data/lib/sequel/extensions/arbitrary_servers.rb +2 -0
- data/lib/sequel/extensions/blank.rb +2 -0
- data/lib/sequel/extensions/columns_introspection.rb +2 -0
- data/lib/sequel/extensions/connection_validator.rb +2 -0
- data/lib/sequel/extensions/constraint_validations.rb +2 -0
- data/lib/sequel/extensions/core_extensions.rb +2 -0
- data/lib/sequel/extensions/core_refinements.rb +2 -0
- data/lib/sequel/extensions/current_datetime_timestamp.rb +2 -0
- data/lib/sequel/extensions/dataset_source_alias.rb +2 -0
- data/lib/sequel/extensions/date_arithmetic.rb +3 -1
- data/lib/sequel/extensions/empty_array_consider_nulls.rb +2 -0
- data/lib/sequel/extensions/empty_array_ignore_nulls.rb +2 -0
- data/lib/sequel/extensions/error_sql.rb +2 -0
- data/lib/sequel/extensions/eval_inspect.rb +2 -0
- data/lib/sequel/extensions/filter_having.rb +2 -0
- data/lib/sequel/extensions/from_block.rb +2 -0
- data/lib/sequel/extensions/graph_each.rb +2 -0
- data/lib/sequel/extensions/hash_aliases.rb +2 -0
- data/lib/sequel/extensions/inflector.rb +2 -0
- data/lib/sequel/extensions/looser_typecasting.rb +2 -0
- data/lib/sequel/extensions/meta_def.rb +2 -0
- data/lib/sequel/extensions/migration.rb +14 -4
- data/lib/sequel/extensions/mssql_emulate_lateral_with_apply.rb +2 -0
- data/lib/sequel/extensions/named_timezones.rb +2 -0
- data/lib/sequel/extensions/null_dataset.rb +2 -0
- data/lib/sequel/extensions/pagination.rb +2 -0
- data/lib/sequel/extensions/pg_array.rb +16 -36
- data/lib/sequel/extensions/pg_array_ops.rb +2 -0
- data/lib/sequel/extensions/pg_enum.rb +4 -1
- data/lib/sequel/extensions/pg_hstore.rb +3 -1
- data/lib/sequel/extensions/pg_hstore_ops.rb +2 -0
- data/lib/sequel/extensions/pg_inet.rb +2 -0
- data/lib/sequel/extensions/pg_inet_ops.rb +2 -0
- data/lib/sequel/extensions/pg_interval.rb +3 -1
- data/lib/sequel/extensions/pg_json.rb +2 -0
- data/lib/sequel/extensions/pg_json_ops.rb +2 -0
- data/lib/sequel/extensions/pg_loose_count.rb +2 -0
- data/lib/sequel/extensions/pg_range.rb +2 -0
- data/lib/sequel/extensions/pg_range_ops.rb +2 -0
- data/lib/sequel/extensions/pg_row.rb +2 -0
- data/lib/sequel/extensions/pg_row_ops.rb +2 -0
- data/lib/sequel/extensions/pg_static_cache_updater.rb +2 -0
- data/lib/sequel/extensions/pretty_table.rb +2 -0
- data/lib/sequel/extensions/query.rb +2 -0
- data/lib/sequel/extensions/query_literals.rb +2 -0
- data/lib/sequel/extensions/round_timestamps.rb +2 -0
- data/lib/sequel/extensions/ruby18_symbol_extensions.rb +2 -0
- data/lib/sequel/extensions/schema_caching.rb +2 -0
- data/lib/sequel/extensions/schema_dumper.rb +4 -1
- data/lib/sequel/extensions/select_remove.rb +2 -0
- data/lib/sequel/extensions/sequel_3_dataset_methods.rb +3 -1
- data/lib/sequel/extensions/server_block.rb +2 -0
- data/lib/sequel/extensions/set_overrides.rb +2 -0
- data/lib/sequel/extensions/split_array_nil.rb +2 -0
- data/lib/sequel/extensions/sql_expr.rb +2 -0
- data/lib/sequel/extensions/string_date_time.rb +2 -0
- data/lib/sequel/extensions/thread_local_timezones.rb +2 -0
- data/lib/sequel/extensions/to_dot.rb +3 -1
- data/lib/sequel/model.rb +2 -0
- data/lib/sequel/model/associations.rb +3 -1
- data/lib/sequel/model/base.rb +5 -1
- data/lib/sequel/model/dataset_module.rb +2 -0
- data/lib/sequel/model/default_inflections.rb +2 -0
- data/lib/sequel/model/errors.rb +2 -0
- data/lib/sequel/model/exceptions.rb +2 -0
- data/lib/sequel/model/inflections.rb +2 -0
- data/lib/sequel/model/plugins.rb +2 -0
- data/lib/sequel/no_core_ext.rb +2 -0
- data/lib/sequel/plugins/accessed_columns.rb +2 -0
- data/lib/sequel/plugins/active_model.rb +2 -0
- data/lib/sequel/plugins/after_initialize.rb +2 -0
- data/lib/sequel/plugins/association_autoreloading.rb +2 -0
- data/lib/sequel/plugins/association_dependencies.rb +2 -0
- data/lib/sequel/plugins/association_pks.rb +20 -24
- data/lib/sequel/plugins/association_proxies.rb +2 -0
- data/lib/sequel/plugins/auto_validations.rb +2 -0
- data/lib/sequel/plugins/before_after_save.rb +2 -0
- data/lib/sequel/plugins/blacklist_security.rb +2 -0
- data/lib/sequel/plugins/boolean_readers.rb +2 -0
- data/lib/sequel/plugins/boolean_subsets.rb +2 -0
- data/lib/sequel/plugins/caching.rb +2 -0
- data/lib/sequel/plugins/class_table_inheritance.rb +2 -0
- data/lib/sequel/plugins/column_conflicts.rb +2 -0
- data/lib/sequel/plugins/column_select.rb +2 -0
- data/lib/sequel/plugins/composition.rb +2 -0
- data/lib/sequel/plugins/constraint_validations.rb +2 -0
- data/lib/sequel/plugins/csv_serializer.rb +2 -0
- data/lib/sequel/plugins/dataset_associations.rb +2 -0
- data/lib/sequel/plugins/defaults_setter.rb +2 -0
- data/lib/sequel/plugins/delay_add_association.rb +2 -0
- data/lib/sequel/plugins/dirty.rb +2 -0
- data/lib/sequel/plugins/eager_each.rb +2 -0
- data/lib/sequel/plugins/error_splitter.rb +2 -0
- data/lib/sequel/plugins/force_encoding.rb +2 -0
- data/lib/sequel/plugins/hook_class_methods.rb +2 -0
- data/lib/sequel/plugins/identifier_columns.rb +2 -0
- data/lib/sequel/plugins/input_transformer.rb +2 -0
- data/lib/sequel/plugins/insert_returning_select.rb +2 -0
- data/lib/sequel/plugins/instance_filters.rb +2 -0
- data/lib/sequel/plugins/instance_hooks.rb +2 -0
- data/lib/sequel/plugins/inverted_subsets.rb +2 -0
- data/lib/sequel/plugins/json_serializer.rb +2 -0
- data/lib/sequel/plugins/lazy_attributes.rb +2 -0
- data/lib/sequel/plugins/list.rb +2 -0
- data/lib/sequel/plugins/many_through_many.rb +2 -0
- data/lib/sequel/plugins/many_to_one_pk_lookup.rb +2 -0
- data/lib/sequel/plugins/modification_detection.rb +2 -0
- data/lib/sequel/plugins/mssql_optimistic_locking.rb +2 -0
- data/lib/sequel/plugins/nested_attributes.rb +2 -0
- data/lib/sequel/plugins/optimistic_locking.rb +2 -0
- data/lib/sequel/plugins/pg_array_associations.rb +2 -0
- data/lib/sequel/plugins/pg_row.rb +2 -0
- data/lib/sequel/plugins/pg_typecast_on_load.rb +2 -0
- data/lib/sequel/plugins/prepared_statements.rb +2 -0
- data/lib/sequel/plugins/prepared_statements_associations.rb +2 -0
- data/lib/sequel/plugins/prepared_statements_safe.rb +2 -0
- data/lib/sequel/plugins/prepared_statements_with_pk.rb +2 -0
- data/lib/sequel/plugins/rcte_tree.rb +2 -0
- data/lib/sequel/plugins/schema.rb +2 -0
- data/lib/sequel/plugins/scissors.rb +2 -0
- data/lib/sequel/plugins/serialization.rb +2 -0
- data/lib/sequel/plugins/serialization_modification_detection.rb +2 -0
- data/lib/sequel/plugins/sharding.rb +2 -0
- data/lib/sequel/plugins/single_table_inheritance.rb +2 -0
- data/lib/sequel/plugins/singular_table_names.rb +2 -0
- data/lib/sequel/plugins/skip_create_refresh.rb +2 -0
- data/lib/sequel/plugins/split_values.rb +2 -0
- data/lib/sequel/plugins/static_cache.rb +2 -0
- data/lib/sequel/plugins/string_stripper.rb +2 -0
- data/lib/sequel/plugins/subclasses.rb +2 -0
- data/lib/sequel/plugins/subset_conditions.rb +2 -0
- data/lib/sequel/plugins/table_select.rb +2 -0
- data/lib/sequel/plugins/tactical_eager_loading.rb +2 -0
- data/lib/sequel/plugins/timestamps.rb +2 -0
- data/lib/sequel/plugins/touch.rb +2 -0
- data/lib/sequel/plugins/tree.rb +2 -0
- data/lib/sequel/plugins/typecast_on_load.rb +2 -0
- data/lib/sequel/plugins/unlimited_update.rb +2 -0
- data/lib/sequel/plugins/update_or_create.rb +2 -0
- data/lib/sequel/plugins/update_primary_key.rb +2 -0
- data/lib/sequel/plugins/update_refresh.rb +2 -0
- data/lib/sequel/plugins/uuid.rb +2 -0
- data/lib/sequel/plugins/validate_associated.rb +2 -0
- data/lib/sequel/plugins/validation_class_methods.rb +2 -0
- data/lib/sequel/plugins/validation_helpers.rb +3 -1
- data/lib/sequel/plugins/xml_serializer.rb +2 -0
- data/lib/sequel/sql.rb +3 -1
- data/lib/sequel/timezones.rb +2 -0
- data/lib/sequel/version.rb +3 -1
- data/spec/adapters/mysql_spec.rb +4 -0
- data/spec/adapters/postgres_spec.rb +35 -11
- data/spec/core/connection_pool_spec.rb +1 -1
- data/spec/extensions/association_pks_spec.rb +4 -2
- data/spec/extensions/caching_spec.rb +1 -1
- data/spec/extensions/csv_serializer_spec.rb +7 -0
- data/spec/extensions/date_arithmetic_spec.rb +1 -1
- data/spec/extensions/dirty_spec.rb +6 -6
- data/spec/extensions/force_encoding_spec.rb +12 -12
- data/spec/extensions/input_transformer_spec.rb +1 -1
- data/spec/extensions/migration_spec.rb +16 -0
- data/spec/extensions/modification_detection_spec.rb +2 -2
- data/spec/extensions/nested_attributes_spec.rb +1 -1
- data/spec/extensions/optimistic_locking_spec.rb +1 -1
- data/spec/extensions/pg_array_spec.rb +3 -8
- data/spec/files/double_migration/001_create_sessions.rb +9 -0
- data/spec/files/double_migration/002_create_nodes.rb +19 -0
- data/spec/files/double_migration/003_3_create_users.rb +4 -0
- data/spec/files/empty_migration/001_create_sessions.rb +9 -0
- data/spec/files/empty_migration/002_create_nodes.rb +0 -0
- data/spec/files/empty_migration/003_3_create_users.rb +4 -0
- metadata +11 -3
data/lib/sequel/database/misc.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
1
3
|
module Sequel
|
2
4
|
class Database
|
3
5
|
# ---------------------
|
@@ -530,7 +532,8 @@ module Sequel
|
|
530
532
|
|
531
533
|
# SQL DDL fragment containing the column creation SQL for the given column.
|
532
534
|
def column_definition_sql(column)
|
533
|
-
sql =
|
535
|
+
sql = String.new
|
536
|
+
sql << "#{quote_identifier(column[:name])} #{type_literal(column)}"
|
534
537
|
column_definition_order.each{|m| send(:"column_definition_#{m}_sql", sql, column)}
|
535
538
|
sql
|
536
539
|
end
|
@@ -601,7 +604,8 @@ module Sequel
|
|
601
604
|
|
602
605
|
# SQL DDL fragment for column foreign key references
|
603
606
|
def column_references_sql(column)
|
604
|
-
sql =
|
607
|
+
sql = String.new
|
608
|
+
sql << " REFERENCES #{quote_schema_table(column[:table])}"
|
605
609
|
sql << "(#{Array(column[:key]).map{|x| quote_identifier(x)}.join(COMMA_SEPARATOR)})" if column[:key]
|
606
610
|
sql << " ON DELETE #{on_delete_clause(column[:on_delete])}" if column[:on_delete]
|
607
611
|
sql << " ON UPDATE #{on_update_clause(column[:on_update])}" if column[:on_update]
|
@@ -622,7 +626,8 @@ module Sequel
|
|
622
626
|
|
623
627
|
# SQL DDL fragment specifying a constraint on a table.
|
624
628
|
def constraint_definition_sql(constraint)
|
625
|
-
sql =
|
629
|
+
sql = String.new
|
630
|
+
sql << "CONSTRAINT #{quote_identifier(constraint[:name])} " if constraint[:name]
|
626
631
|
case constraint[:type]
|
627
632
|
when :check
|
628
633
|
check = constraint[:check]
|
@@ -726,7 +731,8 @@ module Sequel
|
|
726
731
|
# DDL statement for creating a view.
|
727
732
|
def create_view_sql(name, source, options)
|
728
733
|
source = source.sql if source.is_a?(Dataset)
|
729
|
-
sql =
|
734
|
+
sql = String.new
|
735
|
+
sql << "#{create_view_prefix_sql(name, options)} AS #{source}"
|
730
736
|
if check = options[:check]
|
731
737
|
sql << " WITH#{' LOCAL' if check == :local} CHECK OPTION"
|
732
738
|
end
|
@@ -735,6 +741,7 @@ module Sequel
|
|
735
741
|
|
736
742
|
# Append the column list to the SQL, if a column list is given.
|
737
743
|
def create_view_sql_append_columns(sql, columns)
|
744
|
+
sql = sql.dup
|
738
745
|
if columns
|
739
746
|
sql << ' ('
|
740
747
|
schema_utility_dataset.send(:identifier_list_append, sql, columns)
|
data/lib/sequel/dataset.rb
CHANGED
data/lib/sequel/dataset/graph.rb
CHANGED
data/lib/sequel/dataset/misc.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
1
3
|
module Sequel
|
2
4
|
class Dataset
|
3
5
|
# PlaceholderLiteralizer allows you to record the application of arbitrary changes
|
@@ -157,7 +159,7 @@ module Sequel
|
|
157
159
|
# Return the SQL query to use for the given arguments.
|
158
160
|
def sql(*args)
|
159
161
|
raise Error, "wrong number of arguments (#{args.length} for #{@arity})" unless args.length == @arity
|
160
|
-
s =
|
162
|
+
s = String.new
|
161
163
|
ds = @dataset
|
162
164
|
@fragments.each do |sql, i, transformer|
|
163
165
|
s << sql
|
data/lib/sequel/dataset/query.rb
CHANGED
data/lib/sequel/dataset/sql.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
1
3
|
module Sequel
|
2
4
|
class Dataset
|
3
5
|
# ---------------------
|
@@ -61,7 +63,7 @@ module Sequel
|
|
61
63
|
literal_symbol_append(sql, v)
|
62
64
|
else
|
63
65
|
unless l = db.literal_symbol(v)
|
64
|
-
l =
|
66
|
+
l = String.new
|
65
67
|
literal_symbol_append(l, v)
|
66
68
|
db.literal_symbol_set(v, l)
|
67
69
|
end
|
@@ -121,7 +123,7 @@ module Sequel
|
|
121
123
|
[insert_sql(columns, sql)]
|
122
124
|
when :union
|
123
125
|
c = false
|
124
|
-
sql = LiteralString.new
|
126
|
+
sql = LiteralString.new
|
125
127
|
u = UNION_ALL_SELECT
|
126
128
|
f = empty_from_sql
|
127
129
|
values.each do |v|
|
@@ -154,7 +156,7 @@ module Sequel
|
|
154
156
|
else
|
155
157
|
check_truncation_allowed!
|
156
158
|
raise(InvalidOperation, "Can't truncate filtered datasets") if opts[:where] || opts[:having]
|
157
|
-
t =
|
159
|
+
t = String.new
|
158
160
|
source_list_append(t, opts[:from])
|
159
161
|
_truncate_sql(t)
|
160
162
|
end
|
@@ -339,7 +341,7 @@ module Sequel
|
|
339
341
|
[:literal, :quote_identifier, :quote_schema_table].each do |meth|
|
340
342
|
class_eval(<<-END, __FILE__, __LINE__ + 1)
|
341
343
|
def #{meth}(*args, &block)
|
342
|
-
s = ''
|
344
|
+
s = ''.dup
|
343
345
|
#{meth}_append(s, *args, &block)
|
344
346
|
s
|
345
347
|
end
|
@@ -1511,7 +1513,7 @@ module Sequel
|
|
1511
1513
|
# The string that is appended to to create the SQL query, the empty
|
1512
1514
|
# string by default
|
1513
1515
|
def sql_string_origin
|
1514
|
-
|
1516
|
+
String.new
|
1515
1517
|
end
|
1516
1518
|
|
1517
1519
|
# SQL to use if this dataset uses static SQL. Since static SQL
|
data/lib/sequel/deprecated.rb
CHANGED
data/lib/sequel/exceptions.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
#
|
1
3
|
# This _pretty_table extension is only for internal use.
|
2
4
|
# It adds the Sequel::PrettyTable class without modifying
|
3
5
|
# Sequel::Dataset.
|
@@ -53,7 +55,7 @@ module Sequel
|
|
53
55
|
|
54
56
|
# String for each data line
|
55
57
|
def self.data_line(columns, sizes, record) # :nodoc:
|
56
|
-
'|' << columns.map {|c| format_cell(sizes[c], record[c])}.join('|') << '|'
|
58
|
+
String.new << '|' << columns.map {|c| format_cell(sizes[c], record[c])}.join('|') << '|'
|
57
59
|
end
|
58
60
|
|
59
61
|
# Format the value so it takes up exactly size characters
|
@@ -70,12 +72,12 @@ module Sequel
|
|
70
72
|
|
71
73
|
# String for header line
|
72
74
|
def self.header_line(columns, sizes) # :nodoc:
|
73
|
-
'|' << columns.map {|c| "%-#{sizes[c]}s" % c.to_s}.join('|') << '|'
|
75
|
+
String.new << '|' << columns.map {|c| "%-#{sizes[c]}s" % c.to_s}.join('|') << '|'
|
74
76
|
end
|
75
77
|
|
76
78
|
# String for separtor line
|
77
79
|
def self.separator_line(columns, sizes) # :nodoc:
|
78
|
-
'+' << columns.map {|c| '-' * sizes[c]}.join('+') << '+'
|
80
|
+
String.new << '+' << columns.map {|c| '-' * sizes[c]}.join('+') << '+'
|
79
81
|
end
|
80
82
|
|
81
83
|
private_class_method :column_sizes, :data_line, :format_cell, :header_line, :separator_line
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
#
|
1
3
|
# The date_arithmetic extension adds the ability to perform database-independent
|
2
4
|
# addition/substraction of intervals to/from dates and timestamps.
|
3
5
|
#
|
@@ -73,7 +75,7 @@ module Sequel
|
|
73
75
|
expr = da.expr
|
74
76
|
cast = case db_type = db.database_type
|
75
77
|
when :postgres
|
76
|
-
interval =
|
78
|
+
interval = String.new
|
77
79
|
each_valid_interval_unit(h, DEF_DURATION_UNITS) do |value, sql_unit|
|
78
80
|
interval << "#{value} #{sql_unit} "
|
79
81
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
#
|
1
3
|
# The inflector extension adds inflection instance methods to String, which allows the easy transformation of
|
2
4
|
# words from singular to plural, class names to table names, modularized class
|
3
5
|
# names to ones without, and class names to foreign keys. It exists for
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
#
|
1
3
|
# Adds the Sequel::Migration and Sequel::Migrator classes, which allow
|
2
4
|
# the user to easily group schema changes and migrate the database
|
3
5
|
# to a newer version or revert to a previous version.
|
@@ -467,6 +469,14 @@ module Sequel
|
|
467
469
|
end
|
468
470
|
end
|
469
471
|
|
472
|
+
# Load the migration file, raising an exception if the file does not define
|
473
|
+
# a single migration.
|
474
|
+
def load_migration_file(file)
|
475
|
+
n = Migration.descendants.length
|
476
|
+
load(file)
|
477
|
+
raise Error, "Migration file not containing a single migration detected" unless n + 1 == Migration.descendants.length
|
478
|
+
end
|
479
|
+
|
470
480
|
# Remove all migration classes. Done by the migrator to ensure that
|
471
481
|
# the correct migration classes are picked up.
|
472
482
|
def remove_migration_classes
|
@@ -564,7 +574,7 @@ module Sequel
|
|
564
574
|
remove_migration_classes
|
565
575
|
|
566
576
|
# load migration files
|
567
|
-
version_numbers.each{|n|
|
577
|
+
version_numbers.each{|n| load_migration_file(files[n])}
|
568
578
|
|
569
579
|
# get migration classes
|
570
580
|
Migration.descendants
|
@@ -705,15 +715,15 @@ module Sequel
|
|
705
715
|
if target
|
706
716
|
if migration_version_from_file(f) > target
|
707
717
|
if applied_migrations.include?(fi)
|
708
|
-
|
718
|
+
load_migration_file(path)
|
709
719
|
down_mts << [ms.last, f, :down]
|
710
720
|
end
|
711
721
|
elsif !applied_migrations.include?(fi)
|
712
|
-
|
722
|
+
load_migration_file(path)
|
713
723
|
up_mts << [ms.last, f, :up]
|
714
724
|
end
|
715
725
|
elsif !applied_migrations.include?(fi)
|
716
|
-
|
726
|
+
load_migration_file(path)
|
717
727
|
up_mts << [ms.last, f, :up]
|
718
728
|
end
|
719
729
|
end
|