Skip to content
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

Installation error #617

Closed
muhammetsahin opened this issue Feb 11, 2015 · 11 comments
Closed

Installation error #617

muhammetsahin opened this issue Feb 11, 2015 · 11 comments

Comments

@muhammetsahin
Copy link
Contributor

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

@muratcakir
Copy link
Contributor

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.

@muhammetsahin
Copy link
Contributor Author

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.

@muratcakir
Copy link
Contributor

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.

@gonrocha
Copy link

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
Copy link

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.

@mdsabz
Copy link

mdsabz commented Feb 19, 2015

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

@muratcakir
Copy link
Contributor

We fixed the issue: a3382aa

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

@gonrocha
Copy link

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

@ercanerdogan
Copy link

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

@ken88ling
Copy link

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

@bhavdip13
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants