Answers.Body: <p>If your domain name is actually <code>staging.somedomain.com</code> and your multi-environment config is searching for <code>stage.</code>, then they won't match up.</p>
  
  <p>What <em>will</em> match, however, is the <code>.com</code> key directly underneath it, which is probably what you're thinking is only for the live site.</p>
  
  <p>Being more explicit with your matching multi-environment config keys will probably clear up the confusion.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-29T14:37:20.720Z
Answers.Text: Thanks Brad. I ended up having to be explicit both the staging (`stage.domain.com`) & live domain (`www.domain.com`). I thought a partial match would return true for the first match in the array. (ie. the staging key above the live key)
Answers.UserDisplayName: Siebird
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-29T14:42:50.713Z
Answers.Text: Even so, there was no partial match. `stage` does not match `staging`.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-29T14:50:24.540Z
Answers.Text: There should have been a match as the **actual** subdomain is `stage.domain.com`, so `stage.` should return true. It did for the `general.php` as it added the `devMode` strip, thus all the confusion
Answers.UserDisplayName: Siebird
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-29T14:52:26.840Z
Answers.Text: Ahh... the original post said staging, so I was confused.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-29T03:59:15.250Z
Answers.LastActivityDate: 2014-10-29T06:23:35.697Z
Answers.LastEditDate: 2014-10-29T06:23:35.697Z
Answers.UserDisplayName: Brad Bell
Body: <p>I'm having a weird issue trying to figure out which database my staging site (staging.domain.com) is connecting too. On my staging site, craft is <em>up-to-date</em>, but does not show the latest changes I made (added a new section and updated craft), which makes me think it's using the live database. However, if it's using the live DB, it should show craft as needing updates? All the other changes on the staging site are working fine (ie. tmpl &amp; css updates).</p>
  
  <p>So to troubleshoot, I added <code>devMode</code> to my staging site array to see if my keys were working properly. This added the <code>devMode</code> strip to the top of the CP. Next, I double checked both database on the server to make sure they were different. The staging DB has the new section I just added. Lastly, I cleared the cache to see if that made a difference. </p>
  
  <p>Am I totally missing something here?</p>
  
  <p><strong>general.php:</strong></p>
  
  <pre><code>return array(
      '*' =&gt; array(
          'cpTrigger' =&gt; 'cp-admin',
          'omitScriptNameInUrls' =&gt; true,
          'environmentVariables' =&gt; array(
              'basePath' =&gt; $base_path,
              'baseUrl'  =&gt; $base_url
          )
      ),
      '.dev' =&gt; array(
          'devMode' =&gt; true,
      ),
      'stage.' =&gt; array(
          'devMode' =&gt; true,
      ),
      '.com' =&gt; array(
          'cooldownDuration' =&gt; 0,
      )
  );
  </code></pre>
  
  <p><strong>db.php:</strong></p>
  
  <pre><code>return array(
  
      '*' =&gt; array(
          'tablePrefix' =&gt; 'craft',
      ),
  
      '.dev' =&gt; array(
          'server' =&gt; 'localhost',
          'user' =&gt; 'root',
          'password' =&gt; 'root',
          'database' =&gt; '***pa_craft',
      ),
  
      'stage.' =&gt; array(
          'server' =&gt; 'localhost',
          'user' =&gt; '***pa',
          'password' =&gt; '***',
          'database' =&gt; '***pa_craft',
      ),
  
      '.com' =&gt; array(
          'server' =&gt; 'localhost',
          'user' =&gt; '***pa',
          'password' =&gt; '***',
          'database' =&gt; '***pa_craft_live',
      ),
  
  );
  </code></pre>
  
  <h3>Update</h3>
  
  <p>I just switched my local setup (dev) to point to the remote staging DB which connects and shows the updates. I also added a new entry to check to see if was writing to the correct DB. </p>
  
Tags: <database><multi-environment>
Title: How to check which DB craft is using?
ThreadText: # How to check which DB craft is using?
  
  (Asked by: username_0 on 2014-10-29)
  
  I'm having a weird issue trying to figure out which database my staging site (staging.domain.com) is connecting too. On my staging site, craft is *up-to-date*, but does not show the latest changes I made (added a new section and updated craft), which makes me think it's using the live database. However, if it's using the live DB, it should show craft as needing updates? All the other changes on the staging site are working fine (ie. tmpl & css updates).
  
  So to troubleshoot, I added `devMode` to my staging site array to see if my keys were working properly. This added the `devMode` strip to the top of the CP. Next, I double checked both database on the server to make sure they were different. The staging DB has the new section I just added. Lastly, I cleared the cache to see if that made a difference.
  
  Am I totally missing something here?
  
  **general.php:**
  
  ```
  return array(
      '*' => array(
          'cpTrigger' => 'cp-admin',
          'omitScriptNameInUrls' => true,
          'environmentVariables' => array(
              'basePath' => $base_path,
              'baseUrl'  => $base_url
          )
      ),
      '.dev' => array(
          'devMode' => true,
      ),
      'stage.' => array(
          'devMode' => true,
      ),
      '.com' => array(
          'cooldownDuration' => 0,
      )
  );
  
  ```
  
  **db.php:**
  
  ```
  return array(
  
      '*' => array(
          'tablePrefix' => 'craft',
      ),
  
      '.dev' => array(
          'server' => 'localhost',
          'user' => 'root',
          'password' => 'root',
          'database' => '***pa_craft',
      ),
  
      'stage.' => array(
          'server' => 'localhost',
          'user' => '***pa',
          'password' => '***',
          'database' => '***pa_craft',
      ),
  
      '.com' => array(
          'server' => 'localhost',
          'user' => '***pa',
          'password' => '***',
          'database' => '***pa_craft_live',
      ),
  
  );
  
  ```
  
  ### Update
  
  I just switched my local setup (dev) to point to the remote staging DB which connects and shows the updates. I also added a new entry to check to see if was writing to the correct DB.
  
  **Tags:** database, multi-environment
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-10-29. Score: 2 | Accepted answer
  
  If your domain name is actually `staging.somedomain.com` and your multi-environment config is searching for `stage.`, then they won't match up.
  
  What *will* match, however, is the `.com` key directly underneath it, which is probably what you're thinking is only for the live site.
  
  Being more explicit with your matching multi-environment config keys will probably clear up the confusion.
  
  > **Comments:**
  > **username_0**: Thanks username_1. I ended up having to be explicit both the staging (`stage.domain.com`) & live domain (`www.domain.com`). I thought a partial match would return true for the first match in the array. (ie. the staging key above the live key)  
  > **username_1**: Even so, there was no partial match. `stage` does not match `staging`.  
  > **username_0**: There should have been a match as the **actual** subdomain is `stage.domain.com`, so `stage.` should return true. It did for the `general.php` as it added the `devMode` strip, thus all the confusion  
  > **username_1**: Ahh... the original post said staging, so I was confused.  
  
  ---
  
  