drift
drift copied to clipboard
[Suggestion - .drift files] Extend base data class when only 1 table.*
I have a a lot of tables where I have queries like:
SELECT
table1.**,
table2.**,
table3.**
but what I'd really like to do is have:
SELECT
table1.*,
table2.**,
table3.**
and be able to pass the class around as if it was just table1
I see the advantage of this, and we can do this without a breaking change which is nice, but I'm a bit unsure about what it means to "extend" a dataclass. In particular, how should inserts / updates with this result set behave? Do we just throw the other columns away or do we just forbid calling toColumns/toCompanion on these classes?
Either approach sounds somewhat reasonable which is a sign I didn't think this through enough :sweat_smile:
Is this just about avoiding the .table1 call somewhere or is there something that I'm missing?
Yea it's basically to avoid doing things like settingResult.settings.whatever it's something I can live with but it'd just be nice not to.
Id lean towards throwing the other columns away on insert.