123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::ConnectionAdapters::SQLite3::SchemaDumper

Do not use. This class is for internal use only.

Constant Summary

::ActiveRecord::ConnectionAdapters::SchemaDumper - Inherited

DEFAULT_DATETIME_PRECISION

Class Attribute Summary

::ActiveRecord::SchemaDumper - Inherited

.chk_ignore_pattern

Specify a custom regular expression matching check constraints which name should not be dumped to db/schema.rb.

.excl_ignore_pattern

Specify a custom regular expression matching exclusion constraints which name should not be dumped to db/schema.rb.

.fk_ignore_pattern

Specify a custom regular expression matching foreign keys which name should not be dumped to db/schema.rb.

.ignore_tables

A list of tables which should not be dumped to the schema.

.unique_ignore_pattern

Specify a custom regular expression matching unique constraints which name should not be dumped to db/schema.rb.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

This class inherits a constructor from ActiveRecord::SchemaDumper

Instance Method Details

#default_primary_key?(column) ⇒ Boolean (private)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb', line 21

def default_primary_key?(column)
  schema_type(column) == :integer
end

#explicit_primary_key_default?(column) ⇒ Boolean (private)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb', line 25

def explicit_primary_key_default?(column)
  column.bigint?
end

#extract_expression_for_virtual_column(column) (private)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb', line 41

def extract_expression_for_virtual_column(column)
  column.default_function.inspect
end

#prepare_column_options(column) (private)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb', line 29

def prepare_column_options(column)
  spec = super

  if @connection.supports_virtual_columns? && column.virtual?
    spec[:as] = extract_expression_for_virtual_column(column)
    spec[:stored] = column.virtual_stored?
    spec = { type: schema_type(column).inspect }.merge!(spec)
  end

  spec
end

#virtual_tables(stream) (private)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb', line 8

def virtual_tables(stream)
  virtual_tables = @connection.virtual_tables
  if virtual_tables.any?
    stream.puts
    stream.puts "  # Virtual tables defined in this database."
    stream.puts "  # Note that virtual tables may not work with other database engines. Be careful if changing database."
    virtual_tables.sort.each do |table_name, options|
      module_name, arguments = options
      stream.puts "  create_virtual_table #{table_name.inspect}, #{module_name.inspect}, #{arguments.split(", ").inspect}"
    end
  end
end