# Variable sql_pg`Const`

sql_pg: "\ncreate table if not exists _sc_api_tokens (\n id serial primary key,\n user_id integer not null references users(id) on delete cascade,\n token text not null unique,\n created_at timestamp not null default now()\n);\ncreate index if not exists _sc_api_tokens_user_idx on _sc_api_tokens(user_id);\n\ninsert into _sc_api_tokens (user_id, token, created_at)\nselect u.id as user_id, u.api_token as token, now()\nfrom users u\nwhere u.api_token is not null and u.api_token <> ''\n and not exists (\n select 1 from _sc_api_tokens t where t.token = u.api_token\n );\n" = ...

- Defined in packages/saltcorn-data/migrations/202510110312.js:1