2

I am trying to migrate a D7 site to D8 following the steps found here .

Once I can manage it and make sure I have all the PHP components, Drupal modules and etc. I have 4 sites to update, and one that I suspect is going to be very difficult.

I installed and used Composer to make a Drupal 8 site off my /home directory with the intent to move the files over the existing website. Plus it seems the migrate-upgrade needs to reference the D7 site via http.

When I run the following command to migrate the old (D7) site to this new D8 site it fails.

drush migrate-upgrade --legacy-db-url=mysql://user:password@server/db  
--legacy-root=http://example.com --configure only 

with the following parameters for my specific environment

  • user = user the site uses to connect to the database
  • password
  • server = localhost
  • db = database name
  • http://example.com = URL for the website

When it fails, it cites [debug] key_value table not found. Database may be empty. [0.1 sec, 9.59 MB] and when I check the MySQL database I find there is no table name key_value.

I could create the table, if I know the requirements for the table (field names, field type, sizes, PK/FK, etc.). Or is there some other means to create this table.

Previously I did everything manually.
I thought since the update steps found in this Guide had the overall process involve making a D8 site and migrating the data over that I should use Composer and/or Drush.
This is my first time getting Composer and Drush working for me.

Any help would be greatly appreciated.

Thank you.


I get the following output when I run the whole drush migrate-upgrade command:

Drush Launcher Version: 0.6.0 ROOT: /home/akwashnak/ctdollarsandsesne DRUSH VERSION: 9 DRUPAL ROOT: /home/akwashnak/ctdollarsandsesne COMPOSER ROOT: /home/akwashnak/ctdollarsandsesne VENDOR ROOT: /home/akwashnak/ctdollarsandsesne/vendor [preflight] Config paths: /home/akwashnak/ctdollarsandsesne/vendor/drush/drush/drush.yml [preflight] Alias paths: /home/akwashnak/ctdollarsandsesne/drush/sites,/home/akwashnak/drush/sites [preflight] Commandfile search paths: /home/akwashnak/ctdollarsandsesne/vendor/drush/drush/src [debug] Bootstrap further to find migrate-upgrade [0.08 sec, 8.02 MB] [debug] Trying to bootstrap as far as we can [0.08 sec, 8.02 MB] [debug] Drush bootstrap phase: bootstrapDrupalRoot() [0.08 sec, 8.02 MB] [debug] Change working directory to /home/akwashnak/ctdollarsandsesne [0.08 sec, 8.02 MB] [debug] Initialized Drupal 8.7.9 root directory at /home/akwashnak/ctdollarsandsesne [0.08 sec, 8.15 MB] [debug] Drush bootstrap phase: bootstrapDrupalSite() [0.09 sec, 8.5 MB] [debug] Initialized Drupal site default at sites/default [0.09 sec, 8.67 MB] [debug] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.09 sec, 8.67 MB] [debug] Add service modifier [0.1 sec, 9.17 MB] [debug] key_value table not found. Database may be empty. [0.1 sec, 9.59 MB] [debug] Bootstrap phase bootstrapDrupalDatabase() failed to validate; continuing at bootstrapDrupalConfiguration() [0.1 sec, 9.59 MB] [debug] Done with bootstrap max in Application::find(): trying to find migrate-upgrade again. [0.1 sec, 9.59 MB]

In Application.php line 239:

[Symfony\Component\Console\Exception\CommandNotFoundException] Command migrate-upgrade was not found. Drush was unable to query the database. As a result, many commands are unavailable. Re-run your command with --de bug to see relevant log messages.

Exception trace: at /home/akwashnak/ctdollarsandsesne/vendor/drush/drush/src/Application.php:239 Drush\Application->bootstrapAndFind() at /home/akwashnak/ctdollarsandsesne/vendor/drush/drush/src/Application.php:192 Drush\Application->find() at /home/akwashnak/ctdollarsandsesne/vendor/symfony/console/Application.php:236 Symfony\Component\Console\Application->doRun() at /home/akwashnak/ctdollarsandsesne/vendor/symfony/console/Application.php:148 Symfony\Component\Console\Application->run() at /home/akwashnak/ctdollarsandsesne/vendor/drush/drush/src/Runtime/Runtime.php:118 Drush\Runtime\Runtime->doRun() at /home/akwashnak/ctdollarsandsesne/vendor/drush/drush/src/Runtime/Runtime.php:49 Drush\Runtime\Runtime->run() at /home/akwashnak/ctdollarsandsesne/vendor/drush/drush/drush.php:72 require() at /home/akwashnak/ctdollarsandsesne/vendor/drush/drush/includes/preflight.inc:18 drush_main() at phar:///usr/local/bin/drush/bin/drush.php:141 require() at /usr/local/bin/drush:10

2

"Drush was unable to query the database" tells you that your issue isn't a missing table, but a configuration issue.

You do need to start with an empty but working D8 site before you try running the migration. I'm thinking you didn't initialize your site after downloading the code with composer?

To be clearer: composer is a tool for managing code, not for managing the site as a whole. After using composer to download the code, you still need to create your database and use drush or the web interface to actually "set up" your site. Only at that point can drush migrate can start doing its thing.

  • I had followed the instructions to install from Composer – Andrew Nov 15 at 18:27
  • 1
    (sorry, timed out) I had followed the instructions to install from Composer outlined in drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#composer-from-scratch which starts with composer init, then installs composer tools before running composer require drupal/core. I did the initial composer init and don't see anything for initializing the site. – Andrew Nov 15 at 18:32
  • 2
    Sounds like you've got as far as step 2 of drupal.org/docs/8/install - you still need steps 3 & 5 to install the website (maybe step 4 too if you want to host the site) – Clive Nov 15 at 19:11
  • 2
    Once the site is installed you'll also need to install the migrate/migrate plus modules to make the drush commands available – Clive Nov 15 at 19:14
  • So I need to create a new database and have the new site somewhere accessible by Apache? Make it a full independent site before migrating the data over from the D7 site? – Andrew Nov 15 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.