Database schema migrations
<p><a href="https://www.linkedin.com/in/parthasl/">Lakshminarasimhan Parthasarathy</a>, <a href="https://www.verizonmedia.com/">Verizon Media</a><br/></p><h2>Database schema migrations</h2><p><b></b></p><p>Screwdriver now supports database schema migrations using sequelize-cli migrations. When adding any fields to models in the data-schema, you will need to add a migration file. Sequelize-cli migrations keep track of changes to the database, helping with adding and/or reverting the changes to the DB. They also ensure models and migration files are in sync.</p><p><br/></p><p><b></b></p><h2>Why schema migrations?</h2><p>Database schema migrations will help to manage the state of schemas. Screwdriver originally did schema deployments during API deployments while this was helpful for low-scale deployments, it also leads to unexpected issues for high-scale deployments. For such high-scale deployments, migrations are more effective as they ensure quicker and more consistent schema deployment outside of API deployments. Moreover, API traffic is not served until database schema changes are applied and ready.</p><h2><br/></h2><h2>Cluster Admins</h2><p>In order to run schema migrations, DDL sync via API should be disabled using the <a href="https://github.com/screwdriver-cd/screwdriver/blob/master/config/custom-environment-variables.yaml#L57">DATASTORE_DDL_SYNC_ENABLED</a> environment variable, since this option is enabled by default. </p><ul><li>Both schema migrations and DDL sync via API should not be run together. Either option should suffice based on the scale of Screwdriver deployment.</li><li>Always create new migration files for any new DDL changes.</li><li>Do not edit or remove migration files even after it’s migrated and available in the database. </li></ul><p>Screwdriver cluster admins can refer to the following documentation for more details on database schema migrations:</p><ul><li>README: <a href="https://github.com/screwdriver-cd/data-schema/blob/master/CONTRIBUTING.md#migrations">https://github.com/screwdriver-cd/data-schema/blob/master/CONTRIBUTING.md#migrations</a></li><li>Issue: <a href="https://github.com/screwdriver-cd/screwdriver/issues/1664">https://github.com/screwdriver-cd/screwdriver/issues/1664</a></li><li>Disable DDL sync via API: <a href="https://github.com/screwdriver-cd/screwdriver/pull/1756">https://github.com/screwdriver-cd/screwdriver/pull/1756</a></li></ul><p><b><br/></b></p><h2>Compatibility List</h2><p>In order to use this feature, you will need these minimum versions:</p><ul><li>[API] (<a href="https://hub.docker.com/r/screwdrivercd/screwdriver">https://hub.docker.com/r/screwdrivercd/screwdriver</a>) - v0.5.752</li></ul><p><br/></p><p><b></b></p><h2>Contributors</h2><p>Thanks to the following people for making this feature possible:</p><ul><li><a href="https://github.com/parthasl">parthasl</a></li><li><a href="https://github.com/catto">catto</a></li><li><a href="https://github.com/dekusDenial">dekus</a></li></ul><p>Screwdriver is an open-source build automation platform designed for Continuous Delivery. It is built (and used) by Yahoo. Don’t hesitate to reach out if you have questions or would like to contribute: <a href="https://t.umblr.com/redirect?z=http%3A%2F%2Fdocs.screwdriver.cd%2Fabout%2Fsupport.&t=MTdlNGVlY2FlNjQ1NTMwNWJhNzliNzA4MmQ3ZjAwMTJlYTYwYzZhZCxtd2o0dHBkaQ%3D%3D&b=t%3AjoJeie323MzP-suSfk7unw&p=https%3A%2F%2Fblog.screwdriver.cd%2Fpost%2F181683807942%2Fmultiple-build-cluster&m=1">http://docs.screwdriver.cd/about/support.</a></p>