Add nested_depth column to stack table

Adds a new nested_depth column, with a migration which traverses the
tree via owner_id for existing stacks and populates the appropriate depth.

This is a static, create-time depth, which should be sufficient for our
usage since nested stacks can never be moved within the tree.

The reason for this change is to allow depth validation (e.g enforcing
max_nested_stack_depth) when creating nested stacks via RPC calls,
without incurring the cost of loading every parent stack in the tree
to count the depth.  It may also allow some future optimisations of
some of the recently added API calls which do recursive introspection
considering a nested_depth parameter.

This is a step towards decoupling nested stacks from the current
usage of parent_resource and associated runtime introspection of the
parent stack, and as such the current StackResource is modified to
use the new scheme (required so post-migration we don't end up with
invalid nested_depth data in the DB).

Change-Id: I727651ff738ae668a3f21b374fc7a1b48f6e4777
blueprint: decouple-nested
Merge "Add nested_depth column to stack table"