Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think data definition schema needs to have better type system which not only defines database schema, but contains all necessary data and allows annotations to be able to generate quality language specific code from it. Single source of truth for data structure, which is used both by database and code.


I see some value in that, but in my experience it's actually the queries that inform much of what the table shema and indexes should look like. Especially when joins and/or ordering are involved, it's the details about what the application wants to extract from the DB that are important, and I'd rather have those details at the code's call site not at the schema definition, because if/when they change or are removed it will be clearer from the context.


What I'm proposing doesn't change that. It's just to information necessary to keep strongly typed data in sync between the database and dtos. To help with serialization and mapping. Compile time type safety.

When querying db for schema you don't get enough information to be able to generate very good code in all cases.

Language-first way (define schema in language and generate database schema/migrations) ties you to just one language. And usually these tools don't support using all database features.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: