Spaces:
Sleeping

File size: 759 Bytes
a812c01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""One-off seeding script — loads data/byg_menu.json into Supabase.

Run manually after applying database/schema.sql:
    python seed.py

Never runs at startup; restarts must not touch production data.
"""

import sys

import config
from store import load_menu_from_file


def main():
    if not config.supabase_configured():
        sys.exit("SUPABASE_URL / SUPABASE_SERVICE_KEY not set — nothing to seed.")

    from supabase import create_client

    client = create_client(config.SUPABASE_URL, config.SUPABASE_SERVICE_KEY)
    items = load_menu_from_file()

    res = client.table("menu_items").upsert(items, on_conflict="name,category").execute()
    print(f"Seeded {len(res.data)} menu items into Supabase.")


if __name__ == "__main__":
    main()