aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2017-07-12 23:21:07 +0930
committerGitHub <noreply@github.com>2017-07-12 23:21:07 +0930
commit58f10a31b37e9bb6e975a71aa63744f318ee043d (patch)
tree0c1fae69495ddfc24e4ad8fede784b4b5f4947fb /guides
parent21344061dc17151fe749b9dc76a127d597ec43ef (diff)
parent52e050ed00b023968fecda82f19a858876a7c435 (diff)
downloadrails-58f10a31b37e9bb6e975a71aa63744f318ee043d.tar.gz
rails-58f10a31b37e9bb6e975a71aa63744f318ee043d.tar.bz2
rails-58f10a31b37e9bb6e975a71aa63744f318ee043d.zip
Merge pull request #29699 from lugray/represent_boolean_as_integer
Change sqlite3 boolean serialization to use 1 and 0
Diffstat (limited to 'guides')
-rw-r--r--guides/source/configuring.md22
1 files changed, 22 insertions, 0 deletions
diff --git a/guides/source/configuring.md b/guides/source/configuring.md
index 28ceef9740..d7fa8813b2 100644
--- a/guides/source/configuring.md
+++ b/guides/source/configuring.md
@@ -375,6 +375,28 @@ The MySQL adapter adds one additional configuration option:
* `ActiveRecord::ConnectionAdapters::Mysql2Adapter.emulate_booleans` controls whether Active Record will consider all `tinyint(1)` columns as booleans. Defaults to `true`.
+The SQLite3Adapter adapter adds one additional configuration option:
+
+* `ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer`
+indicates whether boolean values are stored in sqlite3 databases as 1 and 0 or
+'t' and 'f'. Leaving `ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer`
+set to false is deprecated. SQLite databases have used 't' and 'f' to serialize
+boolean values and must have old data converted to 1 and 0 (its native boolean
+serialization) before setting this flag to true. Conversion can be accomplished
+by setting up a rake task which runs
+
+ ```ruby
+ ExampleModel.where("boolean_column = 't'").update_all(boolean_column: 1)
+ ExampleModel.where("boolean_column = 't'").update_all(boolean_column: 0)
+ ```
+
+ for all models and all boolean columns, after which the flag must be set to true
+by adding the following to your application.rb file:
+
+ ```ruby
+ ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer = true
+ ```
+
The schema dumper adds one additional configuration option:
* `ActiveRecord::SchemaDumper.ignore_tables` accepts an array of tables that should _not_ be included in any generated schema file. This setting is ignored unless `config.active_record.schema_format == :ruby`.