evolu icon indicating copy to clipboard operation
evolu copied to clipboard

Add API for generated columns

Open steida opened this issue 1 year ago • 1 comments

With generated columns, SQLite can be used as a document database.

https://dgl.cx/2020/06/sqlite-json-support

steida avatar May 08 '24 19:05 steida

Just did a little digging into this to understand it a bit further, I think I identified the places we need to change

  1. a) we need to have either a Special Column Type like AlwaysGeneratedAs(TheTypeToBeUsedInEvoluLifeTime, 'the additional sqlite add/update column code') b) or some kind of other place to declare those columns during Schema Creation
  2. in validEvoluSchemaToDbSchema this needs to fill the sqlite column types / text currently in the Db we only use Blobs so this place should fill an array of "Type Of Column" , 95% will be blob, the rest is the AlwaysGeneratedAs Text
  3. in ensureDbSchema this Type Of Column needs to be used instead of blob

Whats also great about this kind of feature , this could also finally solve long going issue with a need of Union Types in Tables

Currently:

  • a union of types as a table is not possible in Evolu and Kysely (typing)

But, with this feature, I can have a payload json Union of 2 object types, each with its own type property and then I can have that type property be used as a top-level column using the generated column

So really a win/win here, one feature to solve a bunch of issues ^^

negue avatar Mar 06 '25 02:03 negue

Closing as this is no longer relevant—the new Evolu launches tomorrow. Feel free to reopen if it becomes relevant with the new Evolu.

steida avatar May 24 '25 18:05 steida