Comments (8)
I have just updated to 8.0.1 [...]
@pantonis What version of Pomelo where you using before the upgrade?
ServerVersion.AutoDetect(connectionString)
opens a connection to the database server to retrieve the version of the server. If you add a migration and EF Core runs the code that executes ServerVersion.AutoDetect(connectionString)
, the database server referenced in the connection string must be available, or the ServerVersion
cannot get detected:
To generate the appropriate migrations, Pomelo needs to know the correct server version.
We generally do not recommend using ServerVersion.AutoDetect(connectionString)
in production code. We recommend to explicitly specify the ServerVersion
(which you now switched to), for example:
var optionsBuilder = new DbContextOptionsBuilder<MyDbContext>()
.UseMySql(
connectionString,
ServerVersion.Parse("10.10.1-mariadb"),
options =>
{
options.EnableRetryOnFailure();
options.MigrationsAssembly("MyAssembly.MariaDb");
});
from pomelo.entityframeworkcore.mysql.
We updated 8.X but we didn't use migrations on 8.0.0. We used migrations on 7.X and then on 8.0.1 where we hit the issue We have several clients each running different version of MariaDb. If we configure it somehow on each client then on each client update of MariaDb we need to update all of it microservices. This is very inconvienent as we have a lot of clients and dozens of microservices that need to be updated. Any other workaround
from pomelo.entityframeworkcore.mysql.
Pomelo needs to know the version of the database server (or at least the minimum server version it should support).
If you want to use ServerVersion.AutoDetect(connectionString)
, the database server that you reference in connectionString
must be reachable.
If you are having multiple clients with different database server versions, they are also using different connection strings.
You can configure the connection string in a settings file, along with the server version string.
If you want to use the latest features for all your clients, you should generate an individual migration set for each client using their individual database server version.
If you don't care about the latest MariaDB features for all you clients, you could specify a static minimum server version that is <= the lowest server version of any of your clients. Then you can generate one set of migrations that works for all your clients.
from pomelo.entityframeworkcore.mysql.
If you want to use ServerVersion.AutoDetect(connectionString), the database server that you reference in connectionString must be reachable.
It is reachable. That is why I opened the ticket. Because with 7.0 version we didn't have any issues on that.
from pomelo.entityframeworkcore.mysql.
It is reachable. That is why I opened the ticket. Because with 7.0 version we didn't have any issues on that.
If I understand you correctly, you said earlier that you did not use migrations before 8.0.1
:
We updated 8.0 but we didn't use migrations on 8.0.0.
Did I understand you correctly, or did you use migrations before 8.0.1
?
from pomelo.entityframeworkcore.mysql.
Apologies for confusing you. We didn't use it for 8.0.0. We used it for version 7.X and then we upgraded to 8.0.1 and tried to use it on 8.0.1. This is where we noticed the issue. Let me correct my initial message
from pomelo.entityframeworkcore.mysql.
Please check, that you can indeed connect to the database from the same machine, that you execute the Add-Migration
command on.
Execute the following in a new console program on the same machine, that you execute the Add-Migration
command on (use <PackageReference Include="MySqlConnector" Version="2.3.5" />
):
var connectionString = "your connection string 100% identical to the one you use in your app";
using var connection = new MySqlConnection(connectionString);
connection.Open();
If it works, then move to the next section below.
If it fails, then you don't have a working connection to the database referenced in your connection string.
There was a single change between 8.0.0
and 8.0.1
in regards to the ServerVersion.AutoDetect()
method, that added AutoEnlist = false
and Pooling = false
to the connection string.
Those changes should not have any influence on the matter, but if you want to verify this, you could revert those changes in a customized auto detect method:
public static ServerVersion CustomAutoDetect(string connectionString)
{
using var connection = new MySqlConnection(
new MySqlConnectionStringBuilder(connectionString)
{
Database = string.Empty,
// AutoEnlist = false,
// Pooling = false,
}.ConnectionString);
connection.Open();
return Parse(connection.ServerVersion);
}
You then call this CustomAutoDetect(connectionString)
method instead of the ServerVersion.AutoDetect(connectionString)
one that ships with Pomelo.
If it suddenly works, than ServerVersion.AutoDetect(connectionString)
is indeed the issue. Otherwise, it is not.
from pomelo.entityframeworkcore.mysql.
@pantonis Did you try the steps I outlined in my previous post?
from pomelo.entityframeworkcore.mysql.
Related Issues (20)
- SEVERE ASP Api Response Time Problems with 8.0.1 and beyond HOT 10
- why string contains can be translated to like '' HOT 2
- Replace JSON_EXTRACT utilisation with JSON_VALUE HOT 5
- All primary keys altered in migration after upgrading efcore to 8.0.1 HOT 3
- Getting different SQL output for the same LINQ Query since upgrading to .NET 8 HOT 2
- ArgumentException: Option 'name' not supported. HOT 11
- Input string was not in a correct format when compare with TimeSpan HOT 1
- After upgrading from 7.0.0 to 8.0.2, SQL translation results are changed and this version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'. HOT 4
- MySQL operations break after InvalidOperationException: Can't Replace Active Reader HOT 2
- Remove explicit reference to `System.Text.Json` package from `Pomelo.EntityFrameworkCore.MySql.Json.Microsoft` package HOT 4
- After upgrading to 8.0.2 .SetAfterSaveBehavior(PropertySaveBehavior.Ignore) generates SQL that updates the column value HOT 7
- Invalid SQL Syntax when adding an entity with a default expression HOT 3
- TimeSpan.TotalHours could not be translated HOT 7
- Error assigning index for [table] HOT 1
- Error adding integer auto-increment column with migration (since 8.0.1)
- System.TypeLoadException: Method 'Quote' in type does not have an implementation. HOT 1
- MariaDB Maxscale Support
- DbContext.Database.Migrate() change guid charset and Collation
- ExecuteDeleteAsync in combination with Take throws InvalidOperationException
- Unnecessary migration is generated after update to 8.0.2 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pomelo.entityframeworkcore.mysql.