|
1 | 1 | ---
|
2 | 2 | title: SQLite Database Provider - Limitations - EF Core
|
3 |
| -author: rowanmiller |
4 |
| -ms.date: 04/09/2017 |
| 3 | +author: bricelam |
| 4 | +ms.date: 07/16/2020 |
5 | 5 | ms.assetid: 94ab4800-c460-4caa-a5e8-acdfee6e6ce2
|
6 | 6 | uid: core/providers/sqlite/limitations
|
7 | 7 | ---
|
@@ -39,34 +39,36 @@ modelBuilder.Entity<MyEntity>()
|
39 | 39 |
|
40 | 40 | 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.
|
41 | 41 |
|
42 |
| -| Operation | Supported? | Requires version | |
43 |
| -|:---------------------|:-----------|:-----------------| |
44 |
| -| AddColumn | ✔ | 1.0 | |
45 |
| -| AddForeignKey | ✗ | | |
46 |
| -| AddPrimaryKey | ✗ | | |
47 |
| -| AddUniqueConstraint | ✗ | | |
48 |
| -| AlterColumn | ✗ | | |
49 |
| -| CreateIndex | ✔ | 1.0 | |
50 |
| -| CreateTable | ✔ | 1.0 | |
51 |
| -| DropColumn | ✗ | | |
52 |
| -| DropForeignKey | ✗ | | |
53 |
| -| DropIndex | ✔ | 1.0 | |
54 |
| -| DropPrimaryKey | ✗ | | |
55 |
| -| DropTable | ✔ | 1.0 | |
56 |
| -| DropUniqueConstraint | ✗ | | |
57 |
| -| RenameColumn | ✔ | 2.2.2 | |
58 |
| -| RenameIndex | ✔ | 2.1 | |
59 |
| -| RenameTable | ✔ | 1.0 | |
60 |
| -| EnsureSchema | ✔ (no-op) | 2.0 | |
61 |
| -| DropSchema | ✔ (no-op) | 2.0 | |
62 |
| -| Insert | ✔ | 2.0 | |
63 |
| -| Update | ✔ | 2.0 | |
64 |
| -| Delete | ✔ | 2.0 | |
| 42 | +A rebuild will be attempted in order to perform certain operations. Rebuilds are only possible for database artifacts that are part of your EF Core model. If a database artifact isn't part of the model--for example, if it was created manually inside a migration--then a `NotSupportedException` is still thrown. |
| 43 | + |
| 44 | +| Operation | Supported? | Requires version | |
| 45 | +|:---------------------|:------------|:-----------------| |
| 46 | +| AddCheckConstraint | ✔ (rebuild) | 5.0 | |
| 47 | +| AddColumn | ✔ | 1.0 | |
| 48 | +| AddForeignKey | ✔ (rebuild) | 5.0 | |
| 49 | +| AddPrimaryKey | ✔ (rebuild) | 5.0 | |
| 50 | +| AddUniqueConstraint | ✔ (rebuild) | 5.0 | |
| 51 | +| AlterColumn | ✔ (rebuild) | 5.0 | |
| 52 | +| CreateIndex | ✔ | 1.0 | |
| 53 | +| CreateTable | ✔ | 1.0 | |
| 54 | +| DropCheckConstraint | ✔ (rebuild) | 5.0 | |
| 55 | +| DropColumn | ✔ (rebuild) | 5.0 | |
| 56 | +| DropForeignKey | ✔ (rebuild) | 5.0 | |
| 57 | +| DropIndex | ✔ | 1.0 | |
| 58 | +| DropPrimaryKey | ✔ (rebuild) | 5.0 | |
| 59 | +| DropTable | ✔ | 1.0 | |
| 60 | +| DropUniqueConstraint | ✔ (rebuild) | 5.0 | |
| 61 | +| RenameColumn | ✔ | 2.2.2 | |
| 62 | +| RenameIndex | ✔ (rebuild) | 2.1 | |
| 63 | +| RenameTable | ✔ | 1.0 | |
| 64 | +| EnsureSchema | ✔ (no-op) | 2.0 | |
| 65 | +| DropSchema | ✔ (no-op) | 2.0 | |
| 66 | +| Insert | ✔ | 2.0 | |
| 67 | +| Update | ✔ | 2.0 | |
| 68 | +| Delete | ✔ | 2.0 | |
65 | 69 |
|
66 | 70 | ## Migrations limitations workaround
|
67 | 71 |
|
68 |
| -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. |
| 72 | +You can workaround some of these limitations by manually writing code in your migrations to perform a rebuild. Table rebuilds involve creating a new table, copying data to the new table, dropping the old table, renaming the new table. You will need to use the `Sql(string)` method to perform some of these steps. |
69 | 73 |
|
70 | 74 | See [Making Other Kinds Of Table Schema Changes](https://sqlite.org/lang_altertable.html#otheralter) in the SQLite documentation for more details.
|
71 |
| - |
72 |
| -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 commit comments