Make an app block's tables
make_block_tablesMakes the tables an app block needs in the site's connected Supabase project, the same way as Make it for me on the block's card in Xodia: the block's ready-made tables with their exact fields and "who can see and change" rule (services and events: everyone sees, only the owner changes; bookings: each person sees their own, people with the role owner see all, and a database rule that refuses a booking past the service's seats; profiles: signed-in people see everyone's, each changes their own, one per person; comments: signed-in people read and each changes their own, or with rules a public thread everyone reads; likes: everyone sees, signed-in people add their own, one per person and entry; progress for the checklist: each person sees only their own ticks, one per item), plus a migration file in supabase/migrations/ on the branch. A table that is already there with the fields is used as it is. Answers bind: pass it to add_block. For block "upload" (and "editProfile" with storage true) it sets up the database's file storage, once per database: files is private (only the person who sent a file and people with the role owner open it, up to 10 MB) and pictures is public (anyone with a picture's address sees it, pictures only, up to 5 MB); each signed-in person adds, changes and removes only their own files. It never makes a bucket public, and makes a public files bucket private. Changes the user's live database at once, outside Xodia's Versions: say which tables you are making (or the storage) and who can see them before you call it; dryRun says what it would do first and changes nothing (on the Xodia database it also says when the database isn't on yet, when the real call answers data_not_on). Refused with block_table_mismatch (details.tables, field by field; nothing made) when a table with that name lacks the fields, with block_no_tables for a block that works on a table you pick (board) or uses none, with backend_storage_refused when Supabase doesn't allow the storage change, and with backend_storage_conflict when a pictures bucket there is private. With source "xodia" (or when get_project database.source is "xodia") it works on the site's own Xodia database, whose tables and rules are the file xodia/data-rules.json in the repo: the same tables go into that file with the indexes the blocks list along, and a table already there under the name is merged (it gets the fields and indexes it lacks) instead of refused. No file uploads there yet. It refuses a booking past a service's seats (the booking widget shows the seats left), but not yet a second entry per person: the answer says so. No tool deletes or renames a table or field, deletes entries, or runs SQL: the owner does that in Xodia's Database view (Content, Database).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"block": "<block>",
"projectId": "<projectId>"
},
"name": "make_block_tables"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| block | Yes | The app block whose tables to make: "bookingWidget" (services and bookings), "myBookings" (services and bookings), "calendar" (events), "profile" (profiles), "editProfile" (profiles), "comments" (comments), "likes" (likes), "checklist" (progress). Other blocks work on a table you pick (bind in add_block) and make none | |
| names | No | Optional other names for the tables, by recipe ({ "bookings": "class_bookings" }), when a table with the usual name is there but doesn't fit. Default: the recipe's own name (services, bookings, events, profiles, comments, likes, progress) | |
| rules | No | Optional: who can see a new table's entries, for recipes with a choice. comments: "signed_in_reads_own_writes" (default, signed-in people see everyone's, each changes only their own) or "everyone_reads_signed_in_adds" (public thread: Anyone can read the comments. People who are signed in add one and change their own.). Ask the owner when it isn't clear; a client portal or a course keeps the default. Only for tables it makes; a table that is there keeps its rule | |
| branch | No | Optional branch for the migration file; default the branch the workspace has open | |
| dryRun | No | true: only say which tables are there, which would be made and which don't fit, with the bind; nothing changes. Default false | |
| source | No | Which database: "xodia" (the site's own Xodia database, kept by Xodia) or "supabase" (the Supabase project the owner connected). Leave out to use the one get_project database.source names | |
| storage | No | editProfile only: true also sets up file storage so people upload their profile picture. The upload block always sets it up. Default false | |
| projectId | Yes | Project id from list_projects |