Compare commits
3 Commits
feature/is
...
be2af1675a
| Author | SHA1 | Date | |
|---|---|---|---|
| be2af1675a | |||
|
|
b93f4677fc | ||
| 4eec4923af |
37
supabase/migrations/004_seed_units.sql
Normal file
37
supabase/migrations/004_seed_units.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
-- Migration: Seed Default Units
|
||||
-- Week 2: Pre-populate common measurement units with conversions
|
||||
|
||||
-- Weight units (metric base: gram)
|
||||
INSERT INTO units (id, name, abbreviation, unit_type, base_unit_id, conversion_factor, is_default, created_by) VALUES
|
||||
('f47ac10b-58cc-4372-a567-0e02b2c3d479', 'Gram', 'g', 'weight', NULL, 1.0, TRUE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440001', 'Kilogram', 'kg', 'weight', 'f47ac10b-58cc-4372-a567-0e02b2c3d479', 1000.0, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440002', 'Milligram', 'mg', 'weight', 'f47ac10b-58cc-4372-a567-0e02b2c3d479', 0.001, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440003', 'Pound', 'lb', 'weight', 'f47ac10b-58cc-4372-a567-0e02b2c3d479', 453.592, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440004', 'Ounce', 'oz', 'weight', 'f47ac10b-58cc-4372-a567-0e02b2c3d479', 28.3495, FALSE, NULL);
|
||||
|
||||
-- Volume units (metric base: milliliter)
|
||||
INSERT INTO units (id, name, abbreviation, unit_type, base_unit_id, conversion_factor, is_default, created_by) VALUES
|
||||
('550e8400-e29b-41d4-a716-446655440010', 'Milliliter', 'mL', 'volume', NULL, 1.0, TRUE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440011', 'Liter', 'L', 'volume', '550e8400-e29b-41d4-a716-446655440010', 1000.0, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440012', 'Centiliter', 'cL', 'volume', '550e8400-e29b-41d4-a716-446655440010', 10.0, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440013', 'Deciliter', 'dL', 'volume', '550e8400-e29b-41d4-a716-446655440010', 100.0, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440014', 'Cup', 'cup', 'volume', '550e8400-e29b-41d4-a716-446655440010', 236.588, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440015', 'Tablespoon', 'tbsp', 'volume', '550e8400-e29b-41d4-a716-446655440010', 14.7868, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440016', 'Teaspoon', 'tsp', 'volume', '550e8400-e29b-41d4-a716-446655440010', 4.92892, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440017', 'Fluid Ounce', 'fl oz', 'volume', '550e8400-e29b-41d4-a716-446655440010', 29.5735, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440018', 'Gallon', 'gal', 'volume', '550e8400-e29b-41d4-a716-446655440010', 3785.41, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440019', 'Quart', 'qt', 'volume', '550e8400-e29b-41d4-a716-446655440010', 946.353, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440020', 'Pint', 'pt', 'volume', '550e8400-e29b-41d4-a716-446655440010', 473.176, FALSE, NULL);
|
||||
|
||||
-- Count units (no conversions, each is independent)
|
||||
INSERT INTO units (id, name, abbreviation, unit_type, base_unit_id, conversion_factor, is_default, created_by) VALUES
|
||||
('550e8400-e29b-41d4-a716-446655440030', 'Piece', 'pc', 'count', NULL, 1.0, TRUE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440031', 'Dozen', 'doz', 'count', '550e8400-e29b-41d4-a716-446655440030', 12.0, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440032', 'Package', 'pkg', 'count', NULL, 1.0, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440033', 'Bottle', 'btl', 'count', NULL, 1.0, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440034', 'Can', 'can', 'count', NULL, 1.0, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440035', 'Jar', 'jar', 'count', NULL, 1.0, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440036', 'Box', 'box', 'count', NULL, 1.0, FALSE, NULL),
|
||||
('550e8400-e29b-41d4-a716-446655440037', 'Bag', 'bag', 'count', NULL, 1.0, FALSE, NULL);
|
||||
|
||||
COMMENT ON TABLE units IS 'Measurement units with 30 common presets covering metric, imperial, and count units';
|
||||
49
supabase/migrations/005_seed_tags.sql
Normal file
49
supabase/migrations/005_seed_tags.sql
Normal file
@@ -0,0 +1,49 @@
|
||||
-- Migration: Seed Default Tags
|
||||
-- Week 2: Pre-populate common organizational tags
|
||||
|
||||
-- Position Tags (where items are stored)
|
||||
INSERT INTO tags (id, name, category, icon, color, created_by) VALUES
|
||||
('650e8400-e29b-41d4-a716-446655440001', 'Fridge', 'position', '🧊', '#3b82f6', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440002', 'Freezer', 'position', '❄️', '#06b6d4', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440003', 'Pantry', 'position', '🗄️', '#8b5cf6', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440004', 'Cabinet', 'position', '🚪', '#6b7280', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440005', 'Countertop', 'position', '🍽️', '#f59e0b', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440006', 'Cellar', 'position', '🏚️', '#78350f', NULL);
|
||||
|
||||
-- Type Tags (food categories)
|
||||
INSERT INTO tags (id, name, category, icon, color, created_by) VALUES
|
||||
('650e8400-e29b-41d4-a716-446655440010', 'Dairy', 'type', '🧀', '#fbbf24', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440011', 'Meat', 'type', '🥩', '#ef4444', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440012', 'Fish', 'type', '🐟', '#3b82f6', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440013', 'Vegetables', 'type', '🥬', '#22c55e', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440014', 'Fruits', 'type', '🍎', '#f97316', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440015', 'Grains', 'type', '🌾', '#eab308', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440016', 'Legumes', 'type', '🫘', '#84cc16', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440017', 'Condiments', 'type', '🧂', '#ef4444', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440018', 'Snacks', 'type', '🍿', '#f97316', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440019', 'Beverages', 'type', '🥤', '#06b6d4', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440020', 'Baking', 'type', '🧁', '#ec4899', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440021', 'Spices', 'type', '🌶️', '#dc2626', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440022', 'Canned', 'type', '🥫', '#71717a', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440023', 'Frozen', 'type', '🧊', '#06b6d4', NULL);
|
||||
|
||||
-- Dietary Tags
|
||||
INSERT INTO tags (id, name, category, icon, color, created_by) VALUES
|
||||
('650e8400-e29b-41d4-a716-446655440030', 'Vegan', 'dietary', '🌱', '#22c55e', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440031', 'Vegetarian', 'dietary', '🥕', '#84cc16', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440032', 'Gluten-Free', 'dietary', '🌾', '#eab308', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440033', 'Lactose-Free', 'dietary', '🥛', '#60a5fa', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440034', 'Organic', 'dietary', '♻️', '#10b981', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440035', 'Low-Carb', 'dietary', '🥗', '#22c55e', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440036', 'Kosher', 'dietary', '✡️', '#3b82f6', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440037', 'Halal', 'dietary', '☪️', '#22c55e', NULL);
|
||||
|
||||
-- Custom/Workflow Tags
|
||||
INSERT INTO tags (id, name, category, icon, color, created_by) VALUES
|
||||
('650e8400-e29b-41d4-a716-446655440040', 'Low Stock', 'custom', '⚠️', '#ef4444', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440041', 'To Buy', 'custom', '🛒', '#3b82f6', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440042', 'Meal Prep', 'custom', '🍱', '#8b5cf6', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440043', 'Leftovers', 'custom', '♻️', '#f59e0b', NULL),
|
||||
('650e8400-e29b-41d4-a716-446655440044', 'Opening Soon', 'custom', '📆', '#f97316', NULL);
|
||||
|
||||
COMMENT ON TABLE tags IS 'Pre-populated with 33 common tags across position, type, dietary, and workflow categories';
|
||||
Reference in New Issue
Block a user