Answers.Body: <p>I'm not certain what's meant by "component data" here - but in all likelihood the easiest approach is to restore a copy of the <code>civicrm.mysql</code> and <code>civicrm_generated.mysql</code> files in the "sql" directory.  Don't forget to drop your database first, restoring a SQL file won't drop existing tables created, e.g. by generating custom fields.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-28T16:46:19.830Z
Answers.Text: I updated my question in the hope I now explain it better. I was already looking at using civicrm.mysql but I became discouraged by the many civicrm_updatedb_*. So you say I don't need to apply these patches?
Answers.UserDisplayName: ñull
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-28T18:14:29.443Z
Answers.Text: @ñull No, those are only for upgrades!  You just need `civicrm.mysql` and `civicrm_generated.mysql`.
  Are you aware of the "regen.sh" file in the `<civiroot>/bin` folder?  This does what you want and more - but if you look at the last four lines you'll see the part you're interested in.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-27T15:06:02.517Z
Answers.LastActivityDate: 2016-07-28T18:14:45.977Z
Answers.LastEditDate: 2016-07-28T18:14:45.977Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>In that case you should be using hooks in the extension </p>
  
  <p>you should have all the code related to extension in this below hook while install </p>
  
  <p>hook_civicrm_install</p>
  
  <p>And you should roll back all the action which you did while installing against uninstall </p>
  
  <p>hook_civicrm_uninstall</p>
  
  <p>more reference: <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference" rel="nofollow">https://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference</a></p>
  
  <p>I guess this helps !!!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-27T18:10:41.100Z
Answers.Text: I know that "mechanism" but that is not what I am after. An extension uninstall only removes what the extension added. I want an extension install to resets CiviCRM to a (near) virginal state.
Answers.UserDisplayName: ñull
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-28T08:13:29.387Z
Answers.Text: In that case you need to try by taking a back up of the database - but I don't think you can write an extension for this -
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-27T08:50:00.273Z
Answers.LastActivityDate: 2016-06-27T08:50:00.273Z
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Body: <p>When writing a re-initialisation script / extension or drupal module, how would you reset CiviCRM back to clean installation state? Is it possible to install "minimal" without components and their data? Or is component data always pre-installed, enabled or not?</p>
  
  <p>With component data I mean the database data that is needed for some of the build in civicrm components as listed in /civicrm/admin/setting/component. As far as I can remember, at installation I never choose components, they came pre-activated by default. When I deactivate the unnecessary components, a lot of their data is not removed from database and remains. I was wondering if there is a way to force a minimal installation without components and then programmatically activate / install the ones I need. </p>
  
  <p>I was wondering if there is a way to use part of the installer code to restore the initial database, without having to <em>reinvent the wheel</em>. </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-06-16T11:14:31.173Z
Comments.Text: do you want to reinstall a fresh copy again ?
Comments.UserDisplayName: Ramesh - ARTECH Consultancy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-06-24T16:56:01.857Z
Comments.Text: Yes, but I would like to do it from an extension or Drupal module. A reset button for "prototypers". After that a reinitialisation code would restore the empty prototype ready for use .
Comments.UserDisplayName: ñull
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-29T04:08:29.190Z
Comments.Text: I don't understand any of these answers! I want to "Nuke" my civiCRM install, but only the database, start from scratch. How can I do that? Is there an original SQL file I can get and then import it in PHPmyadmin? I'me working with locahost Xampp, windows 10, Drupal 7 / CiviCRM , sharing the database with Drupal instal. I don't care about the data of either one!
Comments.UserDisplayName: Bruno  Vincent
Tags: <extension><installation><php><modules>
Title: How to reset CiviCRM?
ThreadText: # How to reset CiviCRM?
  
  (Asked by: username_0 on 2016-06-16)
  
  When writing a re-initialisation script / extension or drupal module, how would you reset CiviCRM back to clean installation state? Is it possible to install "minimal" without components and their data? Or is component data always pre-installed, enabled or not?
  
  With component data I mean the database data that is needed for some of the build in civicrm components as listed in /civicrm/admin/setting/component. As far as I can remember, at installation I never choose components, they came pre-activated by default. When I deactivate the unnecessary components, a lot of their data is not removed from database and remains. I was wondering if there is a way to force a minimal installation without components and then programmatically activate / install the ones I need.
  
  I was wondering if there is a way to use part of the installer code to restore the initial database, without having to *reinvent the wheel*.
  
  **Tags:** extension, installation, php, modules
  
  > **Comments:**
  > **username_1**: do you want to reinstall a fresh copy again ?  
  > **username_0**: Yes, but I would like to do it from an extension or Drupal module. A reset button for "prototypers". After that a reinitialisation code would restore the empty prototype ready for use .  
  > **username_2**: I don't understand any of these answers! I want to "Nuke" my civiCRM install, but only the database, start from scratch. How can I do that? Is there an original SQL file I can get and then import it in PHPmyadmin? I'me working with locahost Xampp, windows 10, Drupal 7 / CiviCRM , sharing the database with Drupal instal. I don't care about the data of either one!  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2016-07-27. Score: 2 | Accepted answer
  
  I'm not certain what's meant by "component data" here - but in all likelihood the easiest approach is to restore a copy of the `civicrm.mysql` and `civicrm_generated.mysql` files in the "sql" directory. Don't forget to drop your database first, restoring a SQL file won't drop existing tables created, e.g. by generating custom fields.
  
  > **Comments:**
  > **username_0**: I updated my question in the hope I now explain it better. I was already looking at using civicrm.mysql but I became discouraged by the many civicrm_updatedb_*. So you say I don't need to apply these patches?  
  > **username_3**: @username_0 No, those are only for upgrades!  You just need `civicrm.mysql` and `civicrm_generated.mysql`. Are you aware of the "regen.sh" file in the `<civiroot>/bin` folder?  This does what you want and more - but if you look at the last four lines you'll see the part you're interested in.  
  
  ---
  
  ### Answer by username_1 on 2016-06-27. Score: 1
  
  In that case you should be using hooks in the extension
  
  you should have all the code related to extension in this below hook while install
  
  hook\_civicrm\_install
  
  And you should roll back all the action which you did while installing against uninstall
  
  hook\_civicrm\_uninstall
  
  more reference: <https://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference>
  
  I guess this helps !!!
  
  > **Comments:**
  > **username_0**: I know that "mechanism" but that is not what I am after. An extension uninstall only removes what the extension added. I want an extension install to resets CiviCRM to a (near) virginal state.  
  > **username_1**: In that case you need to try by taking a back up of the database - but I don't think you can write an extension for this -  
  
  ---
  
  