Custom Search

Tuesday, July 12, 2016

How to use tacker-db-manage to migrate database

1)
$ tacker-db-manage --config-file /etc/tacker/tacker.conf history
5f88e86b35c7 -> 22f5385a3d3f (head), Add status to vims
354de64ba129 -> 5f88e86b35c7, make VNFD/VNF/VIM name mandatory
b07673bb8654 -> 354de64ba129, set-mandatory-columns-not-null
c7cde2f45f82 -> b07673bb8654, set-status-type-tenant-id-length
6e56d4474b2a -> c7cde2f45f82, set-description-to-text
f958f58e5daa -> 6e56d4474b2a, blob-to-json-text
acf941e54075 -> f958f58e5daa, uuid consistency
5246a6bd410f -> acf941e54075, Add error_reason to device
24bec5f211c7 -> 5246a6bd410f, multisite_vim
2774a42c7163 -> 24bec5f211c7, Alter value in deviceattributes
12a57080b278 -> 2774a42c7163, remove service related
12a57080b277 -> 12a57080b278, Alter devices
5958429bcb3c -> 12a57080b277, Add Service related dbs
13c0e0661015 -> 5958429bcb3c, modify datatype of value
4c31092895b8 -> 13c0e0661015, add descrition to vnf
81ffa86020d -> 4c31092895b8, empty message
1c6b0d82afcd -> 81ffa86020d, rpc_proxy
-> 1c6b0d82afcd, add tables for tacker framework

2)
$ tacker-db-manage --config-file /etc/tacker/tacker.conf current
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
5f88e86b35c7

3)
$ tacker-db-manage --config-file /etc/tacker/tacker.conf revision
  Generating /opt/stack/tacker/tacker/db/migration/alembic_migrations/versions/2f2e337fc6c4_.py ... done

4)
$ tacker-db-manage --config-file /etc/tacker/tacker.conf upgrade 2f2e337fc6c4
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade 5f88e86b35c7 -> 22f5385a3d3f, Add status to vims
INFO  [alembic.runtime.migration] Running upgrade 22f5385a3d3f -> 2f2e337fc6c4, empty message

5)
$ tacker-db-manage --config-file /etc/tacker/tacker.conf history
22f5385a3d3f -> 2f2e337fc6c4 (head), empty message
5f88e86b35c7 -> 22f5385a3d3f, Add status to vims
354de64ba129 -> 5f88e86b35c7, make VNFD/VNF/VIM name mandatory
b07673bb8654 -> 354de64ba129, set-mandatory-columns-not-null
c7cde2f45f82 -> b07673bb8654, set-status-type-tenant-id-length
6e56d4474b2a -> c7cde2f45f82, set-description-to-text
f958f58e5daa -> 6e56d4474b2a, blob-to-json-text
acf941e54075 -> f958f58e5daa, uuid consistency
5246a6bd410f -> acf941e54075, Add error_reason to device
24bec5f211c7 -> 5246a6bd410f, multisite_vim
2774a42c7163 -> 24bec5f211c7, Alter value in deviceattributes
12a57080b278 -> 2774a42c7163, remove service related
12a57080b277 -> 12a57080b278, Alter devices
5958429bcb3c -> 12a57080b277, Add Service related dbs
13c0e0661015 -> 5958429bcb3c, modify datatype of value
4c31092895b8 -> 13c0e0661015, add descrition to vnf
81ffa86020d -> 4c31092895b8, empty message
1c6b0d82afcd -> 81ffa86020d, rpc_proxy
-> 1c6b0d82afcd, add tables for tacker framework

6)
$ tacker-db-manage --config-file /etc/tacker/tacker.conf current
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
2f2e337fc6c4 (head)

========================
1)
Migrate to head
$ tacker-db-manage --config-file /etc/tacker/tacker.conf upgrade head






1 comment: