Answers.Body: <p>According to the error, the <code>entrydrafts</code> table cannot be dropped because the <code>workflow_submissions</code> table depends on it. That looks like it belongs to the <a href="https://plugins.craftcms.com/workflow?craft4" rel="nofollow noreferrer">Workflow plugin</a>, so try uninstalling the Workflow plugin <em>before</em> running the migration, which should remove that table and its dependency.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-25T15:35:01.990Z
Answers.Text: Thank you Ben. Removing the plugin was one of the first things I did.  Are there steps that I can do to resolve the conflicts in such a way that Craft is happy and will not try to run the migration?
Answers.UserDisplayName: Unlimited
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-25T17:26:22.737Z
Answers.Text: Does the table still exist in the DB? If so, try dropping it manually.
Answers.UserDisplayName: Ben Croker
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-25T17:36:36.653Z
Answers.Text: I deleted the workflow_submissions table manually, but the migration still failed.  It looks like the m210624_222934_drop_deprecated_tables.php migration uses a 'drop if exists' class method but the method does not do a DROP CASCADE.  Unless I've missed something.
Answers.UserDisplayName: Unlimited
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-26T15:20:51.517Z
Answers.Text: What error message is it failing with now?
Answers.UserDisplayName: Ben Croker
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-26T20:42:54.257Z
Answers.Text: Sorry Ben, I got to it this morning and I wasn't getting the error anymore, somehow, the migration must have completed properly. I had manually dropped the workflow_submissions table... maybe that removed the dependencies for the depreciated tables?  I've been working this out on a development server (going from 3.4 to 4.4.8), so that I can work through it quickly on the live server.  I did this time through incrementally, but I'd like to go directly from Craft 3.4 to 3.8.7. Do you think that would work?
Answers.UserDisplayName: Unlimited
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-27T23:36:16.590Z
Answers.Text: I would think so.
Answers.UserDisplayName: Ben Croker
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-22T01:10:53.683Z
Answers.LastActivityDate: 2023-04-22T01:10:53.683Z
Answers.UserDisplayName: Ben Croker
Body: <p>I am SO close to getting my Craft 3.8.7 upgraded to 4.0.  Now, I'm getting an error when it tries to run a migration. I read in the docs that there were a couple of tables that were deprecated, so I was surprised to see an error related to a dependency with the <code>entrydrafts</code> table.  I looked for any notes on this migration but could not find anything.  Here's the error:</p>
  <pre><code>    Database Exception: SQLSTATE[2BP01]: Dependent objects still exist: 7 ERROR: cannot drop table entrydrafts because other objects depend on it
  DETAIL: constraint workflow_submissions_draftId_fk on table workflow_submissions depends on table entrydrafts
  HINT: Use DROP ... CASCADE to drop the dependent objects too.
  The SQL being executed was: DROP TABLE IF EXISTS &quot;entrydrafts&quot;
  
  Migration: craft\migrations\m210624_222934_drop_deprecated_tables
  
  Output:
  
  &gt; dropping {{%entrydrafterrors}} if it exists ... done (time: 0.009s)
  &gt; dropping {{%entryversionerrors}} if it exists ... done (time: 0.004s)
  &gt; dropping {{%entrydrafts}} if it exists ...Exception: SQLSTATE[2BP01]: Dependent objects still exist: 7 ERROR: cannot drop 
  </code></pre>
  
Tags: <craft4><upgrades>
Title: Craft 4 Upgrade - Migration issue
ThreadText: # Craft 4 Upgrade - Migration issue
  
  (Asked by: username_0 on 2023-04-21)
  
  I am SO close to getting my Craft 3.8.7 upgraded to 4.0. Now, I'm getting an error when it tries to run a migration. I read in the docs that there were a couple of tables that were deprecated, so I was surprised to see an error related to a dependency with the `entrydrafts` table. I looked for any notes on this migration but could not find anything. Here's the error:
  
  ```
      Database Exception: SQLSTATE[2BP01]: Dependent objects still exist: 7 ERROR: cannot drop table entrydrafts because other objects depend on it
  DETAIL: constraint workflow_submissions_draftId_fk on table workflow_submissions depends on table entrydrafts
  HINT: Use DROP ... CASCADE to drop the dependent objects too.
  The SQL being executed was: DROP TABLE IF EXISTS "entrydrafts"
  
  Migration: craft\migrations\m210624_222934_drop_deprecated_tables
  
  Output:
  
  > dropping {{%entrydrafterrors}} if it exists ... done (time: 0.009s)
  > dropping {{%entryversionerrors}} if it exists ... done (time: 0.004s)
  > dropping {{%entrydrafts}} if it exists ...Exception: SQLSTATE[2BP01]: Dependent objects still exist: 7 ERROR: cannot drop 
  
  ```
  
  **Tags:** craft4, upgrades
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-04-22. Score: 1
  
  According to the error, the `entrydrafts` table cannot be dropped because the `workflow_submissions` table depends on it. That looks like it belongs to the [Workflow plugin](https://plugins.craftcms.com/workflow?craft4), so try uninstalling the Workflow plugin *before* running the migration, which should remove that table and its dependency.
  
  > **Comments:**
  > **username_0**: Thank you Ben. Removing the plugin was one of the first things I did.  Are there steps that I can do to resolve the conflicts in such a way that Craft is happy and will not try to run the migration?  
  > **username_1**: Does the table still exist in the DB? If so, try dropping it manually.  
  > **username_0**: I deleted the workflow_submissions table manually, but the migration still failed.  It looks like the m210624_222934_drop_deprecated_tables.php migration uses a 'drop if exists' class method but the method does not do a DROP CASCADE.  Unless I've missed something.  
  > **username_1**: What error message is it failing with now?  
  > **username_0**: Sorry Ben, I got to it this morning and I wasn't getting the error anymore, somehow, the migration must have completed properly. I had manually dropped the workflow_submissions table... maybe that removed the dependencies for the depreciated tables?  I've been working this out on a development server (going from 3.4 to 4.4.8), so that I can work through it quickly on the live server.  I did this time through incrementally, but I'd like to go directly from Craft 3.4 to 3.8.7. Do you think that would work?  
  > **username_1**: I would think so.  
  
  ---
  
  