Upgrade (projects must change): a schema is {"table", "control", "sql"} and a table only {"column": [...]}; startup stops on each removed setting or key and names its replacement.
- Column keys renamed:
is_primary→is_primary_key,is_mandatory→is_not_null,old→old_name,in(a tuple) →allowed_values(a list).uniqueis a list of column lists ("code,type|code,slug"→[["code", "type"], ["code", "slug"]]),indexa list of texts ("btree(a,b)|gin(c)"→["btree(a,b)", "gin(c)"]). - Column access:
is_private_read_blocked: True→"read_blocked": ["private"];config_column_read_blocked→"read_blocked": ["my", "public", "private", "admin"]on each column (Atom's:users.password,users.totp_secret,users.totp_recovery,api_key.key_hash,webhook.secret);config_column_admin→"write_blocked": ["my", "public"]on each column only an admin may set;users_accessmy_update_blocked→"write_blocked": ["my"];config_column_users_blocked→"write_blocked": ["my", "public", "private", "admin"];config_column_ownership_read,_update,_delete→"ownership": ["read", "update", "delete"]on each owner column (created_by_idneeds none);config_column_audit_blocked→ nothing (the audit columns are always Atom's). userslists, flat inconfig.py# auth:users_accesstoken(wasconfig_column_token_encode) →config_users_token_column,private_read(wasconfig_column_users_private_read) →config_users_private_read_column,update_alone(wasconfig_column_single_update) →config_users_update_alone_column. The whole# columnsection ofconfig.pyis gone.- Table keys move to
controlas lists of tables:public→public_create,public_read;private→private_read;my→my_create,my_read,my_update,my_delete,my_delete_all;row_lock→row_update_disabled,row_delete_disabled;row_delete_max,buffer_limit,retention_day→{table: number}.adminandusers_delete_skipare gone (delete them). The schema's top-levelextension→control.extension. controlrenamed or moved:is_truncate_table→is_truncate_disabled(True =TRUNCATEblocked, defaultTruein every database: a database that truncates on purpose, e.g. nightly reloads, sets"is_truncate_disabled": Falsein its owncontrol);is_root_user_createandis_root_user_delete_disabled→config_is_root_user;is_log_users_password→config_is_users_password_log;is_log_users_delete→config_is_users_delete_log;is_totp_clear→config_is_totp_clear(# totp).config_column_regex→regexandregex_messageon each column (Atom'susername,password,email_secondary,mobile_secondaryare onusers). Code that passedconfig_column_regex=app_state.config_column_regexpassesapp_state.func_column_regex(app_state=app_state, table=<table>, connection=<db>). Before deploying, check that every existing value matches its column'sregex: the database adds it as aCHECK.- Function parameters named after removed settings are renamed:
config_column_read_blocked=→read_blocked=(func_postgres_read,func_postgres_read_sql,func_postgres_read_group,func_postgres_read_export,func_postgres_where_build,func_postgres_relation,func_postgres_table_column_groupby_read,func_postgres_table_column_distinct_read; passapp_state.func_object_read_blocked(app_state=app_state, table=<table>, group=<group>), or[]),config_column_regex=→column_regex=(func_postgres_create,func_postgres_update,func_user_create,func_user_update,func_user_password_set,func_regex_check),config_column_token_encode=→token_column=(func_token_encode,func_api_key_decode,func_auth_login_finish,func_auth_login_totp). A call with the old keyword fails withTypeError: unexpected keyword argument. - The user functions' parameters too:
func_user_update/func_user_update_checktakeupdate_alone_column,write_blocked_all(refused for everyone) andwrite_blocked_my(refused in the user's own update) instead ofconfig_column_single_update,config_column_users_blocked,config_column_users_my_blocked;func_postgres_importtakesuser_idinstead ofcreated_by_id. config_apicacheandrate_limittake only their dict ({"mode", "ttl_sec", "is_per_user"},{"mode", "limit", "window_sec"}): the list form,is_user_cache, and the old keysapi_cache_sec/api_ratelimiting_times_secstop startup.func_middleware_api_cacheandfunc_middleware_check_ratelimiterlose theirapi_cache_sec/api_ratelimiting_times_secarguments.- A project's
controlaccess lists must keep Atom's tables ([*base_config_postgres_schema_master["control"]["my_read"], "task"]); startup names a dropped one. A table moved to another database (log_api) may leave master's lists.
What changed:
- Who enforces each key.
config.mdgives every schema key an "Enforced by": structure, database rule (holds even against raw SQL), API rule (only through Atom's routes), both (regex), or script (retention_day). Naming:_disabledis enforced by the database,_blockedby Atom's routes. - One gate for the table routes.
func_object_access(function/object.py) checks, for/public,/private,/my,/adminobject and table-column routes and CSV import: the table (and every joined table) is in the group'scontrolaccess list (admin: any table of the schema), else 403 naming what to add; for/my,ownership_columniscreated_by_idor a column whoseownershiplists the action; on create and update, no audit column and no columnwrite_blockedfor the group (400); on read, it returns the group'sread_blockedcolumns. Project routes are free; the SQL runners are not affected. - Audit columns are always Atom's.
created_at(database default),created_by_id(token, on create; always the owner),updated_at(trigger),updated_by_id(token, on update),deleted_at(database clock, on soft delete) anddeleted_by_id(token, on soft delete): any request that sends one gets 400,/myand/publicincluded (AUDIT_COLUMNS). - Soft delete and restore.
/admin/object-delete?mode=soft|restore(bodytable,ids),/my/object-delete?mode=soft(own rows),/admin/user-delete?mode=soft|restore&id=,/my/user-delete?mode=soft(own account). Soft setsdeleted_at = now()anddeleted_by_id= the token's user; restore setsdeleted_atback toNULL. The default mode stayshard. controlis checked whole. Startup refuses an unknown key, a name that is not a table of the schema,usersin any write access list,row_update_disabledonusers,otp,script_runorqueue_job, andretention_dayonusers, on a table inrow_delete_disabledorrow_delete_max, or withoutcreated_at.- Login users live in
masteronly: the users setup (admin user, root delete guard, password and delete logs, two-factor clear) runs only onmaster, switched by the flat settingsconfig_is_root_user,config_is_users_password_log,config_is_users_delete_logandconfig_is_totp_clear; auserstable in another database is a plain table.config_is_users_delete_logoff means deleted users' data is never cleaned (the users-delete worker takes its tasks fromlog_users_delete).func_postgres_schema_initandfunc_postgres_schema_plantakedatabase(defaultmaster). See database.md. - Format rules per column. A column's
regexis checked by the API on every create and update (withregex_messageas the error, default<column>: invalid format) and enforced by the database as aCHECK.users.passwordis checked by the API only, before it is hashed. Startup buildscache_column_regex({database: {table: {column: [pattern, message]}}});func_column_regexgives one table's rules. - Read replicas need only their
.envline. A database without its ownconfig_postgres_schema_<name>follows master's rules (access lists, column rules, buffer limits, regex:func_postgres_rule_database), so?connection=replica1reads what master allows. The writes a read makes (mark-as-read,last_active_at) go to master./my/profileand/private/user-readtake master or a replica of it; a database with its own schema gets 400users live in master(func_check_connection_master). - Admin writes any table of the schema:
/admin/object-createand/admin/object-updatesetcreated_by_id/updated_by_idonly when the table has them (a TimescaleDB table without them can be written);/myand/publicstill need them. CSV import setsupdated_by_idon updated rows and checks access for its own action. /private/user-readhidesread_blockedprivate columns even when a project lists one inconfig_users_private_read_column.- Atom's
sqlis empty: every trigger Atom adds has a switch incontrolor a flat setting;sqlis kept for the project's own SQL.