repro script:
echo 'Publishing module code:'
tee src/lib.rs <<EOF
use spacetimedb::{ReducerContext, Table};
#[spacetimedb::table(accessor = person, public)]
pub struct Person {
name: String,
}
#[spacetimedb::reducer]
pub fn add(ctx: &ReducerContext, name: String) {
ctx.db.person().insert(Person { name });
}
EOF
echo
echo 'Publishing module'
spacetime publish --delete-data -y
echo
echo 'Adding person'
spacetime call add Foo
echo
echo 'Current people:'
spacetime sql 'select * from person;'
echo
echo 'Updating module code:'
tee src/lib.rs <<EOF
use spacetimedb::{ReducerContext, Table};
#[spacetimedb::table(accessor = person, public)]
pub struct Person {
name: String,
#[default(123.4)]
number: f32,
}
#[spacetimedb::reducer]
pub fn add(ctx: &ReducerContext, name: String) {
ctx.db.person().insert(Person { name, number: 432.1 });
}
EOF
echo 'Publishing updated module'
spacetime publish -y
echo
echo 'Current people:'
spacetime sql 'select * from person;'
echo
The final output of this for me is:
name | number
-------+-----------------------------------
"Foo" | -0.000000000000000000000015881868
rather than the expected 123.4 value
repro script:
The final output of this for me is:
rather than the expected
123.4value