You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Tore Halset <ha...@pvv.ntnu.no> on 2007/10/17 15:07:55 UTC
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.
Re: db migrator
Posted by Tore Halset <ha...@pvv.ntnu.no>.
Hello.
First check in done. Should work on hsql, psql, derby and ms sql server.
I have also included the request from Tobias regarding migrating both
ways. It is possible to switch direction for a merge token. So a
"Create Table" "To DB" becoms a "Drop Table" "To Model". See the
screenshots:
http://www.pvv.ntnu.no/~halset/tmp/caymigr/
Still lots of things to do, but the basic thing works.
Regards,
- Tore.
Re: db migrator
Posted by Andrus Adamchik <an...@objectstyle.org>.
Sweet! I just tagged M2, so the trunk is open for check ins.
Andrus
On Oct 17, 2007, at 4:07 PM, Tore Halset wrote:
> 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.
>
Re: db migrator
Posted by Tore Halset <ha...@pvv.ntnu.no>.
Hello.
I want comments as well. Adding merging of comments should not be a
big issue after cayenne gets basic support for comments.
- Tore.
On Oct 17, 2007, at 15:25 , Ahmed Mohombe wrote:
> Please add support for comments: add/edit/remove comment (on table
> and column) .
> (AFAIK Cayenne and CM will support this too - saw a working demo
> from Malcolm somewhere).
Re: db migrator
Posted by Ahmed Mohombe <am...@yahoo.com>.
> 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.
Please add support for comments: add/edit/remove comment (on table and column) .
(AFAIK Cayenne and CM will support this too - saw a working demo from Malcolm somewhere).
> Is this something you want for cayenne as well?
Of course we want :).
> Is it ok for you if I
> start checking in after M2?
Sure. I'm very curious to see how it works.
Ahmed.
Re: db migrator
Posted by Ahmed Mohombe <am...@yahoo.com>.
> Is there any chance to see this driven from the other side round too.
> Like changes to the DB have 'Reverse Engineer Database schema' merge
> changes into the existing mapping in the modeler.
+1 . This is even a more common scenario for existing applications
with DBs that have a long lifetime behind.
Also in many companies the "(ERD -> )DB -> (Java)Model" approach is the de facto standard.
Ahmed.
Re: db migrator
Posted by Tore Halset <ha...@pvv.ntnu.no>.
Hello.
That is a good idea indeed.
- Tore.
On Oct 18, 2007, at 1:08 , tobias.schoessler@unodc.org wrote:
> very nice. Is there any chance to see this driven from the other
> side round too. Like changes to the DB have 'Reverse Engineer
> Database schema' merge changes into the existing mapping in the
> modeller.
> I am craving for this for some time.
Re: db migrator
Posted by to...@unodc.org.
very nice. Is there any chance to see this driven from the other side round too. Like changes to the DB have 'Reverse Engineer Database schema' merge changes into the existing mapping in the modeller.
I am craving for this for some time.
Tore Halset <ha...@pvv.ntnu.no> wrote:
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.
___
sent via WebmailLight 3.1.11