From a802e33062a63c433dd673d067e29ed93b355ef5 Mon Sep 17 00:00:00 2001 From: rain Date: Fri, 10 Jul 2026 08:10:50 -0400 Subject: [PATCH 1/4] docs: update delete-data flag examples --- .../00100-intro/00100-getting-started/00500-faq.md | 8 ++++---- .../00300-unity-tutorial/00300-part-2.md | 6 +++--- .../00300-unity-tutorial/00400-part-3.md | 8 ++++---- .../00300-unity-tutorial/00500-part-4.md | 4 ++-- .../00400-unreal-tutorial/00300-part-2.md | 6 +++--- .../00400-unreal-tutorial/00400-part-3.md | 10 +++++----- .../00400-unreal-tutorial/00500-part-4.md | 4 ++-- .../00500-godot-tutorial/00300-part-2.md | 6 +++--- .../00500-godot-tutorial/00400-part-3.md | 8 ++++---- .../00500-godot-tutorial/00500-part-4.md | 4 ++-- .../00100-databases/00300-spacetime-publish.md | 2 +- .../00500-migrations/00200-automatic-migrations.md | 4 ++-- .../00100-how-to/00100-deploy/00100-maincloud.md | 2 +- .../00100-cli-reference/00300-spacetime-json.md | 2 +- 14 files changed, 37 insertions(+), 37 deletions(-) diff --git a/docs/docs/00100-intro/00100-getting-started/00500-faq.md b/docs/docs/00100-intro/00100-getting-started/00500-faq.md index abbbc177437..b96cd4f2f1f 100644 --- a/docs/docs/00100-intro/00100-getting-started/00500-faq.md +++ b/docs/docs/00100-intro/00100-getting-started/00500-faq.md @@ -221,7 +221,7 @@ conn.subscriptionBuilder().subscribe( ### How do I handle schema migrations? -When you publish an updated module, SpacetimeDB compares the new schema with the existing one and performs automatic migrations for compatible changes (adding tables, adding columns with defaults, etc.). For breaking changes, you may need to publish with `--delete-data` during development. See [Automatic Migrations](../../00200-core-concepts/00100-databases/00500-migrations/00200-automatic-migrations.md) for details on what changes are supported. +When you publish an updated module, SpacetimeDB compares the new schema with the existing one and performs automatic migrations for compatible changes (adding tables, adding columns with defaults, etc.). For breaking changes, you may need to publish with `--delete-data=always` during development. See [Automatic Migrations](../../00200-core-concepts/00100-databases/00500-migrations/00200-automatic-migrations.md) for details on what changes are supported. ### How do I add a column to an existing table? @@ -261,10 +261,10 @@ Yes. When you `spacetime publish` an update, SpacetimeDB hot-swaps the module co ### How do I clear my database? -Use the `-c` (or `--delete-data`) flag when publishing: +Use the `-c always` (or `--delete-data=always`) option when publishing: ```bash -spacetime publish my-app -c +spacetime publish my-app -c always ``` This deletes all data and re-runs the `init` reducer. @@ -291,7 +291,7 @@ If your module's `init` reducer panics (for example, due to a unique constraint ### How do I reset my database during development? -Use `spacetime publish my-app --delete-data` to clear all data and republish. Or use `spacetime dev`, which handles this automatically with the `--delete-data=on-conflict` flag. +Use `spacetime publish my-app --delete-data=always` to clear all data and republish. Or use `spacetime dev`, which handles this automatically with the `--delete-data=on-conflict` flag. ### I got a weird error when compiling my module! diff --git a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00300-part-2.md b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00300-part-2.md index 033bd7ed2ea..6cf56341ba5 100644 --- a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00300-part-2.md +++ b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00300-part-2.md @@ -587,7 +587,7 @@ The `ReducerKind.ClientConnected` argument to the `SpacetimeDB.Reducer` attribut > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `ReducerKind.Init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. +> - `ReducerKind.Init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. > - `ReducerKind.ClientConnected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `Sender` value of the `ReducerContext`. > - `ReducerKind.ClientDisconnected` - Called when a user disconnects from the SpacetimeDB database. @@ -607,7 +607,7 @@ The `client_connected` argument to the `spacetimedb::reducer` macro indicates to > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. +> - `init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. > - `client_connected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `sender` value of the `ReducerContext`. > - `client_disconnected` - Called when a user disconnects from the SpacetimeDB database. @@ -626,7 +626,7 @@ The `SPACETIMEDB_CLIENT_CONNECTED` macro indicates to SpacetimeDB that this is a > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `SPACETIMEDB_INIT` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. +> - `SPACETIMEDB_INIT` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. > - `SPACETIMEDB_CLIENT_CONNECTED` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `sender` value of the `ReducerContext`. > - `SPACETIMEDB_CLIENT_DISCONNECTED` - Called when a user disconnects from the SpacetimeDB database. diff --git a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00400-part-3.md b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00400-part-3.md index fc5b6ae572c..570c5a50d0b 100644 --- a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00400-part-3.md +++ b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00400-part-3.md @@ -16,7 +16,7 @@ This progressive tutorial is continued from [part 2](./00300-part-2.md). -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `Init` reducer. SpacetimeDB calls the `Init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `Init` reducer. SpacetimeDB calls the `Init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `Connect` reducer. @@ -85,7 +85,7 @@ We also added two helper functions so we can get a random range as either a `int -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -161,7 +161,7 @@ In this reducer, we are using the `world_size` we configured along with the `Red -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -898,7 +898,7 @@ SPACETIMEDB_CLIENT_DISCONNECTED(disconnect, ReducerContext ctx) { Finally, publish the new module to SpacetimeDB with this command: ```sh -spacetime publish --server local blackholio --delete-data +spacetime publish --server local blackholio --delete-data=always ``` Deleting the data is optional in this case, but in case you've been messing around with the module we can just start fresh. diff --git a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00500-part-4.md b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00500-part-4.md index bfc58fc0ded..bb7fb24b245 100644 --- a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00500-part-4.md +++ b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00500-part-4.md @@ -522,7 +522,7 @@ ctx.db[move_all_players_timer].insert(MoveAllPlayersTimer{ Republish your module with: ```sh -spacetime publish --server local blackholio --delete-data +spacetime publish --server local blackholio --delete-data=always ``` Regenerate your server bindings with: @@ -861,7 +861,7 @@ Notice that the food automatically respawns as you vaccuum them up. This is beca ## Connecting to Maincloud -- Publish to Maincloud `spacetime publish --server maincloud --delete-data` +- Publish to Maincloud `spacetime publish --server maincloud --delete-data=always` - `` This name should be unique and cannot contain any special characters other than internal hyphens (`-`). You will have to update the database name in `blackholio-server/spacetime.local.json` to match. - Update the URL in the Unity project to: `https://maincloud.spacetimedb.com` - Update the module name in the Unity project to ``. diff --git a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00300-part-2.md b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00300-part-2.md index a592e63bfda..3d43ad8c38b 100644 --- a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00300-part-2.md +++ b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00300-part-2.md @@ -580,7 +580,7 @@ The `ReducerKind.ClientConnected` argument to the `SpacetimeDB.Reducer` attribut > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `ReducerKind.Init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. +> - `ReducerKind.Init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. > - `ReducerKind.ClientConnected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `Sender` value of the `ReducerContext`. > - `ReducerKind.ClientDisconnected` - Called when a user disconnects from the SpacetimeDB database. @@ -600,7 +600,7 @@ The `client_connected` argument to the `spacetimedb::reducer` macro indicates to > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. +> - `init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. > - `client_connected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `sender` value of the `ReducerContext`. > - `client_disconnected` - Called when a user disconnects from the SpacetimeDB database. @@ -619,7 +619,7 @@ The `SPACETIMEDB_CLIENT_CONNECTED` macro indicates to SpacetimeDB that this is a > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `SPACETIMEDB_INIT` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. +> - `SPACETIMEDB_INIT` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. > - `SPACETIMEDB_CLIENT_CONNECTED` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `sender` value of the `ReducerContext`. > - `SPACETIMEDB_CLIENT_DISCONNECTED` - Called when a user disconnects from the SpacetimeDB database. diff --git a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00400-part-3.md b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00400-part-3.md index 1b388814d96..74d7bba4ced 100644 --- a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00400-part-3.md +++ b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00400-part-3.md @@ -16,7 +16,7 @@ This progressive tutorial is continued from [part 2](./00300-part-2.md). -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `Init` reducer. SpacetimeDB calls the `Init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `Init` reducer. SpacetimeDB calls the `Init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `Connect` reducer. @@ -85,7 +85,7 @@ We also added two helper functions so we can get a random range as either a `int -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -161,7 +161,7 @@ In this reducer, we are using the `world_size` we configured along with the `Red -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -894,13 +894,13 @@ SPACETIMEDB_CLIENT_DISCONNECTED(disconnect, ReducerContext ctx) { Finally, publish the new module to SpacetimeDB with this command: ```sh -spacetime publish --server local blackholio --delete-data +spacetime publish --server local blackholio --delete-data=always ``` Deleting the data is optional in this case, but in case you've been messing around with the module we can just start fresh. :::note -When using `--delete-data`, SpacetimeDB will prompt you to confirm the deletion. Enter **y** and press **Enter** to proceed. +When using `--delete-data=always`, SpacetimeDB will prompt you to confirm the deletion. Enter **y** and press **Enter** to proceed. ::: ### Creating the Arena diff --git a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00500-part-4.md b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00500-part-4.md index 4cb494183c2..a6a26a08526 100644 --- a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00500-part-4.md +++ b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00500-part-4.md @@ -520,7 +520,7 @@ ctx.db[move_all_players_timer].insert(MoveAllPlayersTimer{ Republish your module with: ```sh -spacetime publish --server local blackholio --delete-data +spacetime publish --server local blackholio --delete-data=always ``` Regenerate your server bindings with: @@ -917,7 +917,7 @@ Notice that the food automatically respawns as you vaccuum them up. This is beca ## Connecting to Maincloud -- Publish to Maincloud `spacetime publish --server maincloud --delete-data` +- Publish to Maincloud `spacetime publish --server maincloud --delete-data=always` - `` This name should be unique and cannot contain any special characters other than internal hyphens (`-`). - Update the URL in the Unreal project to: `https://maincloud.spacetimedb.com` - Update the module name in the Unreal project to ``. diff --git a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00300-part-2.md b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00300-part-2.md index 845219c5e26..e061919b0c6 100644 --- a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00300-part-2.md +++ b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00300-part-2.md @@ -586,7 +586,7 @@ The `ReducerKind.ClientConnected` argument to the `SpacetimeDB.Reducer` attribut > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `ReducerKind.Init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. +> - `ReducerKind.Init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. > - `ReducerKind.ClientConnected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `Sender` value of the `ReducerContext`. > - `ReducerKind.ClientDisconnected` - Called when a user disconnects from the SpacetimeDB database. @@ -606,7 +606,7 @@ The `client_connected` argument to the `spacetimedb::reducer` macro indicates to > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. +> - `init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. > - `client_connected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `sender` value of the `ReducerContext`. > - `client_disconnected` - Called when a user disconnects from the SpacetimeDB database. @@ -625,7 +625,7 @@ The `SPACETIMEDB_CLIENT_CONNECTED` macro indicates to SpacetimeDB that this is a > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `SPACETIMEDB_INIT` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. +> - `SPACETIMEDB_INIT` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. > - `SPACETIMEDB_CLIENT_CONNECTED` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `sender` value of the `ReducerContext`. > - `SPACETIMEDB_CLIENT_DISCONNECTED` - Called when a user disconnects from the SpacetimeDB database. diff --git a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00400-part-3.md b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00400-part-3.md index 0a4586a5216..2425f9b8d83 100644 --- a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00400-part-3.md +++ b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00400-part-3.md @@ -16,7 +16,7 @@ This progressive tutorial is continued from [part 2](./00300-part-2.md). -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `Init` reducer. SpacetimeDB calls the `Init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `Init` reducer. SpacetimeDB calls the `Init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `Connect` reducer. @@ -85,7 +85,7 @@ We also added two helper functions so we can get a random range as either a `int -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -161,7 +161,7 @@ In this reducer, we are using the `world_size` we configured along with the `Red -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -898,7 +898,7 @@ SPACETIMEDB_CLIENT_DISCONNECTED(disconnect, ReducerContext ctx) { Finally, publish the new module to SpacetimeDB with this command: ```sh -spacetime publish --server local blackholio --delete-data +spacetime publish --server local blackholio --delete-data=always ``` Deleting the data is optional in this case, but in case you've been messing around with the module we can just start fresh. diff --git a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00500-part-4.md b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00500-part-4.md index 71eff102a9c..e8b55a1bdc7 100644 --- a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00500-part-4.md +++ b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00500-part-4.md @@ -522,7 +522,7 @@ ctx.db[move_all_players_timer].insert(MoveAllPlayersTimer{ Republish your module with: ```sh -spacetime publish --server local blackholio --delete-data +spacetime publish --server local blackholio --delete-data=always ``` Regenerate your server bindings with: @@ -844,7 +844,7 @@ Notice that the food automatically respawns as you vaccuum them up. This is beca ## Connecting to Maincloud -- Publish to Maincloud `spacetime publish --server maincloud --delete-data` +- Publish to Maincloud `spacetime publish --server maincloud --delete-data=always` - `` This name should be unique and cannot contain any special characters other than internal hyphens (`-`). You will have to update the database name in `blackholio-server/spacetime.local.json` to match. - Update the URL in the Main node to: `https://maincloud.spacetimedb.com` - Update the database name in the Main node to ``. diff --git a/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md b/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md index f8aaf847553..5e2f40b025c 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md +++ b/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md @@ -95,7 +95,7 @@ If this publish is a major upgrade from 1.x to 2.0, read [1.x to 2.0 Upgrade Not To completely reset your database and delete all data: ```bash -spacetime publish --delete-data +spacetime publish --delete-data=always ``` ⚠️ **Warning:** This permanently deletes all data in your database! diff --git a/docs/docs/00200-core-concepts/00100-databases/00500-migrations/00200-automatic-migrations.md b/docs/docs/00200-core-concepts/00100-databases/00500-migrations/00200-automatic-migrations.md index 4a29ff7465f..59306940097 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00500-migrations/00200-automatic-migrations.md +++ b/docs/docs/00200-core-concepts/00100-databases/00500-migrations/00200-automatic-migrations.md @@ -59,13 +59,13 @@ The following changes cannot be performed with automatic migration and will caus If you need to make changes that aren't supported by automatic migration, see [Incremental Migrations](./00300-incremental-migrations.md) for a production-ready pattern that allows complex schema changes without downtime or data loss. -For development and testing, you can use `spacetime publish --delete-data` to completely reset your database, but this should **not** be used in production as it permanently deletes all data. +For development and testing, you can use `spacetime publish --delete-data=always` to completely reset your database, but this should **not** be used in production as it permanently deletes all data. ## Best Practices ### During Development -- Use `--delete-data` freely during early development when data loss is acceptable +- Use `--delete-data=always` freely during early development when data loss is acceptable - Test migrations with sample data before applying to production databases - Consider creating separate databases for development, staging, and production diff --git a/docs/docs/00300-resources/00100-how-to/00100-deploy/00100-maincloud.md b/docs/docs/00300-resources/00100-how-to/00100-deploy/00100-maincloud.md index 53d2503338c..1a2dedfddef 100644 --- a/docs/docs/00300-resources/00100-how-to/00100-deploy/00100-maincloud.md +++ b/docs/docs/00300-resources/00100-how-to/00100-deploy/00100-maincloud.md @@ -41,7 +41,7 @@ To update an existing module, run the same command. SpacetimeDB hot-swaps the mo To clear all data and start fresh: ```bash -spacetime publish my-database --server maincloud --delete-data +spacetime publish my-database --server maincloud --delete-data=always ``` ## Connecting Clients to Maincloud diff --git a/docs/docs/00300-resources/00200-reference/00100-cli-reference/00300-spacetime-json.md b/docs/docs/00300-resources/00200-reference/00100-cli-reference/00300-spacetime-json.md index f14340c3337..0e90d315c80 100644 --- a/docs/docs/00300-resources/00200-reference/00100-cli-reference/00300-spacetime-json.md +++ b/docs/docs/00300-resources/00200-reference/00100-cli-reference/00300-spacetime-json.md @@ -211,7 +211,7 @@ These apply to all selected databases: - `--server`: target server - `--break-clients`: allow breaking changes -- `--delete-data`: clear database data +- `--delete-data=`: clear database data (`always`, `on-conflict`, or `never`) - `--yes` / `--force`: skip confirmation prompts ### Per-database overrides From c849ef6b7143d6e6a958632bcf22c578206972cc Mon Sep 17 00:00:00 2001 From: rain Date: Fri, 10 Jul 2026 10:42:03 -0400 Subject: [PATCH 2/4] docs: keep delete-data examples concise --- .../00100-intro/00100-getting-started/00500-faq.md | 8 ++++---- .../00300-unity-tutorial/00300-part-2.md | 6 +++--- .../00300-unity-tutorial/00400-part-3.md | 8 ++++---- .../00300-unity-tutorial/00500-part-4.md | 4 ++-- .../00400-unreal-tutorial/00300-part-2.md | 6 +++--- .../00400-unreal-tutorial/00400-part-3.md | 10 +++++----- .../00400-unreal-tutorial/00500-part-4.md | 4 ++-- .../00500-godot-tutorial/00300-part-2.md | 6 +++--- .../00500-godot-tutorial/00400-part-3.md | 8 ++++---- .../00500-godot-tutorial/00500-part-4.md | 4 ++-- .../00100-databases/00300-spacetime-publish.md | 6 +++++- .../00500-migrations/00200-automatic-migrations.md | 4 ++-- .../00100-how-to/00100-deploy/00100-maincloud.md | 2 +- skills/cli/SKILL.md | 4 ++++ 14 files changed, 44 insertions(+), 36 deletions(-) diff --git a/docs/docs/00100-intro/00100-getting-started/00500-faq.md b/docs/docs/00100-intro/00100-getting-started/00500-faq.md index b96cd4f2f1f..abbbc177437 100644 --- a/docs/docs/00100-intro/00100-getting-started/00500-faq.md +++ b/docs/docs/00100-intro/00100-getting-started/00500-faq.md @@ -221,7 +221,7 @@ conn.subscriptionBuilder().subscribe( ### How do I handle schema migrations? -When you publish an updated module, SpacetimeDB compares the new schema with the existing one and performs automatic migrations for compatible changes (adding tables, adding columns with defaults, etc.). For breaking changes, you may need to publish with `--delete-data=always` during development. See [Automatic Migrations](../../00200-core-concepts/00100-databases/00500-migrations/00200-automatic-migrations.md) for details on what changes are supported. +When you publish an updated module, SpacetimeDB compares the new schema with the existing one and performs automatic migrations for compatible changes (adding tables, adding columns with defaults, etc.). For breaking changes, you may need to publish with `--delete-data` during development. See [Automatic Migrations](../../00200-core-concepts/00100-databases/00500-migrations/00200-automatic-migrations.md) for details on what changes are supported. ### How do I add a column to an existing table? @@ -261,10 +261,10 @@ Yes. When you `spacetime publish` an update, SpacetimeDB hot-swaps the module co ### How do I clear my database? -Use the `-c always` (or `--delete-data=always`) option when publishing: +Use the `-c` (or `--delete-data`) flag when publishing: ```bash -spacetime publish my-app -c always +spacetime publish my-app -c ``` This deletes all data and re-runs the `init` reducer. @@ -291,7 +291,7 @@ If your module's `init` reducer panics (for example, due to a unique constraint ### How do I reset my database during development? -Use `spacetime publish my-app --delete-data=always` to clear all data and republish. Or use `spacetime dev`, which handles this automatically with the `--delete-data=on-conflict` flag. +Use `spacetime publish my-app --delete-data` to clear all data and republish. Or use `spacetime dev`, which handles this automatically with the `--delete-data=on-conflict` flag. ### I got a weird error when compiling my module! diff --git a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00300-part-2.md b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00300-part-2.md index 6cf56341ba5..033bd7ed2ea 100644 --- a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00300-part-2.md +++ b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00300-part-2.md @@ -587,7 +587,7 @@ The `ReducerKind.ClientConnected` argument to the `SpacetimeDB.Reducer` attribut > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `ReducerKind.Init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. +> - `ReducerKind.Init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. > - `ReducerKind.ClientConnected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `Sender` value of the `ReducerContext`. > - `ReducerKind.ClientDisconnected` - Called when a user disconnects from the SpacetimeDB database. @@ -607,7 +607,7 @@ The `client_connected` argument to the `spacetimedb::reducer` macro indicates to > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. +> - `init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. > - `client_connected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `sender` value of the `ReducerContext`. > - `client_disconnected` - Called when a user disconnects from the SpacetimeDB database. @@ -626,7 +626,7 @@ The `SPACETIMEDB_CLIENT_CONNECTED` macro indicates to SpacetimeDB that this is a > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `SPACETIMEDB_INIT` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. +> - `SPACETIMEDB_INIT` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. > - `SPACETIMEDB_CLIENT_CONNECTED` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `sender` value of the `ReducerContext`. > - `SPACETIMEDB_CLIENT_DISCONNECTED` - Called when a user disconnects from the SpacetimeDB database. diff --git a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00400-part-3.md b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00400-part-3.md index 570c5a50d0b..fc5b6ae572c 100644 --- a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00400-part-3.md +++ b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00400-part-3.md @@ -16,7 +16,7 @@ This progressive tutorial is continued from [part 2](./00300-part-2.md). -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `Init` reducer. SpacetimeDB calls the `Init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `Init` reducer. SpacetimeDB calls the `Init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `Connect` reducer. @@ -85,7 +85,7 @@ We also added two helper functions so we can get a random range as either a `int -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -161,7 +161,7 @@ In this reducer, we are using the `world_size` we configured along with the `Red -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -898,7 +898,7 @@ SPACETIMEDB_CLIENT_DISCONNECTED(disconnect, ReducerContext ctx) { Finally, publish the new module to SpacetimeDB with this command: ```sh -spacetime publish --server local blackholio --delete-data=always +spacetime publish --server local blackholio --delete-data ``` Deleting the data is optional in this case, but in case you've been messing around with the module we can just start fresh. diff --git a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00500-part-4.md b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00500-part-4.md index bb7fb24b245..bfc58fc0ded 100644 --- a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00500-part-4.md +++ b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00500-part-4.md @@ -522,7 +522,7 @@ ctx.db[move_all_players_timer].insert(MoveAllPlayersTimer{ Republish your module with: ```sh -spacetime publish --server local blackholio --delete-data=always +spacetime publish --server local blackholio --delete-data ``` Regenerate your server bindings with: @@ -861,7 +861,7 @@ Notice that the food automatically respawns as you vaccuum them up. This is beca ## Connecting to Maincloud -- Publish to Maincloud `spacetime publish --server maincloud --delete-data=always` +- Publish to Maincloud `spacetime publish --server maincloud --delete-data` - `` This name should be unique and cannot contain any special characters other than internal hyphens (`-`). You will have to update the database name in `blackholio-server/spacetime.local.json` to match. - Update the URL in the Unity project to: `https://maincloud.spacetimedb.com` - Update the module name in the Unity project to ``. diff --git a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00300-part-2.md b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00300-part-2.md index 3d43ad8c38b..a592e63bfda 100644 --- a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00300-part-2.md +++ b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00300-part-2.md @@ -580,7 +580,7 @@ The `ReducerKind.ClientConnected` argument to the `SpacetimeDB.Reducer` attribut > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `ReducerKind.Init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. +> - `ReducerKind.Init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. > - `ReducerKind.ClientConnected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `Sender` value of the `ReducerContext`. > - `ReducerKind.ClientDisconnected` - Called when a user disconnects from the SpacetimeDB database. @@ -600,7 +600,7 @@ The `client_connected` argument to the `spacetimedb::reducer` macro indicates to > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. +> - `init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. > - `client_connected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `sender` value of the `ReducerContext`. > - `client_disconnected` - Called when a user disconnects from the SpacetimeDB database. @@ -619,7 +619,7 @@ The `SPACETIMEDB_CLIENT_CONNECTED` macro indicates to SpacetimeDB that this is a > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `SPACETIMEDB_INIT` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. +> - `SPACETIMEDB_INIT` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. > - `SPACETIMEDB_CLIENT_CONNECTED` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `sender` value of the `ReducerContext`. > - `SPACETIMEDB_CLIENT_DISCONNECTED` - Called when a user disconnects from the SpacetimeDB database. diff --git a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00400-part-3.md b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00400-part-3.md index 74d7bba4ced..1b388814d96 100644 --- a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00400-part-3.md +++ b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00400-part-3.md @@ -16,7 +16,7 @@ This progressive tutorial is continued from [part 2](./00300-part-2.md). -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `Init` reducer. SpacetimeDB calls the `Init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `Init` reducer. SpacetimeDB calls the `Init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `Connect` reducer. @@ -85,7 +85,7 @@ We also added two helper functions so we can get a random range as either a `int -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -161,7 +161,7 @@ In this reducer, we are using the `world_size` we configured along with the `Red -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -894,13 +894,13 @@ SPACETIMEDB_CLIENT_DISCONNECTED(disconnect, ReducerContext ctx) { Finally, publish the new module to SpacetimeDB with this command: ```sh -spacetime publish --server local blackholio --delete-data=always +spacetime publish --server local blackholio --delete-data ``` Deleting the data is optional in this case, but in case you've been messing around with the module we can just start fresh. :::note -When using `--delete-data=always`, SpacetimeDB will prompt you to confirm the deletion. Enter **y** and press **Enter** to proceed. +When using `--delete-data`, SpacetimeDB will prompt you to confirm the deletion. Enter **y** and press **Enter** to proceed. ::: ### Creating the Arena diff --git a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00500-part-4.md b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00500-part-4.md index a6a26a08526..4cb494183c2 100644 --- a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00500-part-4.md +++ b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00500-part-4.md @@ -520,7 +520,7 @@ ctx.db[move_all_players_timer].insert(MoveAllPlayersTimer{ Republish your module with: ```sh -spacetime publish --server local blackholio --delete-data=always +spacetime publish --server local blackholio --delete-data ``` Regenerate your server bindings with: @@ -917,7 +917,7 @@ Notice that the food automatically respawns as you vaccuum them up. This is beca ## Connecting to Maincloud -- Publish to Maincloud `spacetime publish --server maincloud --delete-data=always` +- Publish to Maincloud `spacetime publish --server maincloud --delete-data` - `` This name should be unique and cannot contain any special characters other than internal hyphens (`-`). - Update the URL in the Unreal project to: `https://maincloud.spacetimedb.com` - Update the module name in the Unreal project to ``. diff --git a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00300-part-2.md b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00300-part-2.md index e061919b0c6..845219c5e26 100644 --- a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00300-part-2.md +++ b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00300-part-2.md @@ -586,7 +586,7 @@ The `ReducerKind.ClientConnected` argument to the `SpacetimeDB.Reducer` attribut > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `ReducerKind.Init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. +> - `ReducerKind.Init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. > - `ReducerKind.ClientConnected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `Sender` value of the `ReducerContext`. > - `ReducerKind.ClientDisconnected` - Called when a user disconnects from the SpacetimeDB database. @@ -606,7 +606,7 @@ The `client_connected` argument to the `spacetimedb::reducer` macro indicates to > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. +> - `init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. > - `client_connected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `sender` value of the `ReducerContext`. > - `client_disconnected` - Called when a user disconnects from the SpacetimeDB database. @@ -625,7 +625,7 @@ The `SPACETIMEDB_CLIENT_CONNECTED` macro indicates to SpacetimeDB that this is a > SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur. > -> - `SPACETIMEDB_INIT` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data=always`. +> - `SPACETIMEDB_INIT` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --server local --delete-data`. > - `SPACETIMEDB_CLIENT_CONNECTED` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `sender` value of the `ReducerContext`. > - `SPACETIMEDB_CLIENT_DISCONNECTED` - Called when a user disconnects from the SpacetimeDB database. diff --git a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00400-part-3.md b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00400-part-3.md index 2425f9b8d83..0a4586a5216 100644 --- a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00400-part-3.md +++ b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00400-part-3.md @@ -16,7 +16,7 @@ This progressive tutorial is continued from [part 2](./00300-part-2.md). -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `Init` reducer. SpacetimeDB calls the `Init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `Init` reducer. SpacetimeDB calls the `Init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `Connect` reducer. @@ -85,7 +85,7 @@ We also added two helper functions so we can get a random range as either a `int -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -161,7 +161,7 @@ In this reducer, we are using the `world_size` we configured along with the `Red -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data=always`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -898,7 +898,7 @@ SPACETIMEDB_CLIENT_DISCONNECTED(disconnect, ReducerContext ctx) { Finally, publish the new module to SpacetimeDB with this command: ```sh -spacetime publish --server local blackholio --delete-data=always +spacetime publish --server local blackholio --delete-data ``` Deleting the data is optional in this case, but in case you've been messing around with the module we can just start fresh. diff --git a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00500-part-4.md b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00500-part-4.md index e8b55a1bdc7..71eff102a9c 100644 --- a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00500-part-4.md +++ b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00500-part-4.md @@ -522,7 +522,7 @@ ctx.db[move_all_players_timer].insert(MoveAllPlayersTimer{ Republish your module with: ```sh -spacetime publish --server local blackholio --delete-data=always +spacetime publish --server local blackholio --delete-data ``` Regenerate your server bindings with: @@ -844,7 +844,7 @@ Notice that the food automatically respawns as you vaccuum them up. This is beca ## Connecting to Maincloud -- Publish to Maincloud `spacetime publish --server maincloud --delete-data=always` +- Publish to Maincloud `spacetime publish --server maincloud --delete-data` - `` This name should be unique and cannot contain any special characters other than internal hyphens (`-`). You will have to update the database name in `blackholio-server/spacetime.local.json` to match. - Update the URL in the Main node to: `https://maincloud.spacetimedb.com` - Update the database name in the Main node to ``. diff --git a/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md b/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md index 5e2f40b025c..dd0402479a4 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md +++ b/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md @@ -94,8 +94,12 @@ If this publish is a major upgrade from 1.x to 2.0, read [1.x to 2.0 Upgrade Not To completely reset your database and delete all data: + + ```bash -spacetime publish --delete-data=always +spacetime publish --delete-data ``` ⚠️ **Warning:** This permanently deletes all data in your database! diff --git a/docs/docs/00200-core-concepts/00100-databases/00500-migrations/00200-automatic-migrations.md b/docs/docs/00200-core-concepts/00100-databases/00500-migrations/00200-automatic-migrations.md index 59306940097..4a29ff7465f 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00500-migrations/00200-automatic-migrations.md +++ b/docs/docs/00200-core-concepts/00100-databases/00500-migrations/00200-automatic-migrations.md @@ -59,13 +59,13 @@ The following changes cannot be performed with automatic migration and will caus If you need to make changes that aren't supported by automatic migration, see [Incremental Migrations](./00300-incremental-migrations.md) for a production-ready pattern that allows complex schema changes without downtime or data loss. -For development and testing, you can use `spacetime publish --delete-data=always` to completely reset your database, but this should **not** be used in production as it permanently deletes all data. +For development and testing, you can use `spacetime publish --delete-data` to completely reset your database, but this should **not** be used in production as it permanently deletes all data. ## Best Practices ### During Development -- Use `--delete-data=always` freely during early development when data loss is acceptable +- Use `--delete-data` freely during early development when data loss is acceptable - Test migrations with sample data before applying to production databases - Consider creating separate databases for development, staging, and production diff --git a/docs/docs/00300-resources/00100-how-to/00100-deploy/00100-maincloud.md b/docs/docs/00300-resources/00100-how-to/00100-deploy/00100-maincloud.md index 1a2dedfddef..53d2503338c 100644 --- a/docs/docs/00300-resources/00100-how-to/00100-deploy/00100-maincloud.md +++ b/docs/docs/00300-resources/00100-how-to/00100-deploy/00100-maincloud.md @@ -41,7 +41,7 @@ To update an existing module, run the same command. SpacetimeDB hot-swaps the mo To clear all data and start fresh: ```bash -spacetime publish my-database --server maincloud --delete-data=always +spacetime publish my-database --server maincloud --delete-data ``` ## Connecting Clients to Maincloud diff --git a/skills/cli/SKILL.md b/skills/cli/SKILL.md index 534ad7ee4ec..f5cd3479128 100644 --- a/skills/cli/SKILL.md +++ b/skills/cli/SKILL.md @@ -63,6 +63,10 @@ spacetime publish my-database --server local --yes spacetime publish my-database --delete-data=always --yes ``` +Bare `--delete-data` defaults to `always`. Keep simple interactive docs examples +bare, and use `--delete-data=always` for scripted/non-interactive examples that +also pass `--yes`. + ### Database Interaction ```bash From 4794bd4472b330fcfb92c5d229e567e5a8ef9bd9 Mon Sep 17 00:00:00 2001 From: rain Date: Sat, 11 Jul 2026 08:10:16 -0400 Subject: [PATCH 3/4] docs: clarify C# reducer result callbacks --- .../00600-clients/00600-csharp-reference.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/docs/00200-core-concepts/00600-clients/00600-csharp-reference.md b/docs/docs/00200-core-concepts/00600-clients/00600-csharp-reference.md index 0db7e730c91..264ce97c797 100644 --- a/docs/docs/00200-core-concepts/00600-clients/00600-csharp-reference.md +++ b/docs/docs/00200-core-concepts/00600-clients/00600-csharp-reference.md @@ -306,14 +306,14 @@ interface IRemoteDbContext ``` `Reducers` will have methods to invoke each reducer defined by the module, -plus methods for adding and removing callbacks on each of those reducers. +plus events for observing the result of reducer calls made by this connection. ##### Example ```csharp var conn = ConnectToDB(); -// Register a callback to be run every time the SendMessage reducer is invoked +// Register a callback to observe the result of SendMessage calls made by this connection. conn.Reducers.OnSendMessage += Reducer_OnSendMessageEvent; ``` @@ -711,9 +711,9 @@ record Event } ``` -Event when we are notified that a reducer ran in the remote database. The [`ReducerEvent`](#record-reducerevent) contains metadata about the reducer run, including its arguments and termination [`Status`](#record-status). +Event when we are notified of the result of a reducer call made by this connection. The [`ReducerEvent`](#record-reducerevent) contains metadata about the reducer run, including its arguments and termination [`Status`](#record-status). -This event is passed to row callbacks resulting from modifications by the reducer. +For changes caused by other clients' reducer calls, use table row callbacks or event tables rather than reducer callbacks. The server does not broadcast reducer arguments globally. #### Variant `SubscribeApplied` @@ -1084,13 +1084,14 @@ int CountPlayersAtLevel(RemoteTables tables, uint level) => tables.Player.Level. ## Observe and invoke reducers -All [`IDbContext`](#interface-idbcontext) implementors, including [`DbConnection`](#type-dbconnection) and [`EventContext`](#type-eventcontext), have a `.Reducers` property, which in turn has methods for invoking reducers defined by the module and registering callbacks on it. +All [`IDbContext`](#interface-idbcontext) implementors, including [`DbConnection`](#type-dbconnection) and [`EventContext`](#type-eventcontext), have a `.Reducers` property. Generated module bindings expose one invoke method and one result event for each reducer. -Each reducer defined by the module has three methods on the `.Reducers`: +For a reducer named `send_message`, generated C# bindings use PascalCase names: -- An invoke method, whose name is the reducer's name converted to snake case, like `set_name`. This requests that the module run the reducer. -- A callback registation method, whose name is prefixed with `on_`, like `on_set_name`. This registers a callback to run whenever we are notified that the reducer ran, including successfully committed runs and runs we requested which failed. This method returns a callback id, which can be passed to the callback remove method. -- A callback remove method, whose name is prefixed with `remove_on_`, like `remove_on_set_name`. This cancels a callback previously registered via the callback registration method. +- An invoke method, like `SendMessage(...)`. This requests that the module run the reducer. +- A result event, like `OnSendMessage`. This event fires on the calling connection when SpacetimeDB reports that reducer call's result, including committed, failed, and out-of-energy statuses. + +Reducer result events are not global notifications. They are for reducer calls made by this connection. To notify other clients that something happened, write to a public table or event table and subscribe to it. ## Identify a client From 7a9dc228504a884518810ae8a9aaaf69a6074a6e Mon Sep 17 00:00:00 2001 From: rain Date: Sun, 12 Jul 2026 08:10:29 -0400 Subject: [PATCH 4/4] docs: align TypeScript skill table naming guidance --- skills/typescript-server/SKILL.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/skills/typescript-server/SKILL.md b/skills/typescript-server/SKILL.md index e71e17a1290..83c51365d3b 100644 --- a/skills/typescript-server/SKILL.md +++ b/skills/typescript-server/SKILL.md @@ -23,7 +23,8 @@ import { ScheduleAt } from 'spacetimedb'; // for scheduled tables only ## Tables -`table(OPTIONS, COLUMNS)` takes two arguments. The `name` field MUST be snake_case: +`table(OPTIONS, COLUMNS)` takes two arguments. The `name` field is optional; +when present, it overrides the canonical SQL name and should be snake_case: ```typescript const entity = table( @@ -36,9 +37,11 @@ const entity = table( ); ``` -Options: `name` (snake_case, recommended), `public: true`, `event: true`, `scheduled: (): any => reducerRef`, `indexes: [...]` +Options: `name` (optional canonical SQL name override), `public: true`, `event: true`, `scheduled: (): any => reducerRef`, `indexes: [...]` -`ctx.db` accessors are the camelCase form of the table's `name` field. +`ctx.db` accessors come from the key passed to `schema({ ... })`, not from the +`name` override. If `name` is omitted, the canonical SQL name is derived from the +schema key. ## Column Types