forked from autotest/autotest
-
Notifications
You must be signed in to change notification settings - Fork 0
MigrateDatabaseToAutotest0.15
Lucas Meneghel Rodrigues edited this page Mar 18, 2013
·
2 revisions
- Dump the complete database and save it securely:
mysqldump -u root -p autotest_web > ~/autotest_web.dump
- Check if there are duplicates that we do not allow anymore:
SELECT name, COUNT(name) AS c FROM afe_autotests GROUP BY name HAVING c > 1; +-------------------------+---+ | name | c | +-------------------------+---+ | Sample - More profilers | 2 | +-------------------------+---+
It's probable that you will hit this one:
SELECT id, name, description FROM afe_autotests WHERE name = 'Sample - More profilers'\G *************************** 1. row *************************** id: 131 name: Sample - More profilers description: Runs sleeptest after installing a kernel rpm. Please note that syntax works only if you have an autotest package repository properly setup. *************************** 2. row *************************** id: 135 name: Sample - More profilers description: Runs sleeptest with different profilers present in the autotest tree. Also, it shows the convenience logging methods, such as logging.info and logging.error.
Update the second result with a better name (matches commit 42e2eb9):
UPDATE afe_autotests SET name = 'Sleep test with RPM kernel install' WHERE id = 135;
- Fix the schema of tko_tests:
ALTER TABLE tko_tests DROP invalid;
- Dump the current data:
This script is going to help:
#!/bin/bash DB=autotest_web mysqldump -u root -n -t -c \ --ignore-table=$DB.afe_acl_groups \ --ignore-table=$DB.tko_status \ --ignore-table=$DB.tko_testlabel \ --ignore-table=$DB.afe_parameterized_jobs_kernels \ --ignore-table=$DB.auth_group \ --ignore-table=$DB.auth_group \ --ignore-table=$DB.auth_message \ --ignore-table=$DB.auth_permission \ --ignore-table=$DB.django_content_type \ --ignore-table=$DB.django_site \ --ignore-table=$DB.tko_query_history \ --ignore-table=$DB.tko_test_labels \ -p $DB > ~/autotest_web.massaged.dump
- Drop the old database
$ echo 'DROP DATABASE autotest_web' | mysql -u root -p
- Create the new database:
$ autotest/installation_support/autotest-database-turnkey -s --from-config
- Load the massaged data:
$ mysql -u root -p autotest_web < ~/autotest_web.massaged.dump
- Profit!