Installation error
I've tried to install 2.x but got error this:
Setup failed: Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration.
How can i solve ?
Thanks
Try this in the NuGet package manager console:
update-database -TargetMigration V211
Then
update-database
If the problem reoccurs, execute:
add-migration SomeTestName
Open the newly created migration file and have a look at both Up() and Down() methods: if there is DDL code, you made changes to the entity models, for which a migration class had to be created first.
I did but this time got another error:
A connection string could not be resolved for the parameterless constructor of the derived DbContext. Either the database is not installed, or the file 'Settings.txt' does not exist or contains invalid content.
Please choose SmartStore.Data in the project dropdown menu above the console. If that does not do the trick, you may also choose EFMigrations as your build configuration.
Hello, I've just downloaded the source code, and I'm getting the same error, even following the above instructions. I'm a rookie, but I guess that without Settings.txt there is no database configuration to run the migrations.
I've found that if I change AutomaticMigrationsEnabled = false; to true in MigrationsConfigurations.cs, the installation process continues, but ends with the following error:
Setup failed: There is already an object named 'QuantityUnit' in the database.
Any help will be very appreciated.
Hi, I've downloaded the source code, compiled the solution and getting to the Installation Page. After I key in the credentials to the database, I get an Setup failed Message: Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration.
A quick google search, led to results as specified above...but still the problem persists...in nuget console I get this error "A connection string could not be resolved for the parameterless constructor of the derived DbContext. Either the database is not installed, or the file 'Settings.txt' does not exist or contains invalid content."
Help appreciated..
We fixed the issue: a3382aaaa189f30ba48d18a2810034261c6d2d35
VERY IMPORTANT: if you have a database already (because you installed successfully earlier) you MUST downgrade your EF migration to V211 BEFORE pulling this commit.
update-database -TargetMigration V211
It worked like a charm with a brand new database (because I've never got it installed before). Thank you
It's been a while since it closed :)
but I would like to share another solution :
"AutomaticMigrationsEnabled" in the following files is false by default. If we change this value to true, We have solved this error during install
I solved this way
this parameter in following source files
....\src\Libraries\SmartStore.Data\Migrations\Configuration.cs
and
.....\src\Libraries\SmartStore.Data\Migrations\MigrationsConfiguration.cs
I didn't find any setting.txt in this source project, May I know how to get this setting.txt
i have download the source code from github then i open the folder of App_Data/Tenants/Default/ but i cant find the settings.txt file and also current.txt file please help me what i do and also how to create db in my local ssms