title: A required field in form must now be made optional with a new field becoming required while having an optional relationship to the original field
body: <p><strong>Background:</strong>
  I'm working on an pre-existing code base that has already been live in production for years. Nuking the DB is not an option.</p>
  
  <p><strong>TLDR</strong> We have a web form with values that map back to a DB table, a form and value and its associated schema currently are set as required. We want to add another value to the form which will become required, but also making the aforementioned value optional.</p>
  
  <p><strong>Current State:</strong>
  Imagine a web form with a field, "transaction numbers" that maps back to a schema like this</p>
  
  <pre class="lang-rb prettyprint-override"><code> create_table "transaction", force: :cascade do |t|
      t.string "transaction_number", null: false
      t.integer "entry_id", null: false
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
      t.integer "rep_id"
      t.index ["entry_id", "transaction_number"], name: "index_trans_on_entry_id_and_trans_number", unique: true
    end
  </code></pre>
  
  <p>In this current setup, a transaction number is required (and has been since the application has existed).</p>
  
  <p>The challenge is to now add another field to the web form, let's call it <code>parts_number</code>.</p>
  
  <p>Adding the field bring on new requirements:</p>
  
  <ol>
  <li>A transaction/transaction_number will be <em>optional</em> going forward</li>
  <li><code>parts_number</code> will become <em>required</em></li>
  <li>A form submission must always include <code>parts_number</code> and <em>might</em> include a transaction_number, but not necessarily</li>
  </ol>
  
  <p>It can be said that there is a one-to-one/one-to-none relationship between <code>parts_number</code> and <code>transaction_number</code>.</p>
  
  <p>Given that in the current, original, version we query on transactions, it seems we'd have to change how we do queries since going forward all data will require <code>parts_number</code> and <em>sometimes</em> have <code>transaction_number</code>, but all historical data will continue have <code>transaction_number</code> but never <code>parts_number</code>. Doing a migration of historical data to suddenly have <code>parts_number</code> is also not an option.</p>
  
  <p>What might be a good approach for this?</p>
  
  <p>Is there a way this can be approached safely?</p>