castor

Generating sql "create table" scripts from mapping files

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.9.3
  • Fix Version/s: 1.1 M2
  • Component/s: JDO DDL generator
  • Labels:
    None
  • Environment:
    Operating System: All
    Platform: All
  • Bugzilla Id:
    959
  • Number of attachments :
    0

Description

I didn't find this in Castor yet, and I think that is handy to create the script
from the mapping files. It would either be used as a starting point to finetune
by hand, or as something that can be generated when needed, so one doesn't have
to to change both the mapping and the database by hand when the datamodel changes.

I made a first shot at it, using XSL stylesheets. It is very limited;

  • it has only been tested with two mappings on postgresql
  • it only knows quoting rules and some jdbc type -> database type rules for
    postgresql
  • it only works with non-complex identities (otherwise primary key declarations
    will be omitted)
  • it can only find the sql type of a foreign key column if the java class that
    it maps to is defined in the same mapping file, otherwise the type "integer"
    is assumed
  • it probably contains many bugs

Still I wanted to share it already, in case I don't continue working on it or
else to see if this is something that people find interesting.

Issue Links

Activity

Hide
erwin added a comment -

Created an attachment (id=114)
XSL stylesheet that generates "create table" commands

Show
erwin added a comment - Created an attachment (id=114) XSL stylesheet that generates "create table" commands
Hide
erwin added a comment -

Created an attachment (id=115)
XSL styesheet that generated "DROP TABLE" commands from mapping file

Show
erwin added a comment - Created an attachment (id=115) XSL styesheet that generated "DROP TABLE" commands from mapping file
Hide
Ralf Joachim added a comment -

Le Duc Bao have worked during Google summer of Code 2006 at a generator for DDL scripts. At the end of the project the generator is almost finished but needs some more testing, fine tuning and integration into castor codebase. I will create subtasks for the issues that should be done to integrate ddlgen into castor codebase and independed issues where I think it should be worked on at the later point in time.

Having said that I have created a jira component 'JDO DDL generator'for all stuff related to the generator.

Show
Ralf Joachim added a comment - Le Duc Bao have worked during Google summer of Code 2006 at a generator for DDL scripts. At the end of the project the generator is almost finished but needs some more testing, fine tuning and integration into castor codebase. I will create subtasks for the issues that should be done to integrate ddlgen into castor codebase and independed issues where I think it should be worked on at the later point in time. Having said that I have created a jira component 'JDO DDL generator'for all stuff related to the generator.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: