SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Cannot define table with column named "read"

Open joshua-spacetime opened this issue 9 months ago • 5 comments

A user in the public discord ran into this issue.

Apparently if you define a table like:

#[table(name = mails, public)] 
#[derive(Clone)]
pub struct Mail {
    // #[primary_key]
    // #[auto_inc]
    pub mail_id: u32,
    pub read: bool,
}

you'll get an error in Unity about Read being defined multiple times.

joshua-spacetime avatar Mar 17 '25 19:03 joshua-spacetime

this is somewhat an API break because the CLI will generate code that is incompatible with the corresponding SDK changes

bfops avatar Mar 26 '25 20:03 bfops

This will need to go into a minor version bump.

bfops avatar Mar 26 '25 20:03 bfops

I'm on review for this so I'm assigning myself

jdetter avatar Apr 25 '25 17:04 jdetter

Apologies, I lost track of this with the Bitcraft stuff. @bfops , from this PR CLI-generated code will not change. This change is in roslyn-generated code, which is invisible to users. I don't know what this means for versioning. @jdetter , I think we should do ReadFields and WriteFields in a separate PR as it's going to require a separate implementation.

kazimuth avatar Apr 30 '25 17:04 kazimuth

I think we should do ReadFields and WriteFields in a separate PR as it's going to require a separate implementation.

Ok I'm fine with that 👍

jdetter avatar Apr 30 '25 17:04 jdetter

https://github.com/clockworklabs/SpacetimeDB/issues/3204 created for ReadFields and WriteFields

rekhoff avatar Aug 26 '25 22:08 rekhoff