# How to properly alter the database?

**URL:** <https://meta.discourse.org/t/how-to-properly-alter-the-database/60659>\
**Category:** Development\
**Created:** [Avril 8, 2017, 7:31 UTC](https://meta.discourse.org/t/how-to-properly-alter-the-database/60659 "2017-04-08T19:31:14Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![icculus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/icculus/32/120985_2.png) [@icculus](https://meta.discourse.org/u/icculus)\
**Post date:** [Avril 8, 2017, 7:31 UTC](https://meta.discourse.org/t/how-to-properly-alter-the-database/60659/1 "2017-04-08T19:31:14Z")

</div>

This is probably easy, but I see conflicting information in various topics, so I’ll ask:

If I wanted to add a field to a database table for a new Discourse feature, where is the schema defined? And how does one tell existing instances to alter their existing tables when upgrading if something is added/changed?

I see topics that say db:migrate handles this, but others that say Discourse doesn’t use the standard Rails mechanism. Is there a simple “you write the new field in here, and add a note to alter the table here, done!” explanation to this?

Thanks!

---

_[View the full topic](https://meta.discourse.org/t/how-to-properly-alter-the-database/60659)._
