@@ -44,7 +44,7 @@ class Database {
4444 * @since 1.0.0
4545 * @var string
4646 */
47- public $ db_version = '2 .0.0 ' ;
47+ public $ db_version = '1 .0.0 ' ;
4848
4949 /**
5050 * Constructor.
@@ -98,7 +98,9 @@ public function create_table() {
9898 PRIMARY KEY (id),
9999 KEY subscriber_id (subscriber_id),
100100 KEY plugin_id (plugin_id),
101- KEY event_type (event_type)
101+ KEY event_type (event_type),
102+ KEY user_type (user_type),
103+ KEY created (created)
102104 ) {$ charset_collate }; " ;
103105
104106 require_once ABSPATH . 'wp-admin/includes/upgrade.php ' ;
@@ -117,20 +119,6 @@ public function create_table() {
117119 );
118120 }
119121
120- // Drop legacy columns from dev installs.
121- $ current_version = get_option ( 'freemkit_db_version ' , '0 ' );
122- if ( version_compare ( $ current_version , '2.0.0 ' , '< ' ) ) {
123- // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.PreparedSQL.InterpolatedNotPrepared
124- $ columns = $ wpdb ->get_results ( "SHOW COLUMNS FROM {$ this ->table_name }" , ARRAY_A );
125- $ col_names = wp_list_pluck ( $ columns , 'Field ' );
126- if ( in_array ( 'tags ' , $ col_names , true ) ) {
127- $ wpdb ->query ( "ALTER TABLE {$ this ->table_name } DROP COLUMN tags " ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.PreparedSQL.InterpolatedNotPrepared
128- }
129- if ( in_array ( 'forms ' , $ col_names , true ) ) {
130- $ wpdb ->query ( "ALTER TABLE {$ this ->table_name } DROP COLUMN forms " ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.PreparedSQL.InterpolatedNotPrepared
131- }
132- }
133-
134122 update_option ( 'freemkit_db_version ' , $ this ->db_version );
135123
136124 return true ;
0 commit comments