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>
37 lines
1.0 KiB
SQL
37 lines
1.0 KiB
SQL
-- +goose Up
|
|
CREATE TABLE ingredient_mappings (
|
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v7(),
|
|
canonical_name VARCHAR(255) NOT NULL,
|
|
canonical_name_ru VARCHAR(255),
|
|
spoonacular_id INTEGER UNIQUE,
|
|
|
|
aliases JSONB NOT NULL DEFAULT '[]'::jsonb,
|
|
|
|
category VARCHAR(50),
|
|
default_unit VARCHAR(20),
|
|
|
|
-- Nutrients per 100g
|
|
calories_per_100g DECIMAL(8, 2),
|
|
protein_per_100g DECIMAL(8, 2),
|
|
fat_per_100g DECIMAL(8, 2),
|
|
carbs_per_100g DECIMAL(8, 2),
|
|
fiber_per_100g DECIMAL(8, 2),
|
|
|
|
storage_days INTEGER,
|
|
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE INDEX idx_ingredient_mappings_aliases
|
|
ON ingredient_mappings USING GIN (aliases);
|
|
|
|
CREATE INDEX idx_ingredient_mappings_canonical_name
|
|
ON ingredient_mappings (canonical_name);
|
|
|
|
CREATE INDEX idx_ingredient_mappings_category
|
|
ON ingredient_mappings (category);
|
|
|
|
-- +goose Down
|
|
DROP TABLE IF EXISTS ingredient_mappings;
|