<?php
// File: includes/install.php

function afb_create_asana_accounts_table() {
    global $wpdb;
    $table_name = $wpdb->prefix . 'asana_accounts';
    $charset_collate = $wpdb->get_charset_collate();

    $sql = "CREATE TABLE $table_name (
        id INT AUTO_INCREMENT PRIMARY KEY,
        label VARCHAR(255) NOT NULL,
        pat TEXT NOT NULL,
        portfolio_gid VARCHAR(50) DEFAULT NULL,
        created_at DATETIME DEFAULT CURRENT_TIMESTAMP
    ) $charset_collate;";

    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    dbDelta($sql);
}
