Code Duplication    Length = 18-23 lines in 2 locations

includes/class-give-db-donor-meta.php 1 location

@@ 191-208 (lines=18) @@
188
	 *
189
	 * @return void
190
	 */
191
	public function create_table() {
192
193
		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
194
195
		$sql = "CREATE TABLE {$this->table_name} (
196
			meta_id bigint(20) NOT NULL AUTO_INCREMENT,
197
			customer_id bigint(20) NOT NULL,
198
			meta_key varchar(255) DEFAULT NULL,
199
			meta_value longtext,
200
			PRIMARY KEY  (meta_id),
201
			KEY customer_id (customer_id),
202
			KEY meta_key (meta_key)
203
			) CHARACTER SET utf8 COLLATE utf8_general_ci;";
204
205
		dbDelta( $sql );
206
207
		update_option( $this->table_name . '_db_version', $this->version );
208
	}
209
210
	/**
211
	 * Given a donor ID, make sure it's a positive number, greater than zero before inserting or adding.

includes/class-give-db-donors.php 1 location

@@ 566-588 (lines=23) @@
563
	 *
564
	 * @return void
565
	 */
566
	public function create_table() {
567
568
		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
569
570
		$sql = "CREATE TABLE " . $this->table_name . " (
571
		id bigint(20) NOT NULL AUTO_INCREMENT,
572
		user_id bigint(20) NOT NULL,
573
		email varchar(50) NOT NULL,
574
		name mediumtext NOT NULL,
575
		purchase_value mediumtext NOT NULL,
576
		purchase_count bigint(20) NOT NULL,
577
		payment_ids longtext NOT NULL,
578
		notes longtext NOT NULL,
579
		date_created datetime NOT NULL,
580
		PRIMARY KEY  (id),
581
		UNIQUE KEY email (email),
582
		KEY user (user_id)
583
		) CHARACTER SET utf8 COLLATE utf8_general_ci;";
584
585
		dbDelta( $sql );
586
587
		update_option( $this->table_name . '_db_version', $this->version );
588
	}
589
590
	/**
591
	 * Check if the Customers table was ever installed