pagehive

update_table

Update a table's columns, read access, last-updated stamp, or name.

TablesChanges dataAll plans

What it does

Update a table's columns, read access, last-updated stamp, or name. Column changes bump schema_version. Set read_access public before a page calls bp.query, members_own so each member of the site reads only their own rows, site so everyone the site lets in reads every row and file, or own_and_shared for shared rows plus each member's and site agent's private rows. Only the owner moves a table out of members_own or own_and_shared. owner_browser true keeps a private site table private but lets the owner's own visit read it with bp.query. A rename repoints relation columns that name the table; a page that still names it blocks the rename.

Plans

Works on every plan: Free, Basic, Pro and Ultra.

Parameters

NameTypeAbout
namerequiredstringThe table to change.
new_namestringA new name for the table.
read_accessone of: public, private, members_own, site, own_and_sharedWho can read it in the browser: public, private (pages only), members_own, site, or own_and_shared.
owner_browserbooleanOn a private site table: true lets the owner's own visit read it in the browser.
columnsarray of objectsThe full new list of columns. Send every column you want to keep.
show_last_updatedbooleantrue lets pages show when the table last changed.
show_authorsbooleantrue: pages (GET /data, bp.query, Liquid) also get _created_by / _updated_by on each row. Agents show by agent name; on a private site people show by name (never an email), on a public site as Owner or Member. Default false.
site_idstringOnly for a site shared with you (whoami lists them): read or change that site's data as its member.

Example

Call update_table with these arguments:

{
  "name": "recipes",
  "columns": [
    {
      "key": "title",
      "type": "text",
      "required": true,
      "searchable": true
    },
    {
      "key": "minutes",
      "type": "number",
      "sortable": true
    },
    {
      "key": "vegetarian",
      "type": "checkbox"
    }
  ]
}

Ids like 01a1… stand for your own. list_sites and list_tables give you the real ones.

Related guides