# Litefs database migrations with multiple machines in primary - how to determine writeable primary machine?

**URL:** <https://community.fly.io/t/litefs-database-migrations-with-multiple-machines-in-primary-how-to-determine-writeable-primary-machine/18752>\
**Category:** General\
**Tags:** rails, litefs, login-only\
**Created:** [March 14, 2024, 2:19pm UTC](https://community.fly.io/t/litefs-database-migrations-with-multiple-machines-in-primary-how-to-determine-writeable-primary-machine/18752 "2024-03-14T14:19:12Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![benbjohnson](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/benbjohnson/32/50901_2.png) [@benbjohnson](https://community.fly.io/u/benbjohnson)\
**Post date:** [March 14, 2024, 9:43pm UTC](https://community.fly.io/t/litefs-database-migrations-with-multiple-machines-in-primary-how-to-determine-writeable-primary-machine/18752/4 "2024-03-14T21:43:51Z")

</div>

If you run LiteFS as the supervisor for your Rails app (e.g. `litefs mount` starts and it calls `rails server`) then you can set it up in the `litefs.yml` to only run certain commands on the candidate nodes. You can set `lease.promote` to `true` to automatically promote nodes as they start up which will ensure that the command is run by the primary.

> **[Getting Started with LiteFS on Fly.io](https://fly.io/docs/litefs/getting-started-fly/#running-as-a-supervisor)**
>
> Documentation and guides from the team at Fly.io.

---

_[View the full topic](https://community.fly.io/t/litefs-database-migrations-with-multiple-machines-in-primary-how-to-determine-writeable-primary-machine/18752)._
