Branchwell

AI Resource Pro / website / MIGRATION-INSTRUCTIONS.md

Show the source

Image URL Migration Instructions

This document provides instructions for adding the image_url column to the tools table in the Supabase database.

Background

The application now supports separate icon and main image uploads for tools:

  • icon_url: Small icon for tools (already in database schema)
  • image_url: Main image for tools (needs to be added)

Steps to Apply Migration

  1. Make sure you have the latest code:
    ```bash
    git pull
    ```
  2. Install dependencies:
    ```bash
    npm install
    ```
  3. Run the migration script:
    ```bash
    npm run supabase:add-image-url
    ```
  4. Restart your application:
    ```bash
    npm run dev
    ```

What the Migration Does

  1. Adds an image_url column to the tools table
  2. Ensures the icon_url column exists (as a fallback)
  3. Refreshes the schema cache to ensure the new columns are recognized by Supabase

Troubleshooting

If you encounter any issues:

  1. Check if the migration applied correctly:
    ```sql
    SELECT column_name FROM information_schema.columns WHERE table_name = 'tools' AND column_name IN ('icon_url', 'image_url');
    ```
  2. If the columns exist but are not being recognized, try manually refreshing the schema cache:
    ```sql
    SELECT pg_reload_conf();
    ```
  3. If all else fails, you can manually add the columns:
    ```sql
    ALTER TABLE public.tools ADD COLUMN IF NOT EXISTS icon_url TEXT;
    ALTER TABLE public.tools ADD COLUMN IF NOT EXISTS image_url TEXT;
    ```