github atom36942/atom v24.0.0
Atom 24.0.0

latest releases: v25.1.0, v25.0.0, v24.0.1...
one hour ago

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). unique is a list of column lists ("code,type|code,slug" → [["code", "type"], ["code", "slug"]]), index a 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_access my_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_id needs none); config_column_audit_blocked → nothing (the audit columns are always Atom's).
  • users lists, flat in config.py # auth: users_access token (was config_column_token_encode) → config_users_token_column, private_read (was config_column_users_private_read) → config_users_private_read_column, update_alone (was config_column_single_update) → config_users_update_alone_column. The whole # column section of config.py is gone.
  • Table keys move to control as 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}. admin and users_delete_skip are gone (delete them). The schema's top-level extension → control.extension.
  • control renamed or moved: is_truncate_table → is_truncate_disabled (True = TRUNCATE blocked, default True in every database: a database that truncates on purpose, e.g. nightly reloads, sets "is_truncate_disabled": False in its own control); is_root_user_create and is_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 → regex and regex_message on each column (Atom's username, password, email_secondary, mobile_secondary are on users). Code that passed config_column_regex=app_state.config_column_regex passes app_state.func_column_regex(app_state=app_state, table=<table>, connection=<db>). Before deploying, check that every existing value matches its column's regex: the database adds it as a CHECK.
  • 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; pass app_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 with TypeError: unexpected keyword argument.
  • The user functions' parameters too: func_user_update / func_user_update_check take update_alone_column, write_blocked_all (refused for everyone) and write_blocked_my (refused in the user's own update) instead of config_column_single_update, config_column_users_blocked, config_column_users_my_blocked; func_postgres_import takes user_id instead of created_by_id.
  • config_api cache and rate_limit take only their dict ({"mode", "ttl_sec", "is_per_user"}, {"mode", "limit", "window_sec"}): the list form, is_user_cache, and the old keys api_cache_sec / api_ratelimiting_times_sec stop startup. func_middleware_api_cache and func_middleware_check_ratelimiter lose their api_cache_sec / api_ratelimiting_times_sec arguments.
  • A project's control access 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.md gives 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: _disabled is enforced by the database, _blocked by Atom's routes.
  • One gate for the table routes. func_object_access (function/object.py) checks, for /public, /private, /my, /admin object and table-column routes and CSV import: the table (and every joined table) is in the group's control access list (admin: any table of the schema), else 403 naming what to add; for /my, ownership_column is created_by_id or a column whose ownership lists the action; on create and update, no audit column and no column write_blocked for the group (400); on read, it returns the group's read_blocked columns. 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) and deleted_by_id (token, on soft delete): any request that sends one gets 400, /my and /public included (AUDIT_COLUMNS).
  • Soft delete and restore. /admin/object-delete?mode=soft|restore (body table, ids), /my/object-delete?mode=soft (own rows), /admin/user-delete?mode=soft|restore&id=, /my/user-delete?mode=soft (own account). Soft sets deleted_at = now() and deleted_by_id = the token's user; restore sets deleted_at back to NULL. The default mode stays hard.
  • control is checked whole. Startup refuses an unknown key, a name that is not a table of the schema, users in any write access list, row_update_disabled on users, otp, script_run or queue_job, and retention_day on users, on a table in row_delete_disabled or row_delete_max, or without created_at.
  • Login users live in master only: the users setup (admin user, root delete guard, password and delete logs, two-factor clear) runs only on master, switched by the flat settings config_is_root_user, config_is_users_password_log, config_is_users_delete_log and config_is_totp_clear; a users table in another database is a plain table. config_is_users_delete_log off means deleted users' data is never cleaned (the users-delete worker takes its tasks from log_users_delete). func_postgres_schema_init and func_postgres_schema_plan take database (default master). See database.md.
  • Format rules per column. A column's regex is checked by the API on every create and update (with regex_message as the error, default <column>: invalid format) and enforced by the database as a CHECK. users.password is checked by the API only, before it is hashed. Startup builds cache_column_regex ({database: {table: {column: [pattern, message]}}}); func_column_regex gives one table's rules.
  • Read replicas need only their .env line. A database without its own config_postgres_schema_<name> follows master's rules (access lists, column rules, buffer limits, regex: func_postgres_rule_database), so ?connection=replica1 reads what master allows. The writes a read makes (mark-as-read, last_active_at) go to master. /my/profile and /private/user-read take master or a replica of it; a database with its own schema gets 400 users live in master (func_check_connection_master).
  • Admin writes any table of the schema: /admin/object-create and /admin/object-update set created_by_id / updated_by_id only when the table has them (a TimescaleDB table without them can be written); /my and /public still need them. CSV import sets updated_by_id on updated rows and checks access for its own action.
  • /private/user-read hides read_blocked private columns even when a project lists one in config_users_private_read_column.
  • Atom's sql is empty: every trigger Atom adds has a switch in control or a flat setting; sql is kept for the project's own SQL.

Don't miss a new atom release

NewReleases is sending notifications on new releases.