method
configure_connection
v7.1.3.4 -
Show latest stable
-
0 notes -
Class: ActiveRecord::ConnectionAdapters::SQLite3Adapter
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
configure_connection()
private
Hide source
# File activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb, line 714 def configure_connection if @config[:timeout] && @config[:retries] raise ArgumentError, "Cannot specify both timeout and retries arguments" elsif @config[:timeout] @raw_connection.busy_timeout(self.class.type_cast_config_to_integer(@config[:timeout])) elsif @config[:retries] retries = self.class.type_cast_config_to_integer(@config[:retries]) raw_connection.busy_handler do |count| count <= retries end end # Enforce foreign key constraints # https://www.sqlite.org/pragma.html#pragma_foreign_keys # https://www.sqlite.org/foreignkeys.html raw_execute("PRAGMA foreign_keys = ON", "SCHEMA") unless @memory_database # Journal mode WAL allows for greater concurrency (many readers + one writer) # https://www.sqlite.org/pragma.html#pragma_journal_mode raw_execute("PRAGMA journal_mode = WAL", "SCHEMA") # Set more relaxed level of database durability # 2 = "FULL" (sync on every write), 1 = "NORMAL" (sync every 1000 written pages) and 0 = "NONE" # https://www.sqlite.org/pragma.html#pragma_synchronous raw_execute("PRAGMA synchronous = NORMAL", "SCHEMA") # Set the global memory map so all processes can share some data # https://www.sqlite.org/pragma.html#pragma_mmap_size # https://www.sqlite.org/mmap.html raw_execute("PRAGMA mmap_size = #{128.megabytes}", "SCHEMA") end # Impose a limit on the WAL file to prevent unlimited growth # https://www.sqlite.org/pragma.html#pragma_journal_size_limit raw_execute("PRAGMA journal_size_limit = #{64.megabytes}", "SCHEMA") # Set the local connection cache to 2000 pages # https://www.sqlite.org/pragma.html#pragma_cache_size raw_execute("PRAGMA cache_size = 2000", "SCHEMA") end