db migrator

From: Tore Halset (halse..vv.ntnu.no)
Date: Wed Oct 17 2007 - 09:07:55 EDT

  • Next message: Ahmed Mohombe: "Re: db migrator"

    Hello.

    I want to be able to migrate schema changes from a DataMap to a
    database. Mainly for two reasons.
      1) Make it easier for DBAs and developers to keep track of DB
    related changes in a project.
      2) Make it simpler for developers to keep the db schema in sync
    with the model.

    My current implementation has support for adding tables, add/drop
    columns, setting null/not null and changing text length. The unit
    tests works on PostgreSQL, MS SQL Server and Derby.

    Implementation details:
      * Each DbAdapter can create a DbMergerFactory that are able to
    create DbMergerToken for various tasks like AddColumn and SetAllowNull.
      * A DbMerger class that uses DbLoader to create a DataMap from the
    db and then create a List of needed DbMergerTokens that can be
    applied to the database to get in sync.

    Here are some screenshots from the modeler.
    http://www.pvv.ntnu.no/~halset/tmp/caymigr/

    TODO:
      * Support more databases. Will need help on this one as I do not
    have access to that many.
      * Default value for not null columns.
      * Support more tasks like adding/dropping forreign keys, changing
    primary keys and so on.

    We have discussed this before, but I am not able to find a suitable
    jira task for it.

    Is this something you want for cayenne as well? Is it ok for you if I
    start checking in after M2?

    Regards,
      - Tore.



    This archive was generated by hypermail 2.0.0 : Wed Oct 17 2007 - 09:10:47 EDT