<?php

namespace StoreEngine\Database;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class CreateProductVariationsTable {

	public static function up( $prefix, $charset_collate ) {
		$table_name = $prefix . 'storeengine_product_variations';
		$sql        = "CREATE TABLE IF NOT EXISTS {$table_name} (
			id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
			sku VARCHAR(255) NOT NULL,
			product_id BIGINT(20) UNSIGNED NOT NULL,
			price decimal(26,8),
			compare_price decimal(26,8),
			PRIMARY KEY (id),
			KEY product_id (product_id)
		) $charset_collate;";

		dbDelta( $sql );
	}
}
