Apply the schema
This guide shows you the ways to create and upgrade the Deedbox tables. Deedbox never changes the schema unless you ask it to. Without a current schema, start-up fails with the exact fix (DBX001).
At start-up
Section titled “At start-up”Call ApplySchemaOnStartup() in AddDeedbox. Pods take a database lock, so concurrent pods apply each migration once.
With the CLI
Section titled “With the CLI”dotnet tool install -g Deedbox.Cli --prereleasedeedbox schema apply --provider postgres --connection "$DEEDBOX_CONNECTION"Or print the SQL for a DBA:
deedbox schema script --provider sqlserver --from 0 > deedbox.sql--from is the version the database has now. The scripts are idempotent, and each records itself in schema_version.
In an EF Core migration
Section titled “In an EF Core migration”// An EF Core migration that creates the Deedbox tables without adding them to your model.public partial class AddDeedbox : Migration{ protected override void Up(MigrationBuilder migrationBuilder) => migrationBuilder.Sql(PostgresSchema.Script(fromVersion: 0)); // SqlServerSchema.Script on SQL Server}The tables stay out of your EF Core model. For an upgrade, add a new migration with Script(fromVersion: n).
With DbUp or Flyway
Section titled “With DbUp or Flyway”Save the output of deedbox schema script as a numbered script in your migrations folder. For SQL Server, the script separates batches with GO.
Use another schema name
Section titled “Use another schema name”.Schema("es") puts the tables in es instead of deedbox. Names are lower-case letters, digits and underscores, at most 50 characters.