Reset Orchard to look like fresh install
Asked Answered
O

4

21

Couple of custom modules were not working. I disabled/deleted them and tried to enable/install again. It did not work. I decided to start from scratch. So I deleted all the database tables (I am using SQL Server 2008). Is this not enough?

If I run the project, I see the directory listing for /orchardlocal/.

What else I have to do?

Thanks.

Osric answered 10/5, 2012 at 21:54 Comment(0)
P
32

Just delete the appdata folder, just as simple. It will be a fresh install then.

Pendulous answered 10/5, 2012 at 22:54 Comment(4)
Thanks. I thought deleting appdata works only for CE edition. A question - if I delete the appdata folder, but not the database tables from the sql server, what happens in that scenario?Osric
Then the database will still exist but the site won't point to it. If you want to point to the same DB, just zap all the tables from there before setup.Pyridine
You can also leave the database as it is and just use a different prefix. Very useful to create a new site quickly during module developpment, as it does not matter if your dev database contains a few now useless tables, and it's quicker that wiping out the database.Konikow
Exist native implementation from Orchard which give possibility to restart the site without any folder manipulation( removing, adding etc. ).Euratom
K
1

If you're running standard Orchard, wiping out the AppData folder will do the trick.

However, it will not if you're deployed on Azure/Azure emulator. Then you have to remove the PREFIX-site "folder" (with PREFIX being the azure storage prefix for your site) from the Azure blob storage (it's not really a folder, as there are no real folder in the blob storage, but you know what I mean).

If you're testing on the Azure emulator, the quickest way to accomplish that is by resetting the blob storage from the storage Emulator UI.

Konikow answered 11/5, 2012 at 8:50 Comment(0)
M
1

On top of deleting the App_Data folder from the Orchard.Web project, you can reset the db by deleting one table at a time or you can quickly delete all tables by running this script

USE [myorcharddb]
GO

EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"

Note: All tables in the database will be dropped. You cannot undo this!

Manzano answered 25/2, 2017 at 16:22 Comment(0)
E
0

You can use the instance of IHostEnvironment from using Orchard.Environment;

The code will look something like this:

_hostEnvironment.RestartAppDomain();

Here is source code: https://github.com/OrchardCMS/Orchard-Harvest-Website/blob/master/src/Orchard/Environment/DefaultHostEnvironment.cs

PS: I use orchard mvc version: 1.10.2.0, which works for me very well.

Euratom answered 7/4, 2022 at 8:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.