olsh / datagrip-poco-generator

An extension for IntelliJ-based IDEs (DataGrip, Rider, etc.) to generate POCO (C#) classes from a database
MIT License
64 stars 25 forks source link

How to install #2

Closed MarcoGaribaldi closed 6 years ago

MarcoGaribaldi commented 6 years ago

Hi.

I am new to DataGrip, so forgive me if I am missing something obvious.

I am not sure to understand your instruction on how to install the script. You say:

Copy Generate POCO.groovy file to IDE -> Files -> Scratches and Consoles -> Extensions -> Database Tools and SQL -> schema.

Is that the file path on disk? I can't find folders with those names. I have tried copying the script to C:\Users\username.DataGrip10\config\extensions\com.intellij\schema

where the Generate POJOs.cli is. After I do this I can see the script in the Scripted Extensions menu of DataGrip. However, when I execute the script I get this exception:

Script execution error groovy.lang.MissingMethodException: No signature of method: com.intellij.util.containers.JBIterable$13.reduce() is applicable for argument types: (java.util.ArrayList, Script4$_calcFields_closure4) values: [[] ... etc.

I suppose I am doing something wrong. Any hint?

olsh commented 6 years ago

Hi @MarcoGaribaldi ,

Copy Generate POCO.groovy file to IDE -> Files -> Scratches and Consoles -> Extensions -> Database Tools and SQL -> schema.

There is Files panel in DataGrip IDE, you can open it with alt + 2 or with the menu at the bottom left of DataGrip (see the screenshot attached) image

Here is how the Files panel looks like image

where the Generate POJOs.cli

Well, you don't need Generate POJOs.cli, you should use Generate POCO.groovy.

Which version of DataGrip are you using?

MarcoGaribaldi commented 6 years ago

Thank you for your help, Oleg.

I see why I was confused. I use ver. 1.0.1 and the folder structure is different. This is how it looks:

datagripfolders

With ver. 1.0.1 I get the error reported before.

P.S.: ignore the typo in the file name. I have fixed that after taking the screenshot.

olsh commented 6 years ago

So, you manage to generate C# classes? If the groovy script still fails, you can try the old clj script https://github.com/olsh/datagrip-poco-generator/blob/master/deprecated/Generate%20POCO.clj

MarcoGaribaldi commented 6 years ago

The deprecated script works. The new one doesn't.

olsh commented 6 years ago

Probably there is an incompatibility between versions of DataGrip, that's why the new groovy script doesn't work with 1.0.1 I've tested the groovy script only with DataGrip 2017.3

MarcoGaribaldi commented 6 years ago

Yes, that's what I figured. Well, I am happy with the old script. :)

Thank you for your help.

olsh commented 6 years ago

Glad to help. Can we close the issue or you have questions?

MarcoGaribaldi commented 6 years ago

Oops! Closed. :)