-
-
Notifications
You must be signed in to change notification settings - Fork 597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Truncate does not work on SQLite #272
Comments
Same issue here. Problem is in TableInfo.cs Line 92, where the default value 'dbo' is set: |
Fix: bool isSqlServer = context.Database.ProviderName.EndsWith(DbServer.SqlServer.ToString());
string defaultSchema = isSqlServer ? "dbo" : null;
Schema = entityType.GetSchema() ?? defaultSchema; Will publish this fix in the next version. |
Fixed |
This seems to be broken again. dbcontext.Truncate<MyTableModel>(); generates the following sql with ef core 6.0.10
which throws
Looking at the previous solution (dropping the schema), the cause seems to be /// <inheritdoc/>
public void Truncate(DbContext context, TableInfo tableInfo)
{
string sql = SqlQueryBuilder.DeleteTable(tableInfo.FullTableName);
context.Database.ExecuteSqlRaw(sql);
} where |
@borisdj It seems the schema is still added with the latest version on SQLite (8.0.2), causing the truncate to fail |
Will take a look. |
Truncate does not work on SQLite because dbo is added.
This SQL-Command is generated:
DELETE FROM [dbo].[Customers];VACUUM;
SqliteException: SQLite Error 1: 'no such table: dbo.Customers'.
The right command should be:
DELETE FROM [Customers];VACUUM;
The text was updated successfully, but these errors were encountered: