Skip to content

Commit

Permalink
Update SQLite Limitations for 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bricelam committed Jul 10, 2020
1 parent 64fbfd2 commit b4fdc90
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions entity-framework/core/providers/sqlite/limitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,36 @@ modelBuilder.Entity<MyEntity>()

The SQLite database engine does not support a number of schema operations that are supported by the majority of other relational databases. If you attempt to apply one of the unsupported operations to a SQLite database then a `NotSupportedException` will be thrown.

| Operation | Supported? | Requires version |
|:---------------------|:-----------|:-----------------|
| AddColumn || 1.0 |
| AddForeignKey || |
| AddPrimaryKey || |
| AddUniqueConstraint || |
| AlterColumn || |
| CreateIndex || 1.0 |
| CreateTable || 1.0 |
| DropColumn || |
| DropForeignKey || |
| DropIndex || 1.0 |
| DropPrimaryKey || |
| DropTable || 1.0 |
| DropUniqueConstraint || |
| RenameColumn || 2.2.2 |
| RenameIndex || 2.1 |
| RenameTable || 1.0 |
| EnsureSchema | ✔ (no-op) | 2.0 |
| DropSchema | ✔ (no-op) | 2.0 |
| Insert || 2.0 |
| Update || 2.0 |
| Delete || 2.0 |
Starting in EF Core 5.0, a table rebuild will be attempted in order to perform certain operations. Rebuilds are only possible for tables that are part of your EF Core model. If a table isn't part of the model--for example, if it was created manually inside a migration--than a `NotSupportedException` is still thrown.

| Operation | Supported? | Requires version |
|:---------------------|:------------|:-----------------|
| AddCheckConstraint | ✔ (rebuild) | 5.0 |
| AddColumn || 1.0 |
| AddForeignKey | ✔ (rebuild) | 5.0 |
| AddPrimaryKey | ✔ (rebuild) | 5.0 |
| AddUniqueConstraint | ✔ (rebuild) | 5.0 |
| AlterColumn | ✔ (rebuild) | 5.0 |
| CreateIndex || 1.0 |
| CreateTable || 1.0 |
| DropCheckConstraint | ✔ (rebuild) | 5.0 |
| DropColumn | ✔ (rebuild) | 5.0 |
| DropForeignKey | ✔ (rebuild) | 5.0 |
| DropIndex || 1.0 |
| DropPrimaryKey | ✔ (rebuild) | 5.0 |
| DropTable || 1.0 |
| DropUniqueConstraint | ✔ (rebuild) | 5.0 |
| RenameColumn || 2.2.2 |
| RenameIndex || 2.1 |
| RenameTable || 1.0 |
| EnsureSchema | ✔ (no-op) | 2.0 |
| DropSchema | ✔ (no-op) | 2.0 |
| Insert || 2.0 |
| Update || 2.0 |
| Delete || 2.0 |

## Migrations limitations workaround

You can workaround some of these limitations by manually writing code in your migrations to perform a table rebuild. A table rebuild involves renaming the existing table, creating a new table, copying data to the new table, and dropping the old table. You will need to use the `Sql(string)` method to perform some of these steps.

See [Making Other Kinds Of Table Schema Changes](https://sqlite.org/lang_altertable.html#otheralter) in the SQLite documentation for more details.

In the future, EF may support some of these operations by using the table rebuild approach under the covers. You can [track this feature on our GitHub project](https://github.com/aspnet/EntityFrameworkCore/issues/329).

0 comments on commit b4fdc90

Please sign in to comment.