SmartStoreNET icon indicating copy to clipboard operation
SmartStoreNET copied to clipboard

Installation error

Open muhammetsahin opened this issue 11 years ago • 11 comments

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

muhammetsahin avatar Feb 11 '15 19:02 muhammetsahin

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.

muratcakir avatar Feb 11 '15 19:02 muratcakir

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.

muhammetsahin avatar Feb 11 '15 20:02 muhammetsahin

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.

muratcakir avatar Feb 11 '15 21:02 muratcakir

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.

gonrocha avatar Feb 19 '15 04:02 gonrocha

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.

gonrocha avatar Feb 19 '15 04:02 gonrocha

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..

mdsabz avatar Feb 19 '15 09:02 mdsabz

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

muratcakir avatar Feb 19 '15 17:02 muratcakir

It worked like a charm with a brand new database (because I've never got it installed before). Thank you

gonrocha avatar Feb 19 '15 18:02 gonrocha

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

ercanerdogan avatar Feb 01 '17 23:02 ercanerdogan

I didn't find any setting.txt in this source project, May I know how to get this setting.txt

ken88ling avatar Apr 29 '17 03:04 ken88ling

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

bhavdip13 avatar Jun 09 '18 04:06 bhavdip13