<?php

/**
 * Migration 0010 — Designer ownership on pages
 *
 * Adds designer_id to instinctor_pages so a single Standalone install can
 * host pages owned by many designers (multi-tenant workspace on
 * instinctor.com). NULL = admin-managed marketing page; non-null = owned by
 * that designer (PageService methods enforce read/write ownership).
 *
 * Indexed for fast "list pages owned by designer X" queries (called by the
 * platform when designer publishes a Gig).
 *
 * @since 2.0.777
 */

if (!defined('ABSPATH')) exit;
return [
    'description' => 'Pages owned by designer (multi-tenant workspace)',

    'up' => [
        "ALTER TABLE {prefix}instinctor_pages
            ADD COLUMN designer_id INT UNSIGNED NULL DEFAULT NULL AFTER id,
            ADD KEY designer_id (designer_id)",
    ],

    'down' => [
        "ALTER TABLE {prefix}instinctor_pages
            DROP KEY designer_id,
            DROP COLUMN designer_id",
    ],
];
