MBF product prices migration
This commit is contained in:
parent
a0fcde8c3e
commit
b65706e029
|
|
@ -117,13 +117,24 @@ return new class extends Migration
|
|||
Schema::create(config('shop.tables.product_prices', 'product_prices'), function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->uuid('product_id');
|
||||
$table->string('currency', 3)->default('USD');
|
||||
$table->decimal('price', 10, 2);
|
||||
$table->string('stripe_price_id')->nullable();
|
||||
$table->string('name')->nullable();
|
||||
$table->string('type')->default('one_time'); // one_time, recurring
|
||||
$table->string('currency', 3)->default('USD');
|
||||
$table->integer('price')->default(0); // Store as smallest currency unit (cents)
|
||||
$table->integer('sale_price')->nullable();
|
||||
$table->boolean('is_default')->default(false);
|
||||
$table->boolean('active')->default(true);
|
||||
$table->string('billing_scheme')->nullable(); // per_unit, tiered
|
||||
$table->string('interval')->nullable(); // day, week, month, year
|
||||
$table->integer('interval_count')->nullable();
|
||||
$table->integer('trial_period_days')->nullable();
|
||||
$table->json('meta')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['product_id', 'currency']);
|
||||
$table->index(['product_id', 'is_default']);
|
||||
$table->index(['active', 'type']);
|
||||
$table->foreign('product_id')->references('id')->on(config('shop.tables.products', 'products'))->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ class ShopAddExampleProducts extends Command
|
|||
foreach ($attributes as $index => $attr) {
|
||||
ProductAttribute::create([
|
||||
'product_id' => $product->id,
|
||||
'name' => $attr['name'],
|
||||
'key' => $attr['name'],
|
||||
'value' => $attr['value'],
|
||||
'sort_order' => $index,
|
||||
'meta' => json_encode((object)[]),
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class ProductAttribute extends Model
|
|||
|
||||
protected $fillable = [
|
||||
'product_id',
|
||||
'name',
|
||||
'key',
|
||||
'value',
|
||||
'sort_order',
|
||||
'meta',
|
||||
|
|
|
|||
Loading…
Reference in New Issue