-- Create ProductMultiBuys table
CREATE TABLE IF NOT EXISTS ProductMultiBuys (
    Id TEXT PRIMARY KEY NOT NULL,
    ProductId TEXT NOT NULL,
    Name TEXT NOT NULL,
    Description TEXT NOT NULL DEFAULT '',
    Quantity INTEGER NOT NULL,
    Price REAL NOT NULL,
    PricePerUnit REAL NOT NULL,
    SortOrder INTEGER NOT NULL DEFAULT 0,
    IsActive INTEGER NOT NULL DEFAULT 1,
    CreatedAt TEXT NOT NULL,
    UpdatedAt TEXT NOT NULL,
    FOREIGN KEY (ProductId) REFERENCES Products(Id) ON DELETE CASCADE
);

-- Create index for better performance
CREATE INDEX IF NOT EXISTS IX_ProductMultiBuys_ProductId ON ProductMultiBuys(ProductId);
CREATE INDEX IF NOT EXISTS IX_ProductMultiBuys_IsActive ON ProductMultiBuys(IsActive);