# Maintain build number after upgrade to v0.8

**URL:** <https://drone.discourse.group/t/maintain-build-number-after-upgrade-to-v0-8/9212>\
**Category:** Drone Support\
**Created:** [October 23, 2017, 9:39pm UTC](https://drone.discourse.group/t/maintain-build-number-after-upgrade-to-v0-8/9212 "2017-10-23T21:39:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![foooocus](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/foooocus/32/3740_2.png) [@foooocus](https://drone.discourse.group/u/foooocus)\
**Post date:** [October 23, 2017, 9:39pm UTC](https://drone.discourse.group/t/maintain-build-number-after-upgrade-to-v0-8/9212/1 "2017-10-23T21:39:26Z")

</div>

Hello, I’m using v0.5 currently and plan to upgrade to v0.8 soon. I know there are data upgrades done in v0.6 and I have to go through v0.6 and v0.7 before upgrading to v0.8. Our builds heavily depends on drone build numbers, so I was wondering whats the best way to maintain existing build numbers after upgrade?  
Pls note we use default sqlite db.

---

<div class="post-metadata">

**Author:** ![foooocus](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/foooocus/32/3740_2.png) [@foooocus](https://drone.discourse.group/u/foooocus)\
**Post date:** [October 24, 2017, 2:44pm UTC](https://drone.discourse.group/t/maintain-build-number-after-upgrade-to-v0-8/9212/2 "2017-10-24T14:44:19Z")

</div>

@bradrydzewski appreciate for your suggestions here.

---

<div class="post-metadata">

**Author:** ![omerxx](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/omerxx/32/3956_2.png) [@omerxx](https://drone.discourse.group/u/omerxx)\
**Post date:** [October 28, 2017, 9:34pm UTC](https://drone.discourse.group/t/maintain-build-number-after-upgrade-to-v0-8/9212/3 "2017-10-28T21:34:03Z")

</div>

Hi,

I suggest you move away from using the inner DB, especially if you rely so bad on build numbers.  
You can migrate you DB to an external relations DB and then upgrade freely while using the same dataset.  
One question though - Why are you relying so badly on build numbers?

---

<div class="post-metadata">

**Author:** ![foooocus](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/foooocus/32/3740_2.png) [@foooocus](https://drone.discourse.group/u/foooocus)\
**Post date:** [October 30, 2017, 2:12pm UTC](https://drone.discourse.group/t/maintain-build-number-after-upgrade-to-v0-8/9212/4 "2017-10-30T14:12:04Z")

</div>

Thanks for the response,  
could you pls elaborate how its going to be different if I go with some other DB? If there are data changes, then its going to break existing DB no matter which one you use.

We use build numbers to version our dev build artifacts.

---

<div class="post-metadata">

**Author:** ![omerxx](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/omerxx/32/3956_2.png) [@omerxx](https://drone.discourse.group/u/omerxx)\
**Post date:** [October 30, 2017, 2:29pm UTC](https://drone.discourse.group/t/maintain-build-number-after-upgrade-to-v0-8/9212/5 "2017-10-30T14:29:04Z")

</div>

Hi, Maybe I wasn’t clear - I did not suggest using a different DB type, but using the external option instead of the internal one so that your DB and data are not impacted by any application / resources failure.

If the numbers of builds are that important you can hack it on your side by incrementing starting from the last build created with the old DB.  
Let’s say your last build was 86, and you start the use of a new DB, name your future build using the deployment plugin as such:  
`BUILD_NUMBER=$((${DRONE_BUILD_NUMBER}+86))`  
`version: <service-name>-$BUILD_NUMBER`

---

<div class="post-metadata">

**Author:** ![foooocus](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/foooocus/32/3740_2.png) [@foooocus](https://drone.discourse.group/u/foooocus)\
**Post date:** [October 30, 2017, 3:35pm UTC](https://drone.discourse.group/t/maintain-build-number-after-upgrade-to-v0-8/9212/6 "2017-10-30T15:35:03Z")

</div>

Ah, ok. Got it!  
Thanks for the solution, we plan to do the same thing as our default option but was wondering if there is anything provided by Drone on this.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [October 30, 2017, 4:02pm UTC](https://drone.discourse.group/t/maintain-build-number-after-upgrade-to-v0-8/9212/7 "2017-10-30T16:02:14Z")

</div>

We provide the ability to set the drone counter manually from the command line and api:

```nohighlight
drone repo update --build-counter=<number> <repo>

```

The below example would set the counter to 1234, which means the next build number for this repository would be 1235.

```nohighlight
drone repo update --build-counter=1234 octocat/hello-world

```

This command can only be executed by a drone system administrator.

---

<div class="post-metadata">

**Author:** ![foooocus](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/foooocus/32/3740_2.png) [@foooocus](https://drone.discourse.group/u/foooocus)\
**Post date:** [October 30, 2017, 4:18pm UTC](https://drone.discourse.group/t/maintain-build-number-after-upgrade-to-v0-8/9212/8 "2017-10-30T16:18:30Z")

</div>

Awesome! This is what I was looking for.  
Thanks @bradrydzewski!

---

<div class="post-metadata">

**Author:** ![ozbillwang](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/ozbillwang/32/3947_2.png) [@ozbillwang](https://drone.discourse.group/u/ozbillwang)\
**Post date:** [October 30, 2017, 10:22pm UTC](https://drone.discourse.group/t/maintain-build-number-after-upgrade-to-v0-8/9212/9 "2017-10-30T22:22:15Z")

</div>

Thanks, @bradrydzewski

I am looking for this feature as well.
