Module: ActiveRecord::ConnectionAdapters::SQLite3::SchemaStatements

Included in:
ActiveRecord::ConnectionAdapters::SQLite3Adapter
Defined in:
activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#create_schema_dumper(options) ⇒ Object



46
47
48
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb', line 46

def create_schema_dumper(options)
  SQLite3::SchemaDumper.create(self, options)
end

#indexes(table_name, name = nil) ⇒ Object

Returns an array of indexes for the given table.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb', line 8

def indexes(table_name, name = nil)
  if name
    ActiveSupport::Deprecation.warn("      Passing name to #indexes is deprecated without replacement.\n    MSG\n  end\n\n  exec_query(\"PRAGMA index_list(\#{quote_table_name(table_name)})\", \"SCHEMA\").map do |row|\n    index_sql = query_value(<<-SQL, \"SCHEMA\")\n      SELECT sql\n      FROM sqlite_master\n      WHERE name = \#{quote(row['name'])} AND type = 'index'\n      UNION ALL\n      SELECT sql\n      FROM sqlite_temp_master\n      WHERE name = \#{quote(row['name'])} AND type = 'index'\n    SQL\n\n    /\\sWHERE\\s+(?<where>.+)$/i =~ index_sql\n\n    columns = exec_query(\"PRAGMA index_info(\#{quote(row['name'])})\", \"SCHEMA\").map do |col|\n      col[\"name\"]\n    end\n\n    IndexDefinition.new(\n      table_name,\n      row[\"name\"],\n      row[\"unique\"] != 0,\n      columns,\n      where: where\n    )\n  end\nend\n".squish)

#update_table_definition(table_name, base) ⇒ Object



42
43
44
# File 'activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb', line 42

def update_table_definition(table_name, base)
  SQLite3::Table.new(table_name, base)
end