RepoDB icon indicating copy to clipboard operation
RepoDB copied to clipboard

Question: Schema creation / validation

Open mdissel opened this issue 4 years ago • 5 comments

Is there support to convert a mapping of class to a Create Table sql statement?

Thanks

mdissel avatar Dec 14 '20 11:12 mdissel

@mdissel - no, this is not a feature of this library. If you can provide more context to this, maybe I can refer you to some good and awesome OSS libraries. Are you up for DB Migration?

mikependon avatar Dec 14 '20 11:12 mikependon

Context is creating/dropping tables, views, indexes functions, etc. (using postgresql) (preferrable re-using the attribute mapping from repodb )...

Thanks

mdissel avatar Dec 14 '20 13:12 mdissel

Have you tried exploring the https://github.com/fluentmigrator/fluentmigrator?

mikependon avatar Dec 14 '20 13:12 mikependon

Yes, but does it handle the class /field mapping from repodb attributes?

mdissel avatar Dec 14 '20 20:12 mdissel

@mdissel - I would humbly say, RepoDB field mapping attribute is simple and is not extensive/informative enough to construct the schemas. I would suggest, you should not rely on it, instead, use any kind of tool that is designed to cater this scenario / does the migration (i.e: Code First, Model First or even the DB First), as any kind of migration features will never be a part of RepoDB library.

Though, in RepoDB, you can extract the properties and fields via the use of helper classes like FieldCache and PropertyCache. Then, you can construct a migration through the extracted information from specific model, and maybe inject that to the FluentMigrator? It is doable, but it seems for me, a tedious one to maintain and is subtle to rely on.

mikependon avatar Dec 15 '20 05:12 mikependon