ˈvɔlə
ˈvɔlə

Reputation: 10242

Saving SQLite Database to specific File

Introduction

I am using the official sqlite NuGet package (3.13.0) and entity framework (6.2.0). My initial connection string is data source=sample-database.sqlite.

My Question

How can I save the complete database to a different file (e.g. D:\Path\To\NewFile.sqlite)? I just can think of copying the database file to the new location and renaming it, but this solution feels kind of weird.

Thank you. Any help is appreciated!

Upvotes: 0

Views: 699

Answers (1)

flyte
flyte

Reputation: 1322

How can I save the complete database to a different file (e.g. D:\Path\To\NewFile.sqlite)? I just can think of copying the database file to the new location and renaming it, but this solution feels kind of weird.

Nope. Not weird. I have done this and it works just fine. Just need to remember that you may need to be aware of the new DB location when you add another migration + update-database, (if the connection string is defined in various places)

Upvotes: 1

Related Questions