Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Add initial docs for SQL Server schema creation and migration. #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions docs/sqlserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,24 @@ stream Ids are strings there are a number of optimisations applied:

Please refer to `CreateSchema.sql` for full schema details.

# Initializing the Database
## Initializing the Database

TODO
The SqlStreamStore database can be initialized in a few ways:

# Using
* **Via SQL Script**: In the project's [`ScriptsV3` folder](https://github.com/SQLStreamStore/SQLStreamStore/tree/master/src/SqlStreamStore.MsSql/ScriptsV3), you'll find [a `CreateSchema.sql` script](https://github.com/SQLStreamStore/SQLStreamStore/blob/master/src/SqlStreamStore.MsSql/ScriptsV3/CreateSchema.sql). Executing the SQL script within a database will install the schema.
* **Via a method**: on the object for a given store, you can call `CreateSchemaIfNotExists()`. This will ensure the schema is created

TODO
## Checking Whether the Schema Matches

On the object for a store, you can call `CheckSchema()` which will return a result on whether the schema matches expectations.

This is ideal to run on startup / health checks

# Migrating from V2 Schema to V3
## Migrating from V2 Schema to V3

TODO
* **Via SQL Script**: In the project's [`ScriptsV3` folder](https://github.com/SQLStreamStore/SQLStreamStore/tree/master/src/SqlStreamStore.MsSql/ScriptsV3), you'll find [a `Migration_v3.sql` script](https://github.com/SQLStreamStore/SQLStreamStore/blob/master/src/SqlStreamStore.MsSql/ScriptsV3/Migration_v3.sql). Executing the SQL script within a database will migrate the schema from v2 to v3.
* **Via method**: On the object for a store, you can call `Migrate()` which will migrate the schema.

## Using

TODO