title: Use Postgres generated columns in Sequelize model
body: <p>I have a table where it's beneficial to generate a pre-calculated value in the database engine rather than in my application code.  For this, I'm using <a href="https://www.postgresql.org/docs/12/ddl-generated-columns.html" rel="nofollow noreferrer">Postgres' generated column</a> feature.  The SQL is like this:</p>
  <pre><code>ALTER TABLE &quot;Items&quot;
  ADD &quot;generatedValue&quot; DOUBLE PRECISION GENERATED ALWAYS AS (
    LEAST(&quot;someCol&quot;, &quot;someOtherCol&quot;)
  ) STORED;
  </code></pre>
  <p>This works well, but I'm using Sequelize with this database.  I want to find a way to define this column in my model definition, so that Sequelize will query it, not attempt to update a row's value for that column, and ideally will create the column on sync.</p>
  <pre><code>class Item extends Sequelize.Model {
    static init(sequelize) {
      return super.init({
        someCol: Sequelize.DOUBLE,
        someOtherColl: Sequelize.DOUBLE,
        generatedValue: // &lt;&lt;&lt;--  What goes here??
      });
    }
  }
  </code></pre>
  <p>How can I do this with Sequelize?</p>
  <p>I can specify the column as a DOUBLE, and Sequelize will read it, but the column won't be created correctly on sync.  Perhaps there's some post-sync hook I can use?  I was considering <code>afterSync</code> to drop the column and re-add it with my generated value statement, but I would first need to detect that the column wasn't already converted or I would lose my data.  (I run sync [without <code>force: true</code>] on every app startup.)</p>
  <p>Any thoughts, or alternative ideas would be appreciated.</p>