prefix . 'swiftdash_', $wpdb->get_charset_collate() ); foreach ( $schema as $sql ) { dbDelta( $sql ); } // Version 3 stopped storing the page path of each visit (dbDelta never drops columns). $hits = $wpdb->prefix . 'swiftdash_hits'; if ( $wpdb->get_var( $wpdb->prepare( 'SHOW COLUMNS FROM %i LIKE %s', $hits, 'path' ) ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery $wpdb->query( $wpdb->prepare( 'ALTER TABLE %i DROP COLUMN path', $hits ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.DirectDatabaseQuery.SchemaChange } update_option( 'swiftdash_db_version', SWIFTDASH_DB_VERSION, false ); /** * Fires after tables are installed (schedule cron events here). */ do_action( 'swiftdash_installed' ); } /** * Run the installer when the stored DB version is out of date. */ function swiftdash_maybe_install() { if ( get_option( 'swiftdash_db_version' ) !== SWIFTDASH_DB_VERSION ) { swiftdash_install(); } } add_action( 'plugins_loaded', 'swiftdash_maybe_install', 20 ); register_activation_hook( SWIFTDASH_FILE, 'swiftdash_install' );