# afterMigrations changeSet attribute - to be run only when migrations occur and after them all

**URL:** <https://forum.liquibase.org/t/aftermigrations-changeset-attribute-to-be-run-only-when-migrations-occur-and-after-them-all/2669>\
**Category:** Liquibase Development\
**Created:** [July 29, 2013, 4:29pm UTC](https://forum.liquibase.org/t/aftermigrations-changeset-attribute-to-be-run-only-when-migrations-occur-and-after-them-all/2669 "2013-07-29T16:29:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![neale.upstone](https://avatars.discourse-cdn.com/v4/letter/n/b5a626/32.png) [@neale.upstone](https://forum.liquibase.org/u/neale.upstone)\
**Post date:** [July 29, 2013, 4:29pm UTC](https://forum.liquibase.org/t/aftermigrations-changeset-attribute-to-be-run-only-when-migrations-occur-and-after-them-all/2669/1 "2013-07-29T16:29:00Z")

</div>

We use a table generator id strategy, and we’re updating our hibernate\_sequences table whenever we insert new data.  
  
The nature of updating that table is that we always want to do it, but only when migrations have been applied (i.e. not on a simple deployment where no database migrations occurred).  
  
I’m thinking that we could define a changeset with the updates in, and have the changeset marked

1. \<changeSet afterMigrations=“true” …\>
2. &nbsp;&nbsp; \<update table="hibernate\_sequences\>
3. etc  

Does anyone have any suggestions before I go off and look at creating a pull request?

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [July 29, 2013, 4:29pm UTC](https://forum.liquibase.org/t/aftermigrations-changeset-attribute-to-be-run-only-when-migrations-occur-and-after-them-all/2669/2 "2013-07-29T16:29:00Z")

</div>

I usually just have a included changelog at the bottom of my master with any changeSets that always need to run and use the runAlways=true attribute. That way they always run and always run after everything else.

That doesn’t track if changes have happened, though. If you want to create a pull request I’d definitely look at including the functionality.&nbsp;

Nathan

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [July 29, 2013, 4:29pm UTC](https://forum.liquibase.org/t/aftermigrations-changeset-attribute-to-be-run-only-when-migrations-occur-and-after-them-all/2669/3 "2013-07-29T16:29:00Z")

</div>

Great, LMK if you have any questions with implementation.

Nathan

---

<div class="post-metadata">

**Author:** ![nealeu](https://avatars.discourse-cdn.com/v4/letter/n/cc9497/32.png) [@nealeu](https://forum.liquibase.org/u/nealeu)\
**Post date:** [July 29, 2013, 4:29pm UTC](https://forum.liquibase.org/t/aftermigrations-changeset-attribute-to-be-run-only-when-migrations-occur-and-after-them-all/2669/4 "2013-07-29T16:29:00Z")

</div>

Thanks Nathan.  
  
I’ve moved the story that depends on it up, so with a following wind it could get pulled reasonably soon.
