* spacetime local clear subcommand for deleting local database
* Addressing some feedback from pervious PR
* Addressing Zeke's feedback
* One more refactor based on Zeke's feedback
---------
Co-authored-by: John Detter <no-reply@boppygames.gg>
* `MutTxDatastore::table_name_from_id_mut_tx`: return `Cow<str>`
This commit changes the `MutTxDatastore` trait's method `table_name_from_id_mut_tx` method
to return a `Cow<str>` rather than an `&str`,
abstracting away whether the underlying datastore stores a contiguous `str` table name.
As with PR #691, our current datastore has a `String` to which it can return an `&str`,
but the mem-arch-prototype stores a new representation
where strings are not necessarily contiguous,
so it must extract the table name and return an owned `String` rather than an `&str`.
* Rewrite a horrible memoizing branch into the entry API
* Generate now has a clear flag which will clear the output directory
before generating files
* Some change - will explain in PR description.
* Only delete files which were generated by SpacetimeDB
* Slightly better pattern matching to reduce false negatives or positives
* Added force command for CI
* Fix for help section
* Update crates/cli/src/subcommands/generate/mod.rs
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>
* Update crates/cli/src/subcommands/generate/mod.rs
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>
---------
Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: John Detter <no-reply@boppygames.gg>
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
Our current datastore stores `ProductValue`s,
and thus can return references to them,
but the prototype new mem-arch stores a new flattened representation,
and so cannot return `&'tx ProductValue`.
In preparation for the new storage format,
this commit changes the datastore traits to return `Cow<'tx, ProductValue>`,
so that the new implementation will be able to perform conversion
and return `Cow::Owned(ProductValue::from(internal_repr))`.
* Committing script for building nuget package
* Script replaced with github action workflow
* On pull requests as well
* Bump version
* Updated build config
* Ready to test
---------
Co-authored-by: John Detter <no-reply@boppygames.gg>
* Changes merged in from v0.7.1-beta
* Small bug fix from stream
* Updated logo file
* Small bug fix related to OnBeforeDelete callback
* Upgraded version to 0.7.2
---------
Co-authored-by: John Detter <no-reply@boppygames.gg>
The `TableDef` type is nominally the same for the database schema and
the schema description from a module, but only the former contains
information about indexes and sequences. This would cause all indexes to
be dropped when updating a database, because none of the existing
indexes would ever be present in the module's schema definition.
It is unclear if the functionality could be recovered, but it does not
seem to be robust without a dedicated schema manipulation language
either way.
We still want to allow module updates which do not change the schema at
all, or only introduce new tables, as otherwise users may be forced to
re-run expensive initialisation steps even though they only introduced
debugging code or somesuch.
To make this work, a somewhat dubious equivalence comparison is made,
comparing the constraint definitions in a way deemed correct in post-hoc
analysis.
Access to the DatabaseInstanceContextController is racy, as another
`get` may occur while a new DatabaseInstanceContext is initializing.
Because the database acquires filesystem locks, this will lead to
errors.
To fix this, the context value is wrapped in a OnceCell.
Closes#623.
Before this patch query optimization was entirely syntax driven.
Now that we keep table size metrics we can be somewhat data driven.
This patch improves index joins,
by using row counts to determine the index side and the probe side.
This patch removes the invalid translation from IndexJoin to JoinExpr,
since there is no way to capture the implicit projection of IndexJoin.
Instead we translate from IndexJoin directly to QueryExpr.
Before this change we would swap the index and probe sides if
(1) the index side was replaced with a delta table,
(2) the probe side had an index defined on the join field, and
(3) the index side was the return side.
After this change we swap if
(1) the index side has been replaced with a delta table, and
(2) the probe side has an index defined on the join field.
We no longer place restrictions on the rows that are returned.
* refactor(subscriptions): Support returning either side of a join
Before this patch we made reference to the "lhs" and the "rhs" of an index join,
in the context of incremental evaluation.
This patch further generalizes the incremental evaluation of index joins,
by replacing such references with either the probe side or the index side.
This is in preparation for adding more types of incremental evaluation plans.
* test: Move incremental eval compilation tests to subscription module
As usual, NuGet / MSBuild behaving differently for local projects vs published ones causes build issues that are not revealed by testing...
This is published to NuGet now and verified to work on an empty project.
Also changed the way `SpacetimeDB.Runtime.{props,targets}` are referenced locally by test projects by moving them to `Directory.Build.{props,targets}` at the top level of `modules/` directory. This should simulate behaviour of published NuGet packages a bit more closely - in particular, I verified that it can reproduce the bug in question before the fix, while the previous `<Import />` approach succeeded regardless - and also makes it easier to share the same configs between multiple projects.
* Export enum options as objects/functions
Thanks to that devs could now use it more intuitively, similarly to
Rust, for example:
let role = Role.Admin; // it returns { tag: "Admin", value: undefined };
let role1 = Role.Custom("Foo") // returns { tag: "Custom", value: "Foo" };
* 64 bit ints need to be represented as BigInt, not number
In JS all numbers are 64bit floats, but that means integers are only up
to 53 bits. Thus any 64+ bits integers need to be handled as BigInts
* Use camel case for product names
* Don't automatically register reducers and components
* Improve reducers and components
* Use this.db for tables
* Fix u64 and i64 to be a BigInt
* Table proxy changes
* Clippy
* Remove some of the reducer/table methods from autogen
Some of the methods were moved to the parent classes
* Remove _tableProxy import
* Remove count() and all() from typescript generation
---------
Signed-off-by: Piotr Sarnacki <drogus@gmail.com>
Because we build our docker images in more than one job, they are also
pushed as separate images. This commit adds a script that will merge the
images into a multiplatform manifest