3

I have an existing Schema definition in MySql database. I created the schema using MySql Workbench.

I wish to access the schema from my Lift-Scala-Squeryl code. I know that a simple way would be to manually define the schema structure using Squeryl data objects.

Is there an automated way to generate Squeryl data objects out of existing MySql schema?

I've found the following general question, but I'm sure there can be a way to generate a naive structure, although not accurate, it will allow a better starting point for the manual work.

Thanks, David.

Community
  • 1
  • 1
David Raviv
  • 397
  • 3
  • 10

1 Answers1

1

Max, Squeryl's creator, had suggested that this would be a good idea a while back. Here is the google group discussion.

You may not be too pleased with me for this, but I think I talked him out of it :) So, to my knowledge, there isn't a way to do it. Besides the issues I pointed out in that thread, the fact that Squeryl can work in multiple modes (primitive types, custom types, lift record types) it would be a difficult thing to do and get right for everyone.

Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
Dave Whittaker
  • 3,102
  • 13
  • 14
  • thanks for pointing out this thread. I agree with most of the arguments raised in the discussion. Though, I still think that a naive implementation that will be a base for manual work is blessed. I'm aiming at a procedure that will be manually triggered and fully controlled by the developer. It would be much easier to modify the generated code than to write it from scratch... – David Raviv Mar 05 '12 at 05:29
  • When you say that you are aiming for it, do you mean that you are looking for an existing solution or planning on developing one? Either way, I'd encourage you to bring this up on the Squeryl group. – Dave Whittaker Mar 05 '12 at 15:47
  • I'm looking for an existing tool. I currently have an existing MySql schema and facing the need to manually write the equivalent Squeryl code. It would be nice having a tool that will take me part of the way through. – David Raviv Mar 06 '12 at 08:02
  • Note also that you can do your job the other way: create a squeryl definition and initialize the DB with it. (No matter postgres or h2 or mysql or whatever.) – VasiliNovikov Jun 26 '13 at 05:42