Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Generate table names #223

Closed
gaetschwartz opened this issue May 23, 2023 · 6 comments
Closed

[Suggestion] Generate table names #223

gaetschwartz opened this issue May 23, 2023 · 6 comments

Comments

@gaetschwartz
Copy link

It would be helpful if table names could be generates as well ! Something like

enum PrismaTables {
	table1("table_1"),
	table2("table_2");

	final String databaseName;
	PrismaTables(this.databaseName);
}
@medz
Copy link
Owner

medz commented May 23, 2023

@gaetschwartz This seems to be a requirement request, we need to talk about the necessity of the use case.

In addition, if you need to make a program like CRUD, you may need to use it, and you can also generate table fields.

Another, is it necessary for us to disclose DMMF, because DMMF contains more database information.

@gaetschwartz
Copy link
Author

Well, I was thinking about that and actually exposing DMMF is an option I really like! It would allow users to plug-in their own logic etc based on it.

@medz medz mentioned this issue May 24, 2023
7 tasks
@medz
Copy link
Owner

medz commented May 24, 2023

I understand, because I have similar needs, I added it to #216, the current available version I use https://pub.dev/packages/prisma_generator_helper to get DMMF, just write simple code, and then in schema Add new generators to .prisma.

But I'm taking your advice and adding dmmf to the default build in the next version.

@gaetschwartz
Copy link
Author

Thanks, I'll look into that ! Could you elaborate ? I'm not sure to understand your instructions ?

@medz
Copy link
Owner

medz commented May 24, 2023

`OnGenerate 'will pass in an instance of' GeneratorOptions' as a parameter, which contains DMMF. You only need to call the 'toJson' method to convert it into a JSON object. You can create a file that contains DMMF content.

@medz
Copy link
Owner

medz commented Nov 27, 2023

@gaetschwartz Already supported in v4 version

@medz medz closed this as completed Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants