Define uuid_generate_v7() in the first migration and switch all table primary key defaults to it. Remove the uuid-ossp extension dependency. Update refresh token and request ID generation in Go code to use uuid.NewV7() from the existing google/uuid v1.6.0 library. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26 lines
866 B
SQL
26 lines
866 B
SQL
-- +goose Up
|
|
CREATE TABLE saved_recipes (
|
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v7(),
|
|
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
title TEXT NOT NULL,
|
|
description TEXT,
|
|
cuisine TEXT,
|
|
difficulty TEXT,
|
|
prep_time_min INT,
|
|
cook_time_min INT,
|
|
servings INT,
|
|
image_url TEXT,
|
|
ingredients JSONB NOT NULL DEFAULT '[]',
|
|
steps JSONB NOT NULL DEFAULT '[]',
|
|
tags JSONB NOT NULL DEFAULT '[]',
|
|
nutrition JSONB,
|
|
source TEXT NOT NULL DEFAULT 'ai',
|
|
saved_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE INDEX idx_saved_recipes_user_id ON saved_recipes(user_id);
|
|
CREATE INDEX idx_saved_recipes_saved_at ON saved_recipes(user_id, saved_at DESC);
|
|
|
|
-- +goose Down
|
|
DROP TABLE saved_recipes;
|