How do we get migrations to work using ABP when using an Azure SQL server?
I tried
myDbContext.Database.Migrate(); but myDbContext wants an options file.
I tried using Update-Database but it doesn't want to accept a ConnectionString.
I tried to enable migrations when publishing, but for some unknown reason, there is no "Migrate database on startup" option... very strange.
What's the right way to do this? SQL scripts?
You can pass a connection string to Update-Database command.
Here's how to;
Update-Database -Verbose -ConnectionString "Server=localhost;Database=MyDatabase;User=sa;Password=123;" -ConnectionProviderName "System.Data.SqlClient"
Here's a sample Azure db connection with Update-Database
Update-Database -StartUpProjectName "MyCloudProject" -ConnectionString "Server=tcp:<server_name>.database.windows.net,1433;Database=<database_name>;User ID=<db_user_name>#<server_name>;Password=<password>;Trusted_Connection=False;Encrypt=True;MultipleActiveResultSets=True;Max Pool Size=100;" -ConnectionProviderName "System.Data.SqlClient"
Related
I installed Oracle Database 19c and was able to connect to the database using sqlplus in command line. However when I try to use SQL developer I'm unable to connect. I noticed I don't have any listener service like I did when I had Oracle Database 21c installed on another computer. Is this why I can't access it on SQL developer? And if so how do I create that listener?
Access the database through SQL Developer.
(I don't have the reputation to comment, so I'm posting this here.)
Just wanted to say that I just encountered the same issue.
I installed Oracle 19c on Windows as "Software Only".
I used dbca.bat to create a database with a single pluggable database through the "basic" configuration. In the past I've gone through the "advanced" configuration, and I'm wondering if that's what lead to this.
So now I'm dropping the database and will try re-creating it to see if using the advanced DB installation provides a listener.
Edit
After deleting the database, then going back through the DB installation in dbca.bat via the "advanced" installation option, I noticed that the listener configuration was actually disabled by default, and I had to choose to add a listener.
I am trying to use Elsa workflow and to run it with database MySql, when application start and Elsa migrations run the following error happens
System.InvalidOperationException: 'A schema "Elsa" has been set for an object of type "AddColumnOperation" with the name of "DefinitionVersionId". MySQL does not support the EF Core concept of schemas. Any schema property of any "MigrationOperation" must be null. This behavior can be changed by setting the SchemaBehavior option in the UseMySql call.'
when i changed the schemabehavior another error happened, anyone faced this before?
Try this:
dbContextBuilder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), mysql => mysql.MigrationsAssembly(typeof(Elsa.Persistence.EntityFramework.MySql.MySqlElsaContextFactory).Assembly.FullName)
.SchemaBehavior(MySqlSchemaBehavior.Ignore));
This ran the migrations without error for me.
I create a new MVC project with user authentication by the following commands.
dotnet new mvc -o ProjectName --auth Individual
However, it's using sqlite database by default. I know that adding -uld will use localDB instead.
I would like to ask if there is any way to use SQL Server directly.
I tried to migrate the sqlite database to SQL server database but there are some error messages during the migration.... Thus, I would like to ask if there is any better way to do it.
Thank you.
I want to migrate my mysql databse to oracle.
I have followed the migration demo from this url http://www.oracle.com/technetwork/database/migration/connect-step-mysql-1946352.html
but I got this message when try to associate migration repository
sql error on script execution. try deleting repository before creating repository
I am using
Oracle Sql Developer v 4.1.1.19Oracle express edition 11g releas 2
see the picture bellow what I have tried step by step
step1: Creating a user named migration_repo
step 2: Creating connection named migration_repo using migration_repo user
step3: try to associate migration repository
step4: executing the command
but after few seconds I got this error message.
Now. how can I solve this? what I have done wrong?
I had the same problem, this was solved changing the GRANT statement with...
GRANT ALL PRIVILEGES to {migration-name} identified by {migration-name};
just be aware to remove privileges after migration tasks.
I'm working through this tutorial:
Deploying an ASP.NET Web Application to a Windows Azure Web Site and SQL Database
In the second part "Enable Migrations and create the database" I need to use the NuGet Package Manager console to enter a series of commends:
enable-migrations -ContextTypeName ToDoListApp.Models.ToDoDb
add-migration-initial
update-database
Why do I need to do this explicitly? Shouldn't this be wrapped up in the publish process?
Thanks
Dave
The migrations process is separate from Azure. You can have an MVC 4 project that uses database migrations but the database is not hosted on Azure. The commands you are referencing simply enable the migrations in any MVC 4 project.
I find updating the database dangerous, so I actually prefer it to be separated from the publishing process because this way someone on your team is able to update the logic of the website without pushing updates to the database.