Refactor, migrate and clean meta_terms table

Squashed commit of the following:

commit 6505dd09bb52cb6ed80f2f6708287a9a104e428f
Author: Thomas Schank <DrTom@schank.ch>
Date:   Wed Apr 30 18:37:33 2014 +0200

     ... change a few types ...

commit 80e761f3cf62ae55b5fcde75c5e89df80e06071d
Author: Thomas Schank <DrTom@schank.ch>
Date:   Wed Apr 30 17:38:31 2014 +0200

     ... maybe  ...

commit c438b3ef8ef09d4c87a2bb4654871882c03b281a
Author: Thomas Schank <DrTom@schank.ch>
Date:   Wed Apr 30 17:30:34 2014 +0200

     ...

commit 292cd4740ac7467bc998cd5329d78d67e5465cd4
Author: Thomas Schank <DrTom@schank.ch>
Date:   Wed Apr 30 17:03:13 2014 +0200

    ... fix creation of meta_term through meta data

commit 2dcbcc685b2df7aa4b827768c40898dad2256bbd
Author: Thomas Schank <DrTom@schank.ch>
Date:   Wed Apr 30 16:18:11 2014 +0200

     fix the to json query

commit 8e586a4d85629a37928769a327f8e344b3d6be99
Author: Thomas Schank <DrTom@schank.ch>
Date:   Wed Apr 30 16:12:26 2014 +0200

    fix factory

commit 1def4b917bb114d0c326ad8e48f4b27bac2b0237
Author: Thomas Schank <DrTom@schank.ch>
Date:   Wed Apr 30 16:10:08 2014 +0200

    ... Minor structural changes

commit 5dd6caf00224012bbecf1d776d591a2e865aa5f9
Author: Thomas Schank <DrTom@schank.ch>
Date:   Wed Apr 30 16:01:59 2014 +0200

     ...

commit b96b4c1fbdb5ec97fe2cb5e89c61fc4a5613b75c
Author: Thomas Schank <DrTom@schank.ch>
Date:   Wed Apr 30 15:38:49 2014 +0200

    Refactoring meta_terms table