Answers.Body: <p>This is the mySQL query I have used to update a lightswitch field in the database.</p>
  
  <pre><code>UPDATE `table` SET `field_name` = replace(field_name,'original content', 'updated content')
  </code></pre>
  
  <p>for example:</p>
  
  <pre><code>UPDATE `craft_content` SET `field_imageLightbox` = replace(field_imageLightbox,'0', '1')
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-08T16:40:26.103Z
Answers.LastActivityDate: 2019-03-08T16:40:26.103Z
Answers.UserDisplayName: Terry Upton
Answers.Body: <p>For entries previously created, the lightswitch field will not be <em>on</em> even if you specified that as a field option. However, new entries should respect that field setting.</p>
  
  <p>Are new entries not honoring your field settings?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-21T20:52:42.253Z
Answers.Text: I see, I did not expect that behaviour, you are correct in that is what I am experiencing. Presumably I'd have to write a plugin to re-save entries with the 'on' value set.
Answers.UserDisplayName: Adam Menczykowski
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-21T21:57:46.433Z
Answers.Text: @AdamMenczykowski If you're comfortable with SQL, you could update the value of light switch field in the content table for entry elements in the desired section. Not super simple but should be quick and painless if you can write the SQL with a couple criteria in the where clause.
Answers.UserDisplayName: Selvin Ortiz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-04T12:04:56.847Z
Answers.Text: Could anyone provide example code on how to write SQL query code to enable all lightswitches on existing entries please?
Answers.UserDisplayName: Adam Menczykowski
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-22T16:34:47.530Z
Answers.Text: I too would like example sql code
Answers.UserDisplayName: CreateSean
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-05T15:25:40.737Z
Answers.Text: Is there no way of selecting all entries in a structure and re-saving all at once?
Answers.UserDisplayName: mateostabio
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-21T17:55:36.713Z
Answers.LastActivityDate: 2017-02-21T17:55:36.713Z
Answers.UserDisplayName: Selvin Ortiz
Body: <p>I'm creating a new lightswitch field and adding it to an entry type in a section which already has dozens of entries. I want the lightswitch to be default set to 'on'.</p>
  
  <p>When I save the entry type with the lightswitch field added to a tab, then inspect an entry in that section, the new lightswitch field is set to 'off'. Is this a bug?</p>
  
Tags: <lightswitch><default>
Title: Can the Lightswitch field have a default 'on' setting?
ThreadText: # Can the Lightswitch field have a default 'on' setting?
  
  (Asked by: username_0 on 2017-02-21)
  
  I'm creating a new lightswitch field and adding it to an entry type in a section which already has dozens of entries. I want the lightswitch to be default set to 'on'.
  
  When I save the entry type with the lightswitch field added to a tab, then inspect an entry in that section, the new lightswitch field is set to 'off'. Is this a bug?
  
  **Tags:** lightswitch, default
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2017-02-21. Score: 7 | Accepted answer
  
  For entries previously created, the lightswitch field will not be *on* even if you specified that as a field option. However, new entries should respect that field setting.
  
  Are new entries not honoring your field settings?
  
  > **Comments:**
  > **username_0**: I see, I did not expect that behaviour, you are correct in that is what I am experiencing. Presumably I'd have to write a plugin to re-save entries with the 'on' value set.  
  > **username_2**: @username_0 If you're comfortable with SQL, you could update the value of light switch field in the content table for entry elements in the desired section. Not super simple but should be quick and painless if you can write the SQL with a couple criteria in the where clause.  
  > **username_0**: Could anyone provide example code on how to write SQL query code to enable all lightswitches on existing entries please?  
  > **username_3**: I too would like example sql code  
  > **username_4**: Is there no way of selecting all entries in a structure and re-saving all at once?  
  
  ---
  
  ### Answer by username_1 on 2019-03-08. Score: 1
  
  This is the mySQL query I have used to update a lightswitch field in the database.
  
  ```
  UPDATE `table` SET `field_name` = replace(field_name,'original content', 'updated content')
  
  ```
  
  for example:
  
  ```
  UPDATE `craft_content` SET `field_imageLightbox` = replace(field_imageLightbox,'0', '1')
  
  ```
  
  
  ---
  
  