From d3fdcf53bcaf4b143c316f3379190d0053a6036f Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 16 Sep 2021 22:19:07 +0200 Subject: Clean up, fix and rename db tables. This patch got a bit more involved than what was originally planned, but since we're messing with the tables I decided to do it all right away. - Moves the constraint definition to the CREATE TABLE statement for the concerts table. This replaces the existing KEY definition that it had. - Make sure the venues table is created before the concerts table so that the above mentioned constraint definition works. - Rename the tables. Use the wpdb-prefix and make the name a bit prettier. This caused some changes in the Concert and Venue classes, and for slightly silly reasons some test classes. The code actually turned out better (for the most part), but some refactoring can still be done. The column names remains unchanged for now. --- tests/ConcertTest.php | 4 ++-- tests/ConcertsTableTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/ConcertTest.php b/tests/ConcertTest.php index 4f27f0f..dc2a712 100644 --- a/tests/ConcertTest.php +++ b/tests/ConcertTest.php @@ -69,8 +69,8 @@ final class ConcertTest extends WP_UnitTestCase global $wpdb; $tables = [ - "wpg_concerts", - "wpg_venues", + "{$wpdb->prefix}giglogadmin_concerts", + "{$wpdb->prefix}giglogadmin_venues", ]; foreach( $tables as $table ) { diff --git a/tests/ConcertsTableTest.php b/tests/ConcertsTableTest.php index 556698a..6f9d9d2 100644 --- a/tests/ConcertsTableTest.php +++ b/tests/ConcertsTableTest.php @@ -65,8 +65,8 @@ class ConcertsTableTest extends WP_UnitTestCase global $wpdb; $tables = [ - "wpg_concerts", - "wpg_venues", + "{$wpdb->prefix}giglogadmin_concerts", + "{$wpdb->prefix}giglogadmin_venues", ]; foreach( $tables as $table ) { -- cgit v1.2.3