10.0 Migration Guide
- Dependencies upgrade
- One edition under the Axelor Commercial License
- Client IP address read from a single header
- API keys can be restricted by IP address
- Record user authentications
- OpenID Connect private key JWT client authentication reads a JWKS file
- Quote cache region names in Caffeine
application.conf - Type names in JavaScript scripts are host types
- Removed
TenantAwareandAuditableRunner - Removed
sequentialattribute on entities context.appLogoandcontext.appIconmethods require amodeparameter- Report files are served by token
- Full migration script
In this document, we will see the major steps to migrate from 8.2 to 10.0.
| Please check the changelog for a detailed list of fixes, changes, and improvements introduced in 10.0. |
Dependencies upgrade
Dependencies have been upgraded. Check the changelog for a detailed list.
Gradle has also been upgraded to a newer version. Upgrade the Gradle Wrapper to benefit from new features and
improvements: ./gradlew wrapper --gradle-version=9.8.2 && ./gradlew wrapper.
Check the Gradle migration guides to update your builds: Upgrading to Gradle 9.0.0 and Upgrading within Gradle 9.x.y.
One edition under the Axelor Commercial License
Axelor Open Platform no longer has separate Community and Enterprise editions. All features of the Enterprise Edition
are now part of axelor-core and axelor-web: AI assistants and agents, Studio, global search, real-time
collaboration on views, data import/export, and additional SSO settings.
License
The whole platform is now distributed under the Axelor Commercial License, instead of the AGPL v3 for the former
Community Edition. Check the LICENSE file, and make sure your use of the platform is covered by an agreement with
Axelor.
Dependencies
Applications using the Axelor Gradle plugin get dependencies as before. If you used the Enterprise
Edition, remove the axelor.platform.ee property from gradle.properties, it is no longer used.
Former EE classes
com.axelor.app.EnterpriseAvailableAppSettings has been merged into com.axelor.app.AvailableAppSettings.
com.axelor.app.EnterpriseAppFeatures has been renamed to com.axelor.app.AppFeatures.
Replace any references in your Java code and expressions in views.
The other Enterprise* classes have been merged into their base classes, such as EnterpriseInfoService into
InfoService or EnterpriseAuthPac4jInfo into AuthPac4jInfo. If your code extends or injects them, use the base
classes instead.
ClientListService is now a concrete class and its implementation subclass is no longer discovered automatically.
Use Guice binding explicitly in case of any ClientListService customization.
Features enabled by default
The AI and Studio features are enabled by default, so their menus are shown to administrators. They can be disabled in
axelor-config.properties:
features.ai = false
features.studio = false
Studio deployments
A view deployed from Studio is now an <extend> of the module view it customizes, instead of a copy of the whole view at
priority 100. It composes with the module’s own extensions, and the module view’s later changes show through. Views
deployed by the former EE keep masking the module view until they are deployed again: redeploy them to convert them.
Actions, menus, selections and queries deployed from Studio are now owned by their app. Deploying one whose name another app already uses is refused, where it used to overwrite the other app’s. Rename one of them before redeploying.
Database
Former CE databases
Former CE databases need the tables of the new features (AI, Studio, global search, export configurations…), and new columns on some existing tables. See From a former Community Edition database below.
Every entity now has an importId field, used to match existing records when importing data, as in the former EE. It
adds a unique import_id column to every table. The migration script adds it to every entity table of the current
schema, those of the platform and those of your own entities, which are the tables with both an id and a version
column. With one schema per tenant, run that part of the script on each schema.
Former EE databases
Former EE databases still have the views, actions, menus and selections loaded by the EE module. On startup, application doesn’t update them but creates new records, because it only looks for records of its own module. The former records would stay in the database, and the former extension views would still be applied on top of the core views, which now already include them. This would duplicate their fields.
The script for former EE databases, see From a former Enterprise Edition database below, starts by removing the former extension
views. It hands the other records over to axelor-core, so that they are updated in place and keep their references,
then removes the former module. The computed views of the core views that the former extension views applied to are
then regenerated on startup.
Client IP address read from a single header
The client IP address, ie what getRemoteAddr() returns behind the proxy filter, is now the left-most address of a
single header: the header configured with the new application.client-ip-header setting, such as X-Real-IP, or
X-Forwarded-For if none is configured. That address is validated and normalized, ie any port suffix is stripped and
IPv6 addresses are canonicalized, whereas the left-most X-Forwarded-For value was previously used as it is.
If that header is missing, or doesn’t provide a valid IP address, the address of the direct connection is used. There is no fallback to other headers, as the reverse proxy may not overwrite them, so they may have been forged by the client.
This header is trusted as it is, so the reverse proxy must overwrite it, and the application must only be reachable through the proxy.
Previous versions of this guide recommended proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
for nginx. This keeps the X-Forwarded-For value sent by the client, whose left-most address would then be used as the
client address. Update the nginx configuration:
|
proxy_set_header X-Forwarded-For $remote_addr;
See Client IP address for the full requirements, including deployments without a reverse proxy or behind a CDN.
API keys can be restricted by IP address
API keys can now be restricted to a list of IP addresses or CIDR ranges. A restricted API key used from any other address is rejected. Existing API keys have no restriction, so they keep working from any address.
The address checked against that list is the client IP address, as resolved in Client IP address read from a single header. Make sure the reverse proxy is configured as described there before restricting API keys: otherwise, clients can forge their address and bypass the restriction.
A new allowed_ips column is added to the auth_user_token table, see the migration script below.
Record user authentications
Successful interactive logins are now recorded as AuthenticationEvent records: sign-in with the login form (local
or LDAP), indirect basic authentication and single sign-on providers (OpenID Connect, OAuth, SAML, CAS…). Each event
stores the user, a human-readable provider name, the IP address, the date, and some details such as the second factor
used and the user agent. See Authentication Events for more
details.
Users other than administrators need a read permission on com.axelor.auth.db.AuthenticationEvent to see their own
history, and they will only ever see their own events.
A new auth_authentication_event table is required. See the Full migration script below.
Authentication events are kept for 180 days, then deleted by the new authentication.events.purge scheduled job,
which runs every day. The retention period can be changed with the auth.events.retention
setting.
This scheduled job is only created on new databases. On an existing database, create it from , with:
-
Name:
authentication.events.purge -
Description:
Delete older authentication events -
Job:
com.axelor.auth.events.job.AuthenticationEventPurgeJob -
Cron:
0 0 5 * * ?(every day at 5 AM) -
Active: checked
or run the following SQL script :
INSERT INTO meta_schedule (id, version, created_on, active, cron, description, job, name)
VALUES (nextval('meta_schedule_seq'), 0, now(), true, '0 0 5 * * ?',
'Delete older authentication events','com.axelor.auth.events.job.AuthenticationEventPurgeJob',
'authentication.events.purge');
OpenID Connect private key JWT client authentication reads a JWKS file
The signing key of the private_key_jwt client authentication method is now read from a JWKS file. Configuring a
private key with the private-key.path, private-key.algorithm, jws-algorithm and key-id settings is no longer
supported.
Replace these settings with jwks.path and jwks.kid:
# Before
auth.provider.keycloak.private-key-jwt-client-authn-method-config.jws-algorithm = RS256
auth.provider.keycloak.private-key-jwt-client-authn-method-config.private-key.path = private-key.pem
auth.provider.keycloak.private-key-jwt-client-authn-method-config.private-key.algorithm = RSA
auth.provider.keycloak.private-key-jwt-client-authn-method-config.key-id = 12345
# After
auth.provider.keycloak.private-key-jwt-client-authn-method-config.jwks.path = /path/to/clientauthprivatekeyjwt.jwks
auth.provider.keycloak.private-key-jwt-client-authn-method-config.jwks.kid = 12345
See Advanced OpenID Connect configuration for more details.
Quote cache region names in Caffeine application.conf
Caffeine 3.3.0 matches cache region names under caffeine.jcache as exact keys. Region names containing dots (such as
entity or collection names) must be quoted in application.conf. Without quotes, dots are parsed as nested paths,
so the region is not matched and silently falls back to default settings.
Update custom application.conf files:
caffeine.jcache {
# Before
com.example.db.MyEntity {
policy.maximum.size = 500
}
# After
"com.example.db.MyEntity" {
policy.maximum.size = 500
}
}
See Persistence Cache Configuration for the default regions.
Type names in JavaScript scripts are host types
In JavaScript action-scripts and expressions, a bare type name (a model, a repository, or a helper such as
LocalDateTime) now resolves to a host type instead of a java.lang.Class instance. Static members and constructors
now work, such as LocalDateTime.now() or new Contact(), and the name is still accepted wherever a Class is
expected (repo(Contact), record instanceof Contact). Groovy scripts are unchanged.
java.lang.Class methods are no longer callable on the bare name. Update such calls:
| Before | After |
|---|---|
|
|
|
|
|
|
|
|
A call left unchanged fails at run time with TypeError: … Unknown identifier: <method>. To find them ahead of time,
search action XML files and the xml column of meta_action for a capitalized receiver calling one of these methods:
grep -rEn '\b[A-Z][A-Za-z0-9_]*\.(getName|getSimpleName|getCanonicalName|isInstance|isAssignableFrom)\(' .
Only matches whose receiver is a model class name need changing.
Removed TenantAware and AuditableRunner
com.axelor.db.tenants.TenantAware and com.axelor.auth.AuditableRunner, deprecated since 8.0, are removed. Use
ContextAware to build a ContextAwareRunnable or ContextAwareCallable that propagates the tenant, user, base URL
and language to the task.
Migrate from TenantAware :
// ❌ Old code
executor.submit(new TenantAware(() -> {
// work with database
})
.tenantId("some-tenant"));
// ✅ New code
executor.submit(ContextAware.of().withTenantId("some-tenant").build(() -> {
// work with database
}));
Like TenantAware, ContextAware runs the task inside a new transaction by default. Use .withTransaction(false)
to disable it.
Migrate from AuditableRunner :
// ❌ Old code
Beans.get(AuditableRunner.class).run(job);
// ✅ New code
ContextAware.of().withTransaction(false).withUser(AuthUtils.getUser("admin")).build(job).call();
AuditableRunner fell back to the admin user when no user was authenticated, and didn’t open a
transaction. ContextAware uses the current user and has no fallback: in a non-servlet environment (scheduler, batch),
provide the user explicitly with .withUser(…).
|
See Multi-tenancy for more details.
Removed sequential attribute on entities
The sequential attribute on <entity> definitions, deprecated and ignored since 8.0, is removed from the domain
models schema. Each entity uses its own dedicated sequence (<entity_name>_seq). Remove the attribute from domain XML
files.
context.appLogo and context.appIcon methods require a mode parameter
The methods referenced by the context.appLogo and context.appIcon settings must now accept a single String mode
parameter, either light or dark, or null meaning light. The legacy no-argument methods, deprecated since 7.3,
are no longer called: the default logo/icon (application.logo/application.logo-dark and
application.icon/application.icon-dark) is used instead.
// ❌ Old code
public MetaFile getLogo() {
// ...
}
// ✅ New code
public MetaFile getLogo(String mode) {
// ...
}
See Custom Logo/Icon for more details.
Report files are served by token
The ws/files/report endpoint, which accepted a temporary file name with the link parameter, has been removed. Such
URLs, built manually and opened in an html view, no longer work.
Report files are now served by the ws/files/data-export endpoint, which only accepts a token parameter, provided by
ActionResponse.setFile and action-report actions. The file content (passed as a Path or an InputStream) is
copied to a dedicated temporary file for pending export. A token is only valid for the user who created it, and expires
after 5 minutes.
ActionResponse.setFile takes a ResponseFile, created with either:
-
ResponseFile.preview, which the client opens in a new tab for preview if supported by the browser; otherwise, it downloads it. -
ResponseFile.download, which the client always downloads.
// ❌ Old code opening a link to a temporary file
String fileLink = "ws/files/report?link=" + file.getName() + "&name=" + fileName;
response.setView(ActionView.define(title).add("html", fileLink).map());
// ✅ New code: open the report in a new tab
response.setFile(ResponseFile.preview(path, fileName).title(title)); // title is optional, defaults to file name
// ✅ New code: download the report
response.setFile(ResponseFile.download(path, fileName));
// ✅ New code using an input stream
try (InputStream inputStream = /* any input stream source */) {
response.setFile(ResponseFile.preview(inputStream, fileName).title(title));
}
The ActionResponse.setExportFile methods have been removed. Use ActionResponse.setFile with
ResponseFile.download instead:
// ❌ Old code
response.setExportFile(path, fileName);
response.setExportFile(inputStream, fileName);
// ✅ New code
response.setFile(ResponseFile.download(path, fileName));
response.setFile(ResponseFile.download(inputStream, fileName));
ResponseFile.preview and ResponseFile.download take a Path or an InputStream, not a String path. A
relative Path is resolved in the temporary directory (data.upload.temp-dir), and must not resolve outside of it.
|
For custom client code handling action results, the exportFile, exportToken, report, reportLink, reportFile
and reportFormat keys have been replaced by a single export object:
{
"export": {
"file": "invoice.pdf", // name of the file
"token": "...", // token to download the file with `ws/files/data-export?token=`, absent if attached
"format": "pdf", // file extension
"title": "Invoice", // optional title of the tab
"download": true // whether to download the file instead of opening it
}
}
Full migration script
Before the first start on 10.0, run the script for the edition your database comes from.
From a former Community Edition database
This script creates the tables of the new features, and those of the features of the former Enterprise Edition. It adds
the import_id column to the entity tables, those of your own entities included, and reports each table it changes.
-- New features of the platform
ALTER TABLE auth_user_token ADD allowed_ips varchar(2048);
create table auth_authentication_event
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_2g1lkkqpt06x5kk5ipxtin1lq unique,
version integer,
created_on timestamp(6),
details jsonb,
ip_address varchar(255),
provider varchar(255),
status integer not null,
user_id bigint constraint fk_fcd7fnyrr3qavk2xuco4ov3d8 references auth_user
);
create index auth_event_idx_user on auth_authentication_event (user_id, created_on);
create index auth_event_idx_created_on on auth_authentication_event (created_on);
create index auth_authentication_event_user_id_idx on auth_authentication_event (user_id);
create sequence auth_authentication_event_seq;
INSERT INTO meta_schedule (id, version, created_on, active, cron, description, job, name)
VALUES (nextval('meta_schedule_seq'), 0, now(), true, '0 0 5 * * ?',
'Delete older authentication events','com.axelor.auth.events.job.AuthenticationEventPurgeJob',
'authentication.events.purge');
create table meta_workflow
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_awlv038fbaqaa2rvuegs4qgfc unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
active boolean,
current_revision integer,
json_model varchar(255),
model varchar(255) not null,
module varchar(255),
name varchar(255) not null,
priority integer,
sequence integer,
trigger_type varchar(255) not null,
xml text not null,
xml_id varchar(255) not null constraint uk_t8ckmogkpeb6vaelodrp5eihe unique,
created_by bigint constraint fk_ryohc14hcv08ddclqo8ljvhgv references auth_user,
updated_by bigint constraint fk_7bt0qi15qhnla7x2jg8ajaxsw references auth_user,
studio_project bigint
);
create index meta_workflow_name_idx on meta_workflow (name);
create index meta_workflow_studio_project_idx on meta_workflow (studio_project);
create sequence meta_workflow_seq;
create table meta_workflow_run
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_a1i89dwh7532hqtjj43nql02b unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
caller_node varchar(255),
caller_park_key varchar(255),
ended_at timestamp(6),
episode bigint,
error_message text,
json_model varchar(255),
last_node varchar(255),
model varchar(255) not null,
record_id bigint,
started_at timestamp(6),
status varchar(255),
trigger_type varchar(255),
workflow varchar(255),
workflow_name varchar(255) not null,
workflow_revision integer,
created_by bigint constraint fk_jl3ppytvd7giqclkopxrgydah references auth_user,
updated_by bigint constraint fk_r72rf21xi4jw0te68pgl3csfp references auth_user,
parent_run bigint constraint fk_gf7km92df9h6bkknld1khe2xq references meta_workflow_run,
started_by bigint constraint fk_2auw9yrs9ntyrqrrn167smmh references auth_user
);
create index meta_workflow_run_model_record_id_idx on meta_workflow_run (model, record_id);
create index meta_workflow_run_parent_run_idx on meta_workflow_run (parent_run);
create index meta_workflow_run_started_by_idx on meta_workflow_run (started_by);
create index meta_workflow_run_workflow_status_idx on meta_workflow_run (workflow, status);
create sequence meta_workflow_run_seq;
create table meta_workflow_split
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_biu19a27co2anwba3yhxrtfqp unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
activated integer,
arrived integer,
decision varchar(255),
ended integer,
join_node varchar(255),
lease_owner varchar(255),
lease_token varchar(255),
leased_at timestamp(6),
outstanding integer,
park_key varchar(255),
quorum integer,
split_node varchar(255) not null,
status varchar(255) not null,
wait varchar(255),
winners varchar(255),
created_by bigint constraint fk_6atv2epyf23vqixbnn3bmu0fo references auth_user,
updated_by bigint constraint fk_9f75x8skkxxhrjdctb7ibk61i references auth_user,
parent_branch bigint,
run bigint not null constraint fk_r9pgt38ucn45tr928qsqpbmvh references meta_workflow_run
);
create index meta_workflow_split_parent_branch_idx on meta_workflow_split (parent_branch);
create index meta_workflow_split_run_idx on meta_workflow_split (run);
create index meta_workflow_split_run_status_idx on meta_workflow_split (run, status);
create index meta_workflow_split_status_leased_at_idx on meta_workflow_split (status, leased_at);
create sequence meta_workflow_split_seq;
create table meta_workflow_branch
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_oy85pffls5agv0gso3sg7hwj2 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
bindings text,
current_node varchar(255),
flow varchar(255),
join_node varchar(255),
json_model varchar(255),
lease_owner varchar(255),
lease_token varchar(255),
leased_at timestamp(6),
model varchar(255),
park_key varchar(255),
record_id bigint,
start_node varchar(255),
status varchar(255) not null,
subflow varchar(255),
vars text,
wake_at timestamp(6),
created_by bigint constraint fk_cvcse5klb63le9ve8nvo7lg4o references auth_user,
updated_by bigint constraint fk_3xukqj2skb5p7lsaj8i6ub8fw references auth_user,
run bigint not null constraint fk_jyxk7idxi3xvo5371n8fqpbhv references meta_workflow_run,
split bigint constraint fk_a3n2ve6hp4qgybok3mj7qfho0 references meta_workflow_split,
constraint uk_6jj60fl44yhwr01vikwiif1yi
unique (split, flow)
);
create index meta_workflow_branch_run_idx on meta_workflow_branch (run);
create index meta_workflow_branch_run_status_idx on meta_workflow_branch (run, status);
create index meta_workflow_branch_split_idx on meta_workflow_branch (split);
create index meta_workflow_branch_split_status_idx on meta_workflow_branch (split, status);
create index meta_workflow_branch_status_wake_at_idx on meta_workflow_branch (status, wake_at);
create sequence meta_workflow_branch_seq;
create table meta_workflow_capture
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_gpewwdiow99x3xkjagruqlnik unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attempts integer,
captured_at timestamp(6) not null,
changed_fields text,
effect_started boolean,
error_message text,
json_model varchar(255),
last_attempt_at timestamp(6),
lease_owner varchar(255),
lease_token varchar(255),
leased_at timestamp(6),
model varchar(255) not null,
old text,
reconciled_at timestamp(6),
reconciliation_reason text,
record_id bigint not null,
registry_stamp varchar(255),
self text,
status varchar(255) not null,
trigger_type varchar(255) not null,
created_by bigint constraint fk_1siqhpvuobtso9tuemv7ayeku references auth_user,
updated_by bigint constraint fk_267gir069auog0r0c8fulv9im references auth_user,
changed_by bigint constraint fk_k2alukapksb8ubnbd7wthbiwg references auth_user,
reconciled_by bigint constraint fk_dbvf427g9oxnp1baqrn07ay0e references auth_user
);
create index meta_workflow_capture_changed_by_idx on meta_workflow_capture (changed_by);
create index meta_workflow_capture_reconciled_by_idx on meta_workflow_capture (reconciled_by);
create index meta_workflow_capture_status_captured_at_idx on meta_workflow_capture (status, captured_at);
create index meta_workflow_capture_status_leased_at_idx on meta_workflow_capture (status, leased_at);
create sequence meta_workflow_capture_seq;
create table meta_workflow_message
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_3993b5ox1vuuo348erln5ptwu unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attempts integer,
cascade_depth integer,
cascade_id varchar(255),
correlation_key varchar(255),
delivered_count integer,
expect varchar(255) not null,
expires_at timestamp(6),
last_attempt_at timestamp(6),
name varchar(255) not null,
payload text,
sent_at timestamp(6) not null,
status varchar(255) not null,
created_by bigint constraint fk_rx4nvsi5ocs0atuo5ln4sroju references auth_user,
updated_by bigint constraint fk_l8n2ngyx29eidi8dqaha70wcx references auth_user,
sender_run bigint constraint fk_bk1buwn87mprulavcmrt5qj04 references meta_workflow_run
);
create index meta_workflow_message_name_idx on meta_workflow_message (name);
create index meta_workflow_message_sender_run_idx on meta_workflow_message (sender_run);
create index meta_workflow_message_status_attempts_sent_at_idx on meta_workflow_message (status, attempts, sent_at);
create sequence meta_workflow_message_seq;
create table meta_workflow_task
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_fb2alc3ylo3xu5rprwc14dujq unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
cancel_denied boolean,
claimed_at timestamp(6),
comment text,
comment_mode varchar(255),
completed_at timestamp(6),
description text,
due_at timestamp(6),
element_json_model varchar(255),
element_model varchar(255),
element_record_id bigint,
element_record_name varchar(255),
force_complete_denied boolean,
json_model varchar(255),
lease_owner varchar(255),
lease_token varchar(255),
leased_at timestamp(6),
model varchar(255) not null,
node varchar(255) not null,
node_title varchar(255),
outcome varchar(255),
park_key varchar(255),
record_id bigint not null,
record_name varchar(255),
reject_denied boolean,
status varchar(255) not null,
visit integer,
workflow varchar(255),
workflow_name varchar(255) not null,
created_by bigint constraint fk_76oa4y18uid7dkgr6qbvju4e2 references auth_user,
updated_by bigint constraint fk_eejax8r30o98b6mbqo0esila8 references auth_user,
assigned_group bigint constraint fk_khdlcyt0nwoqdnpk9uytq2ybe references auth_group,
assigned_role bigint constraint fk_rqleb6bhgnlac3m0alomv05hn references auth_role,
assignee bigint constraint fk_51ij10g5ihmlpal1lsl2liimg references auth_user,
branch bigint constraint fk_dhcjfgs1i5jctks0c6htf8qlg references meta_workflow_branch,
claimed_by bigint constraint fk_aeiifgxdbsuj53a9x19xoa3e5 references auth_user,
completed_by bigint constraint fk_n7kwcva1ldhyif5p78mcdh9bw references auth_user,
origin_run bigint constraint fk_mfx36305vggakirfet11mlosg references meta_workflow_run
);
create index meta_workflow_task_assigned_group_idx on meta_workflow_task (assigned_group);
create index meta_workflow_task_assigned_role_idx on meta_workflow_task (assigned_role);
create index meta_workflow_task_assignee_idx on meta_workflow_task (assignee);
create index meta_workflow_task_branch_idx on meta_workflow_task (branch);
create index meta_workflow_task_claimed_by_idx on meta_workflow_task (claimed_by);
create index meta_workflow_task_completed_by_idx on meta_workflow_task (completed_by);
create index meta_workflow_task_model_record_id_idx on meta_workflow_task (model, record_id);
create index meta_workflow_task_origin_run_idx on meta_workflow_task (origin_run);
create index meta_workflow_task_park_key_idx on meta_workflow_task (park_key);
create index meta_workflow_task_status_due_at_idx on meta_workflow_task (status, due_at);
create index meta_workflow_task_workflow_record_id_node_idx on meta_workflow_task (workflow, record_id, node);
create sequence meta_workflow_task_seq;
create table meta_workflow_park
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_t2u26du5i8ntg52u57k2ivcf2 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
deadlines text,
effect_started boolean,
fired text,
owner_id bigint,
owner_type varchar(255),
park_key varchar(255) not null constraint uk_lnwnf80tgaqr7puxq46okbyjh unique,
parked_at timestamp(6),
created_by bigint constraint fk_ge4wposhia5jwm0a0o6b030rg references auth_user,
updated_by bigint constraint fk_aafp9tkmaw7qxiphevqvjd4x4 references auth_user
);
create sequence meta_workflow_park_seq;
create table meta_workflow_node_run
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_knnkucdliwow8yg4qw0impilx unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
ended_at timestamp(6),
episode bigint,
error_message text,
exit_via varchar(255),
moved_to varchar(255),
node varchar(255) not null,
node_title varchar(255),
node_type varchar(255),
parked_ms bigint,
resumed_at timestamp(6),
seq integer,
started_at timestamp(6),
status varchar(255),
subflow varchar(255),
taken varchar(255),
visit integer,
work_ms bigint,
created_by bigint constraint fk_6goe2bnfcsv45dakb90jgirm7 references auth_user,
updated_by bigint constraint fk_38ew604s8fvj1028v2w54s34u references auth_user,
branch bigint constraint fk_p7vooxiurijy8kqunogdu0yr7 references meta_workflow_branch,
moved_by bigint constraint fk_pirh9e8384xhlevr87daq5epj references auth_user,
park bigint constraint uk_nt6iv5vxwgm0fpnvdb8kpnyol unique constraint fk_nt6iv5vxwgm0fpnvdb8kpnyol references meta_workflow_park,
run bigint not null constraint fk_1m0qwenevg9yl3vgx0g4khh0u references meta_workflow_run,
task bigint constraint fk_m04w578fq1pe85194j036mk1l references meta_workflow_task
);
create index meta_workflow_node_run_branch_idx on meta_workflow_node_run (branch);
create index meta_workflow_node_run_moved_by_idx on meta_workflow_node_run (moved_by);
create index meta_workflow_node_run_node_status_idx on meta_workflow_node_run (node, status);
create index meta_workflow_node_run_run_idx on meta_workflow_node_run (run);
create index meta_workflow_node_run_task_idx on meta_workflow_node_run (task);
create sequence meta_workflow_node_run_seq;
create table meta_workflow_revision
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_hf3d9lf3ern6tri76m60nmwv7 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
json_model varchar(255),
model varchar(255),
revision integer not null,
workflow varchar(255) not null,
workflow_name varchar(255),
xml text not null,
created_by bigint constraint fk_2j90sxpebapw0obc7xlefqt9m references auth_user,
updated_by bigint constraint fk_mfiqkswru3flmr4bbmwgh3tjj references auth_user,
constraint uk_rxaj9l3jkn8gpu17k6nfs6aqs
unique (workflow, revision)
);
create sequence meta_workflow_revision_seq;
create table meta_workflow_state
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_63v6a5m4aamr1uqcbrcbkv7b9 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
activated_at timestamp(6),
done_at timestamp(6),
due_at timestamp(6),
episode bigint,
json_model varchar(255),
kind varchar(255),
last_run_episode bigint,
lease_owner varchar(255),
lease_token varchar(255),
leased_at timestamp(6),
model varchar(255) not null,
reap_count integer,
record_id bigint not null,
status varchar(255),
workflow varchar(255) not null,
workflow_name varchar(255),
created_by bigint constraint fk_7oo5ofpv19wl6qtm1bxspa17d references auth_user,
updated_by bigint constraint fk_qfc67umq6m88s8ce4wq0acd1t references auth_user,
armed_by bigint constraint fk_ifsx0peqh8ehh6il1gt36vimv references auth_user,
constraint uk_abmri9iwtcg6p2c77gx0n5qif
unique (workflow, record_id)
);
create index meta_workflow_state_armed_by_idx on meta_workflow_state (armed_by);
create index meta_workflow_state_due_at_status_idx on meta_workflow_state (due_at, status);
create index meta_workflow_state_status_leased_at_idx on meta_workflow_state (status, leased_at);
create sequence meta_workflow_state_seq;
create table meta_workflow_subscription
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_t0n5vr9jv0ygom0dljstb3iy5 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
boundary_id varchar(255),
correlation_key varchar(255),
name varchar(255) not null,
created_by bigint constraint fk_1aevvsvn2oea8vi2kbainjmww references auth_user,
updated_by bigint constraint fk_lqmf17j44pvi65pt8qe3l2h0f references auth_user,
park bigint not null constraint fk_ppnfbx8euqawh9qq63x499o99 references meta_workflow_park
);
create index meta_workflow_subscription_name_correlation_key_idx on meta_workflow_subscription (name, correlation_key);
create index meta_workflow_subscription_name_idx on meta_workflow_subscription (name);
create index meta_workflow_subscription_park_idx on meta_workflow_subscription (park);
create sequence meta_workflow_subscription_seq;
alter table meta_workflow_split add constraint fk_n458bd3e0tp3l0c755eicjpav foreign key (parent_branch) references meta_workflow_branch;
-- Features of the former Enterprise Edition
create sequence ai_agent_permission_seq;
create sequence ai_agent_seq;
create sequence ai_chat_message_seq;
create sequence ai_chat_participant_seq;
create sequence ai_chat_read_seq;
create sequence ai_chat_seq;
create sequence ai_config_bundle_seq;
create sequence ai_knowledge_base_seq;
create sequence ai_knowledge_source_seq;
create sequence ai_mcp_server_seq;
create sequence ai_model_seq;
create sequence ai_policy_seq;
create sequence ai_provider_seq;
create sequence ai_restriction_field_seq;
create sequence ai_restriction_seq;
create sequence ai_seed_seq;
create sequence ai_skill_reference_seq;
create sequence ai_skill_seq;
create sequence ai_tool_seq;
create sequence ai_usage_log_seq;
create sequence ai_usage_policy_seq;
create sequence meta_export_config_seq;
create sequence meta_query_seq;
create sequence meta_search_filter_seq;
create sequence studio_build_job_seq;
create sequence studio_repository_seq;
create sequence studio_resource_seq;
create table ai_provider
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_ejp7ni1osmbfkyiabu4m3tmla unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
api_key text,
attrs jsonb,
base_url varchar(255),
code varchar(255) not null constraint uk_g0yfudg7maj4dkksamy4w1odr unique,
is_enabled boolean,
is_internal boolean,
name varchar(255) not null,
sort_order integer,
sync_rules text,
provider_type varchar(255) not null,
created_by bigint constraint fk_83ihvhbueuqksm5aje44jbpq4 references auth_user,
updated_by bigint constraint fk_fbi3jxuhw6nyrl5qdeuhyfmo9 references auth_user
);
create index ai_provider_name_idx on ai_provider (name);
create index ai_provider_provider_type_is_enabled_idx on ai_provider (provider_type, is_enabled);
create table ai_model
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_7dvxfdxpy0k1dxthjh91gobjc unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
background_service_tier varchar(255),
code varchar(255) not null constraint uk_m5hqsybxwgwuhkhfmym48riy unique,
embedding_dimensions integer,
is_default boolean,
is_enabled boolean,
is_internal boolean,
max_input_tokens integer,
max_output_tokens integer,
model_id varchar(255) not null,
name varchar(255) not null,
rate_limit integer,
reasoning_effort varchar(255),
sort_order integer,
supports_reasoning boolean,
supports_tools boolean,
supports_vision boolean,
temperature numeric(8, 4),
timeout_ms integer,
type varchar(255) not null,
use_responses_api boolean,
created_by bigint constraint fk_hryhw95l7xofc1sis0d1pjdjl references auth_user,
updated_by bigint constraint fk_axj3pa8ukyvvbvvisleknwhkt references auth_user,
provider bigint not null constraint fk_7esimbydrsw7p9n6xhhel51xk references ai_provider,
constraint uk_8r4ukosvfikl38w905td17l1x
unique (provider, model_id)
);
create index ai_model_name_idx on ai_model (name);
create index ai_model_provider_idx on ai_model (provider);
create index ai_model_provider_type_is_enabled_idx on ai_model (provider, type, is_enabled);
create table ai_agent
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_wio085xpok2iq4n09h229hto unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
audience varchar(255) not null,
code varchar(255) not null constraint uk_6w84y7ggab2ed93xr6dgeabtq unique,
is_default boolean,
is_enabled boolean,
is_internal boolean,
max_output_tokens integer,
max_steps integer,
name varchar(255) not null,
reasoning_effort varchar(255),
sort_order integer,
system_prompt text,
temperature numeric(8, 4),
created_by bigint constraint fk_e4f271rih7pgx68nn3x3cwxqd references auth_user,
updated_by bigint constraint fk_ssgticclgo2v76qyqtwtot8k4 references auth_user,
model bigint constraint fk_8oymw6tk17e338ldxpdmgf6wi references ai_model,
utility_model bigint constraint fk_e2u366f70cqmp0useg8xvwse6 references ai_model
);
create index ai_agent_is_enabled_is_default_idx on ai_agent (is_enabled, is_default);
create index ai_agent_model_idx on ai_agent (model);
create index ai_agent_name_idx on ai_agent (name);
create index ai_agent_utility_model_idx on ai_agent (utility_model);
create table ai_agent_groups
(
ai_agent bigint not null constraint fk_hpvco21j88x9o3r6vp2mjy54e references ai_agent,
groups bigint not null constraint fk_3dgy14r4vv77bkwf43ogh9mjv references auth_group,
primary key (ai_agent, groups)
);
create table ai_agent_roles
(
ai_agent bigint not null constraint fk_q3pqsgxt81ci5g2a4hy1i44pw references ai_agent,
roles bigint not null constraint fk_pt1sff40ulb35jgn29m7lc2o references auth_role,
primary key (ai_agent, roles)
);
create table ai_agent_sub_agents
(
ai_agent bigint not null constraint fk_1t57gcvin2rexme3rvphqhvw5 references ai_agent,
sub_agents bigint not null constraint fk_55gc8qdh7ux77kh9nlsl74ri0 references ai_agent,
primary key (ai_agent, sub_agents)
);
create table ai_agent_users
(
ai_agent bigint not null constraint fk_cnd8th9oecxn7ebngrpfd6g74 references ai_agent,
users bigint not null constraint fk_o4cs26yatpsm8q6yoogr9u95h references auth_user,
primary key (ai_agent, users)
);
create table ai_chat
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_m0xxp4wsro3d9fqsu2sfog11h unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
active_agent_path text,
attrs jsonb,
compacted_up_to_message_id varchar(255),
context_action varchar(255),
context_field varchar(255),
context_id bigint,
context_model varchar(255),
context_view varchar(255),
conversation_mode varchar(255),
is_space boolean,
last_message_at timestamp(6),
recap text,
recap_up_to_message_id varchar(255),
session_notes text,
session_notes_token_count integer,
session_notes_up_to_message_id varchar(255),
summary text,
summary_up_to_message_id varchar(255),
title varchar(255),
uuid uuid not null constraint uk_8m3yq8m95t5mw2f9n80iw8odg unique,
created_by bigint constraint fk_g72emtorhok5onisqoha8a17v references auth_user,
updated_by bigint constraint fk_k5t038rjoktd8vd3hs8bf3qnk references auth_user,
agent bigint constraint fk_gwnc735wjy116h9ftm6lmp8tj references ai_agent,
model bigint constraint fk_nstomsqg27ijf3sbl7dlt32q6 references ai_model
);
create index ai_chat_agent_idx on ai_chat (agent);
create index ai_chat_context_model_context_id_idx on ai_chat (context_model, context_id);
create index ai_chat_created_by_last_message_at_idx on ai_chat (created_by, last_message_at);
create index ai_chat_model_idx on ai_chat (model);
create index ai_chat_title_idx on ai_chat (title);
create table ai_chat_message
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_3yld9v9xfn8u3e40bhwxv4tyo unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
agent_code varchar(255),
attrs jsonb,
parts text not null,
role varchar(255) not null,
text text,
uuid uuid not null constraint uk_ogari5369cwvf6j5bi4r49uwj unique,
created_by bigint constraint fk_mipry36u2d0q1ctqurhf52iur references auth_user,
updated_by bigint constraint fk_8hgbyhnndlvi124xeumq1j5cq references auth_user,
chat bigint not null constraint fk_i3jksw3n0e2hfp2pxgf9h5mfc references ai_chat
);
create index ai_chat_message_agent_code_created_on_idx on ai_chat_message (agent_code, created_on);
create index ai_chat_message_chat_created_on_id_idx on ai_chat_message (chat, created_on, id);
create index ai_chat_message_chat_idx on ai_chat_message (chat);
create table ai_knowledge_base
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_mb3mn1tw5o5fwgdyl7qqad1bk unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
chunk_overlap integer,
chunk_size integer,
code varchar(255) not null constraint uk_m3oc06tvjt3gb387ky8fgoxtv unique,
description text,
is_enabled boolean,
is_global boolean,
max_results integer,
min_score numeric(4, 2),
name varchar(255) not null,
created_by bigint constraint fk_2lgolk8k3qrqsjcq4svuopsjt references auth_user,
updated_by bigint constraint fk_pc1cn1vmnumrudpog7a2ou6dp references auth_user,
embedding_model bigint not null constraint fk_f6pxsfatcpdn1a2cgcafkaigq references ai_model
);
create table ai_agent_knowledge_bases
(
ai_agent bigint not null constraint fk_rl653kx2u142ogrv81kgfak49 references ai_agent,
knowledge_bases bigint not null constraint fk_4yw7i940ikp2xi2qi4tgecv8r references ai_knowledge_base,
primary key (ai_agent, knowledge_bases)
);
create index ai_knowledge_base_is_enabled_is_global_idx on ai_knowledge_base (is_enabled, is_global);
create index ai_knowledge_base_name_idx on ai_knowledge_base (name);
create index ai_knowledge_base_embedding_model_idx on ai_knowledge_base (embedding_model);
create table ai_knowledge_source
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_1xgnmlf4hqe3n12ek71sj4edk unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
chunk_count integer,
error_message text,
fields text,
filter text,
last_indexed_at timestamp(6),
model varchar(255),
status varchar(255),
template text,
source_type varchar(255) not null,
created_by bigint constraint fk_gl4qgsgou55m3itiw895n8wok references auth_user,
updated_by bigint constraint fk_rx2nf5wo0q2m03v2w9pnkxgit references auth_user,
knowledge_base bigint not null constraint fk_mjd1nrrvvw5syxvh3rjcr7klu references ai_knowledge_base,
meta_file bigint constraint fk_a9v7xhtgehml5l69acxornhga references meta_file
);
create index ai_knowledge_source_knowledge_base_idx on ai_knowledge_source (knowledge_base);
create index ai_knowledge_source_knowledge_base_status_idx on ai_knowledge_source (knowledge_base, status);
create index ai_knowledge_source_meta_file_idx on ai_knowledge_source (meta_file);
create index ai_knowledge_source_model_idx on ai_knowledge_source (model);
create table ai_skill
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_p7s99jftwvw1nf2y3e576c11f unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
code varchar(255) not null constraint uk_7f7fg7jq6ljtxprpx8y4r564u unique,
description text,
instructions text,
is_enabled boolean,
name varchar(255) not null,
procedures text,
created_by bigint constraint fk_m2bddp6nnkmdrk8h1rdhd0r2q references auth_user,
updated_by bigint constraint fk_jada29n6i0sa3hu6b4dae8e3y references auth_user
);
create index ai_skill_is_enabled_idx on ai_skill (is_enabled);
create index ai_skill_name_idx on ai_skill (name);
create table ai_agent_skills
(
ai_agent bigint not null constraint fk_c768h2ntfpkves8lk6nt10n4i references ai_agent,
skills bigint not null constraint fk_1lj203eq3qiqox2r7yaj8lfa0 references ai_skill,
primary key (ai_agent, skills)
);
create table ai_skill_reference
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_trgsnnkrgt2bjilii6ssji4aa unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
content text,
name varchar(255) not null,
title varchar(255),
created_by bigint constraint fk_r9aseya6wm3lmo4h80fj7yxyp references auth_user,
updated_by bigint constraint fk_blus25hdalqoywq0i8uuw0ily references auth_user,
skill bigint not null constraint fk_cgvfttsdrvebfyrat276af9e references ai_skill,
constraint uk_fdkfp963tawp6sqjumolxddcn
unique (skill, name)
);
create index ai_skill_reference_skill_idx on ai_skill_reference (skill);
create index ai_skill_reference_name_idx on ai_skill_reference (name);
create index ai_skill_reference_title_idx on ai_skill_reference (title);
create table ai_mcp_server
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_9ch9apuq9mb29y8se2o8hqaqi unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
auth_type varchar(255) not null,
code varchar(255) not null constraint uk_n59ypc5tg4cf0ogib6a9foh2l unique,
connection_status varchar(255),
description text,
is_enabled boolean,
last_synced_on timestamp(6),
name varchar(255) not null,
secrets text,
timeout_seconds integer,
url varchar(1024) not null,
created_by bigint constraint fk_o2ftj7sfd9rtnsw3gjj8832nu references auth_user,
updated_by bigint constraint fk_3tjxsloo87adhh5gft2ifmnbk references auth_user
);
create index ai_mcp_server_name_idx on ai_mcp_server (name);
create table ai_tool
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_qufghs6v2vnddiyp1sdymwjdg unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
action_label varchar(255),
action_model varchar(255),
action_name varchar(255),
attrs jsonb,
code varchar(255) not null constraint uk_koodnhfg152xq54j5q1fiaxsv unique,
description text,
http_body text,
http_headers text,
http_method varchar(255),
http_url varchar(1024),
input_schema text,
is_enabled boolean,
mcp_tool_name varchar(255),
name varchar(255) not null,
requires_approval boolean,
script text,
secrets text,
system_tool varchar(255),
tool_type varchar(255) not null,
created_by bigint constraint fk_prxy6849xtamtnms4hl5pvc8l references auth_user,
updated_by bigint constraint fk_jsf20c9bbl88qjxkxoguho2r6 references auth_user,
mcp_server bigint constraint fk_rub61uyvpi164sotq6ymalo9s references ai_mcp_server,
constraint uk_k9d67986khsbpagwruwy3p41e
unique (mcp_server, mcp_tool_name)
);
create index ai_tool_mcp_server_idx on ai_tool (mcp_server);
create index ai_tool_name_idx on ai_tool (name);
create index ai_tool_tool_type_is_enabled_idx on ai_tool (tool_type, is_enabled);
create table ai_agent_tools
(
ai_agent bigint not null constraint fk_86kkiqja57mccivebjwedct2q references ai_agent,
tools bigint not null constraint fk_7thot1f4fopb3f85do1i4bcvn references ai_tool,
primary key (ai_agent, tools)
);
create table ai_usage_log
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_scjy95vyfnaauh4q6cweqh3yx unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
agent_code varchar(255),
attrs jsonb,
cache_read_tokens integer,
cache_write_tokens integer,
chat_id varchar(255),
error_message text,
fields text,
input_tokens integer,
latency_ms integer,
model_code varchar(255),
output_tokens integer,
provider_code varchar(255),
source varchar(255) not null,
status varchar(255) not null,
timestamp timestamp(6) not null,
created_by bigint constraint fk_jhbixgs2uhjl8s2rtxmioftkl references auth_user,
updated_by bigint constraint fk_qrcrfq675x2rjgsa9558y4fqt references auth_user
);
create index ai_usage_log_chat_id_idx on ai_usage_log (chat_id);
create index ai_usage_log_created_by_timestamp_idx on ai_usage_log (created_by, "timestamp");
create index ai_usage_log_model_code_timestamp_idx on ai_usage_log (model_code, "timestamp");
create index ai_usage_log_source_timestamp_idx on ai_usage_log (source, "timestamp");
create table ai_usage_policy
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_5d3aeby15unut2xwgvioanr8e unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
active boolean,
attrs jsonb,
description text,
is_global boolean,
name varchar(255) not null constraint uk_oiflwsytyl48yjgnc3jpvxfse unique,
rate_limit integer,
token_quota_monthly integer,
created_by bigint constraint fk_tbyf29ej6cn6ryui5i2cr1j4d references auth_user,
updated_by bigint constraint fk_eg3ytxir88w6cv0gd23kjavth references auth_user
);
alter table auth_group add can_view_collaboration boolean;
update auth_group set can_view_collaboration = true;
create table meta_export_config
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_nxakopjylsgptwg32i6boaunn unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
json_model varchar(255),
model varchar(255) not null,
name varchar(255) not null,
options text,
shared boolean,
config_type varchar(255) not null,
created_by bigint constraint fk_l4nfs7sfmxiea02yrky5dchv9 references auth_user,
updated_by bigint constraint fk_abboi827bfrgh1sbflk8s3l9o references auth_user
);
create index meta_export_config_name_idx on meta_export_config (name);
create table meta_search_filter
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_phuwwrwdhe55uvl3yr3lh3upk unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
name varchar(255) not null,
created_by bigint constraint fk_hgkx9gjijrmrllwjc6b7xwclv references auth_user,
updated_by bigint constraint fk_7xjxiw71e38pa2wxm8n9p75fi references auth_user
);
create index meta_search_filter_name_idx on meta_search_filter (name);
create table meta_search_filter_models
(
meta_search_filter bigint not null constraint fk_9sxhcqm2ds656n5uemogbtojn references meta_search_filter,
models bigint not null constraint fk_mn3nuj2j3h628bg3jl92fu3ah references meta_model,
primary key (meta_search_filter, models)
);
create table studio_repository
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_4d1ni0e7pogxc0bc7ohyqldek unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
auth_token varchar(255) not null,
auth_user varchar(255),
config_user_email varchar(255) not null,
config_user_name varchar(255) not null,
description varchar(255),
name varchar(255) not null,
path varchar(255) not null,
created_by bigint constraint fk_mi1u41cm3cciakv0ausky4k8o references auth_user,
updated_by bigint constraint fk_sfpme0e5ahrvgsmwpgyh3bhdk references auth_user
);
create index studio_repository_name_idx on studio_repository (name);
create table studio_resource
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_2aqtusub2e1qo93yi09feapt unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
allow_entity boolean,
allow_json_entity boolean,
content text,
description varchar(255),
group_name varchar(255),
major_version integer constraint studio_resource_major_version_check check (major_version >= 0),
minor_version integer constraint studio_resource_minor_version_check check (minor_version >= 0),
name varchar(255) not null,
patch_version integer constraint studio_resource_patch_version_check check (patch_version >= 0),
published boolean,
schema_json_model varchar(255),
schema_model varchar(255),
schema_model_field varchar(255),
schema_package varchar(255),
schema_type varchar(255),
semantic_version varchar(255),
status varchar(255),
title varchar(255),
type varchar(255),
created_by bigint constraint fk_8rgmw9l3frfbejsxobbmbno7o references auth_user,
updated_by bigint constraint fk_clalgogcr1edlcsnyj79xv0f7 references auth_user,
parent bigint constraint fk_foubxvu85nscvbtceqktg11rr references studio_resource,
repository bigint constraint fk_ocx92vl1gcefg08e1htqmd855 references studio_repository
);
alter table meta_action add studio_project bigint constraint fk_s8ha4l9va7x969krklsw1okcv references studio_resource;
create index meta_action_studio_project_idx on meta_action (studio_project);
alter table meta_json_field add studio_project bigint constraint fk_j25eorwt0jgxf31uye9s5imgb references studio_resource;
create index meta_json_field_studio_project_idx on meta_json_field (studio_project);
alter table meta_json_model add studio_project bigint constraint fk_3y43r5w2ewuvytl5chsps42ux references studio_resource;
create index meta_json_model_studio_project_idx on meta_json_model (studio_project);
alter table meta_menu add studio_project bigint constraint fk_ru2fa3cqy333bsdpwy3djgp43 references studio_resource;
create index meta_menu_studio_project_idx on meta_menu (studio_project);
create table meta_query
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_9yw2t0o372qidp4nckdnbh5d5 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
model varchar(255) not null,
name varchar(255) not null constraint uk_eufjnji1ra8l1uojurfm3gce7 unique,
query text not null,
created_by bigint constraint fk_7t2jw9jkbowaptd57gci7ills references auth_user,
updated_by bigint constraint fk_odtoi51r8qvafan1guhkibga7 references auth_user,
studio_project bigint constraint fk_ot54d5yqerr4ml4198twjmjkn references studio_resource
);
create index meta_query_studio_project_idx on meta_query (studio_project);
create table meta_query_roles
(
meta_query bigint not null constraint fk_bga3iyy3ab6n6sq8xcpagnk0u references meta_query,
roles bigint not null constraint fk_7n23tb00m2ww4jmoy4syxp1mc references auth_role,
primary key (meta_query, roles)
);
alter table meta_select add studio_project bigint constraint fk_3su4m515i9rannniw6h6y2ymg references studio_resource;
create index meta_select_studio_project_idx on meta_select (studio_project);
alter table meta_select_item add studio_project bigint constraint fk_mgfvofvbrvw1bft0sewxkq0ls references studio_resource;
create index meta_select_item_studio_project_idx on meta_select_item (studio_project);
alter table meta_view add studio_project bigint constraint fk_obj0vohduq3xa5q7g11d7wns4 references studio_resource;
create index meta_view_studio_project_idx on meta_view (studio_project);
alter table meta_view_custom add studio_project bigint constraint fk_i13h0js47mxuyt759ncyd9wo1 references studio_resource;
create index meta_view_custom_studio_project_idx on meta_view_custom (studio_project);
create table studio_build_job
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_mgv4wr885vw37vwy5hvlexn95 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
completed_on timestamp(6),
error_message text,
executor varchar(255),
exit_code integer,
external_id varchar(255),
job_id varchar(255) not null constraint uk_arcvfq9j4ei9ema50drj12tiq unique,
output text,
progress integer constraint studio_build_job_progress_check check ((progress <= 100) AND (progress >= 0)),
progress_stage varchar(255),
server_node varchar(255),
started_on timestamp(6),
status varchar(255) not null,
created_by bigint constraint fk_ao5ng5kiceok1wt427lf59js1 references auth_user,
updated_by bigint constraint fk_68phti26v0nhtpkg8grrc51rk references auth_user,
artifact bigint constraint fk_69enexq2lixtl8b046ngrn3hm references meta_file,
project bigint not null constraint fk_7t84sbyu0yj8mlfvc0q7r95ag references studio_resource
);
create index studio_build_job_project_idx on studio_build_job (project);
create index studio_build_job_artifact_idx on studio_build_job (artifact);
create index studio_resource_name_idx on studio_resource (name);
create index studio_resource_parent_idx on studio_resource (parent);
create index studio_resource_repository_idx on studio_resource (repository);
create table ai_agent_permission
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_rkesuj5eeptrni299osab7xbh unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
can_create boolean,
can_read boolean,
can_remove boolean,
can_write boolean,
object varchar(255) not null,
created_by bigint constraint fk_bhktusmq1pnkuwotbcpsaklsu references auth_user,
updated_by bigint constraint fk_4qtto57u5nkes27jlp6pnts0u references auth_user,
agent bigint not null constraint fk_avolsil40j5m6qpbyxmw4ksqo references ai_agent,
constraint uk_gh6ebhx2q0f78xuhpacvnlm53
unique (agent, object)
);
create index ai_agent_permission_agent_idx on ai_agent_permission (agent);
create table ai_chat_participant
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_rwl8872b20uix5kypbuwn134f unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
opened_on timestamp(6),
role varchar(255) not null,
created_by bigint constraint fk_pn8m4q75r5ghptmc0mnp2twy4 references auth_user,
updated_by bigint constraint fk_1c4jwce0lh2vnfclamrpu31xv references auth_user,
chat bigint not null constraint fk_o3ls37q51g51gjhbi16i62eb1 references ai_chat,
user_id bigint not null constraint fk_2tebt9jxsiglb8ylo4bkssgfx references auth_user,
constraint uk_q71qji7vcx53g982g10oy3ksg
unique (chat, user_id)
);
create index ai_chat_participant_chat_idx on ai_chat_participant (chat);
create index ai_chat_participant_user_id_idx on ai_chat_participant (user_id);
create table ai_chat_read
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_s3jdxepykpkmxwgnlye5l3n5s unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
field varchar(255) not null,
object varchar(255) not null,
created_by bigint constraint fk_oxcwv42djijwbw7obvi970jxg references auth_user,
updated_by bigint constraint fk_lvmim2mcwvfs5hjwpbmo7xcfs references auth_user,
chat bigint not null constraint fk_no1ah0qctjx5m3m5qjqwj2mph references ai_chat,
constraint uk_pi9wmg54c37a76qf9fg7j8dop
unique (chat, object, field)
);
create index ai_chat_read_chat_idx on ai_chat_read (chat);
create table ai_config_bundle
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_k03em0m56m79047u8fsbgpcyg unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
description text,
is_enabled boolean,
last_applied_at timestamp(6),
last_result text,
mode varchar(255),
name varchar(255) not null,
sequence integer,
created_by bigint constraint fk_se9f6youcjpe2w634n4n992jo references auth_user,
updated_by bigint constraint fk_cfm17x1f6me13vvi7pxp748x0 references auth_user,
data_file bigint constraint fk_cydrlgam1psve8omqbc4gfbnn references meta_file
);
create index ai_config_bundle_data_file_idx on ai_config_bundle (data_file);
create index ai_config_bundle_name_idx on ai_config_bundle (name);
create table ai_policy
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_tfnlhl6dlbaxrwkevkb6h1reh unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
active boolean,
attrs jsonb,
description text,
is_global boolean,
name varchar(255) not null constraint uk_soyg1fk8maqfbpw14gqdxa1pm unique,
created_by bigint constraint fk_mnqgmy2c79xmywv1kbf91rgnq references auth_user,
updated_by bigint constraint fk_sbn0iq7i6v7lxrjyhvmt4shb7 references auth_user
);
create table ai_policy_agents
(
ai_policy bigint not null constraint fk_pgksgvbnpb4heps0rxhs3pe40 references ai_policy,
agents bigint not null constraint fk_t4wn0wtykx3lexbcjuk9pmxtt references ai_agent,
primary key (ai_policy, agents)
);
create table ai_policy_models
(
ai_policy bigint not null constraint fk_hw3wt8dhqnkyudknkobbk7sta references ai_policy,
models bigint not null constraint fk_pn01xgnaaj6vwgdhxn78bns8q references ai_model,
primary key (ai_policy, models)
);
create table ai_policy_providers
(
ai_policy bigint not null constraint fk_sgndr4uu320wwho0mupanqi5h references ai_policy,
providers bigint not null constraint fk_s9herw7qjkb0h1okn452bmg references ai_provider,
primary key (ai_policy, providers)
);
create table ai_restriction
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_9sa5bptqsdevgji99s6ymgqac unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
condition_value varchar(1024),
condition_params varchar(255),
object varchar(255) not null,
created_by bigint constraint fk_igmeihmlx7d3j0agrlk5q2630 references auth_user,
updated_by bigint constraint fk_2f4j5to4df9hx97mg4f72khac references auth_user,
policy bigint not null constraint fk_5hej8shomm7wt15ktf2cp1j0f references ai_policy
);
create index ai_restriction_policy_idx on ai_restriction (policy);
create table ai_restriction_field
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_y6dhoddimpxsvnsalk68iq66 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
field varchar(255) not null,
created_by bigint constraint fk_3a888jjajhoaqym1ru8uriaxe references auth_user,
updated_by bigint constraint fk_2ser0yhdju772mkoi12ohgqpj references auth_user,
restriction bigint not null constraint fk_cahjj3l9etsm83e357jdfbjv9 references ai_restriction,
constraint uk_sp8uuhgopkacg2088cr9djnj7
unique (restriction, field)
);
create index ai_restriction_field_field_idx on ai_restriction_field (field);
create index ai_restriction_field_restriction_idx on ai_restriction_field (restriction);
create table ai_seed
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_8ycshpl2kja74khmfo2abkxh2 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
code varchar(255) not null,
seeded_at timestamp(6),
type varchar(255) not null,
created_by bigint constraint fk_noobltjpmnccchqj7qljgletv references auth_user,
updated_by bigint constraint fk_h82n5f5y2ku89x4snbl6agvfj references auth_user,
constraint uk_sgbihv50wivomk8hd80b60y1b
unique (type, code)
);
create index ai_seed_code_idx on ai_seed (code);
create table ai_usage_policy_groups
(
ai_usage_policy bigint not null constraint fk_et5qgka54h1egpkr0cj64jgv8 references ai_usage_policy,
groups bigint not null constraint fk_gq0i0vj5m3uk4p0n7o8kp4tf8 references auth_group,
primary key (ai_usage_policy, groups)
);
create table ai_usage_policy_roles
(
ai_usage_policy bigint not null constraint fk_smq3142h8nus8f4q67mh4h7ky references ai_usage_policy,
roles bigint not null constraint fk_b2hqrf0cfroias1erwf6ykmbq references auth_role,
primary key (ai_usage_policy, roles)
);
create table ai_usage_policy_users
(
ai_usage_policy bigint not null constraint fk_b9y0xmjxf9xd2dllkaumbxwno references ai_usage_policy,
users bigint not null constraint fk_oyospi20suoaa80mdxco102r references auth_user,
primary key (ai_usage_policy, users)
);
alter table meta_workflow add constraint fk_rxr47nseno8ksjvi99gcwej95 foreign key (studio_project) references studio_resource;
-- import_id on every entity table that doesn't have it yet: those of the platform and of your own entities. The unique
-- constraint is named as Hibernate names it: 'uk_' and the md5 of 'table`<table>`column`import_id`' in base 35.
DO $$
DECLARE
t text;
h text;
n numeric;
name text;
digits constant text := '0123456789abcdefghijklmnopqrstuvwxy';
BEGIN
FOR t IN
SELECT c.table_name FROM information_schema.columns c
JOIN information_schema.tables s
ON s.table_schema = c.table_schema AND s.table_name = c.table_name AND s.table_type = 'BASE TABLE'
WHERE c.table_schema = current_schema() AND c.column_name IN ('id', 'version')
GROUP BY c.table_name HAVING count(*) = 2
EXCEPT
SELECT table_name FROM information_schema.columns
WHERE table_schema = current_schema() AND column_name = 'import_id'
ORDER BY 1
LOOP
h := md5('table`' || t || '`column`import_id`');
n := 0;
FOR i IN 1..32 LOOP
n := n * 16 + (position(substr(h, i, 1) IN '0123456789abcdef') - 1);
END LOOP;
name := '';
WHILE n > 0 LOOP
name := substr(digits, mod(n, 35)::int + 1, 1) || name;
n := div(n, 35);
END LOOP;
EXECUTE format('ALTER TABLE %I ADD import_id varchar(255) CONSTRAINT %I UNIQUE', t, 'uk_' || name);
RAISE NOTICE 'import_id added to %', t;
END LOOP;
END
$$;
When view collaboration is enabled, the members of existing groups can see who else is viewing or editing a record,
as for new groups. Set can_view_collaboration to false on the groups that shouldn’t.
From a former Enterprise Edition database
This script removes the records of the former EE module, as described in Former EE databases, and creates the tables of the new features. It also migrates the AI tables of the former Enterprise Edition and creates the new ones:
-
An agent’s
allowed_modelsbecomes oneai_agent_permissionrow per line, keeping its!opdenials as unchecked rights.tool_policyis removed, and the new requiredaudienceisBUSINESS. -
A usage policy now has a unique name, and lists the roles, groups and users it applies to in the
ai_usage_policy_roles,ai_usage_policy_groupsandai_usage_policy_userstables, instead of a single one in itsrole,group_idoruser_idcolumn. An existing policy is namedPolicy <id>, so that the uniquenamecan be required, and is global when it had none of the three. -
The
statusof a usage log entry is required. Entries without one areSUCCESS. -
Cross-session memories are removed with their
ai_memorytable, whose rows are lost. -
The other columns added to the AI tables are optional, and the columns that were removed held settings that no longer exist.
-- Extension views: they are now part of the core views
DELETE FROM meta_view_groups WHERE meta_view_id IN (
SELECT id FROM meta_view WHERE module = 'axelor-enterprise-edition' AND extension = true);
DELETE FROM meta_view WHERE module = 'axelor-enterprise-edition' AND extension = true;
-- Other records: now loaded by axelor-core
UPDATE meta_view SET module = 'axelor-core' WHERE module = 'axelor-enterprise-edition';
UPDATE meta_action SET module = 'axelor-core' WHERE module = 'axelor-enterprise-edition';
UPDATE meta_menu SET module = 'axelor-core' WHERE module = 'axelor-enterprise-edition';
UPDATE meta_action_menu SET module = 'axelor-core' WHERE module = 'axelor-enterprise-edition';
UPDATE meta_select SET module = 'axelor-core' WHERE module = 'axelor-enterprise-edition';
-- The former module
DELETE FROM meta_module_depends WHERE
module_id IN (SELECT id FROM meta_module WHERE name = 'axelor-enterprise-edition') OR
depend_id IN (SELECT id FROM meta_module WHERE name = 'axelor-enterprise-edition');
DELETE FROM meta_module WHERE name = 'axelor-enterprise-edition';
-- New features of the platform
ALTER TABLE auth_user_token ADD allowed_ips varchar(2048);
create table auth_authentication_event
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_2g1lkkqpt06x5kk5ipxtin1lq unique,
version integer,
created_on timestamp(6),
details jsonb,
ip_address varchar(255),
provider varchar(255),
status integer not null,
user_id bigint constraint fk_fcd7fnyrr3qavk2xuco4ov3d8 references auth_user
);
create index auth_event_idx_user on auth_authentication_event (user_id, created_on);
create index auth_event_idx_created_on on auth_authentication_event (created_on);
create index auth_authentication_event_user_id_idx on auth_authentication_event (user_id);
create sequence auth_authentication_event_seq;
INSERT INTO meta_schedule (id, version, created_on, active, cron, description, job, name)
VALUES (nextval('meta_schedule_seq'), 0, now(), true, '0 0 5 * * ?',
'Delete older authentication events','com.axelor.auth.events.job.AuthenticationEventPurgeJob',
'authentication.events.purge');
create table meta_workflow
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_awlv038fbaqaa2rvuegs4qgfc unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
active boolean,
current_revision integer,
json_model varchar(255),
model varchar(255) not null,
module varchar(255),
name varchar(255) not null,
priority integer,
sequence integer,
trigger_type varchar(255) not null,
xml text not null,
xml_id varchar(255) not null constraint uk_t8ckmogkpeb6vaelodrp5eihe unique,
created_by bigint constraint fk_ryohc14hcv08ddclqo8ljvhgv references auth_user,
updated_by bigint constraint fk_7bt0qi15qhnla7x2jg8ajaxsw references auth_user,
studio_project bigint
);
create index meta_workflow_name_idx on meta_workflow (name);
create index meta_workflow_studio_project_idx on meta_workflow (studio_project);
create sequence meta_workflow_seq;
create table meta_workflow_run
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_a1i89dwh7532hqtjj43nql02b unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
caller_node varchar(255),
caller_park_key varchar(255),
ended_at timestamp(6),
episode bigint,
error_message text,
json_model varchar(255),
last_node varchar(255),
model varchar(255) not null,
record_id bigint,
started_at timestamp(6),
status varchar(255),
trigger_type varchar(255),
workflow varchar(255),
workflow_name varchar(255) not null,
workflow_revision integer,
created_by bigint constraint fk_jl3ppytvd7giqclkopxrgydah references auth_user,
updated_by bigint constraint fk_r72rf21xi4jw0te68pgl3csfp references auth_user,
parent_run bigint constraint fk_gf7km92df9h6bkknld1khe2xq references meta_workflow_run,
started_by bigint constraint fk_2auw9yrs9ntyrqrrn167smmh references auth_user
);
create index meta_workflow_run_model_record_id_idx on meta_workflow_run (model, record_id);
create index meta_workflow_run_parent_run_idx on meta_workflow_run (parent_run);
create index meta_workflow_run_started_by_idx on meta_workflow_run (started_by);
create index meta_workflow_run_workflow_status_idx on meta_workflow_run (workflow, status);
create sequence meta_workflow_run_seq;
create table meta_workflow_split
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_biu19a27co2anwba3yhxrtfqp unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
activated integer,
arrived integer,
decision varchar(255),
ended integer,
join_node varchar(255),
lease_owner varchar(255),
lease_token varchar(255),
leased_at timestamp(6),
outstanding integer,
park_key varchar(255),
quorum integer,
split_node varchar(255) not null,
status varchar(255) not null,
wait varchar(255),
winners varchar(255),
created_by bigint constraint fk_6atv2epyf23vqixbnn3bmu0fo references auth_user,
updated_by bigint constraint fk_9f75x8skkxxhrjdctb7ibk61i references auth_user,
parent_branch bigint,
run bigint not null constraint fk_r9pgt38ucn45tr928qsqpbmvh references meta_workflow_run
);
create index meta_workflow_split_parent_branch_idx on meta_workflow_split (parent_branch);
create index meta_workflow_split_run_idx on meta_workflow_split (run);
create index meta_workflow_split_run_status_idx on meta_workflow_split (run, status);
create index meta_workflow_split_status_leased_at_idx on meta_workflow_split (status, leased_at);
create sequence meta_workflow_split_seq;
create table meta_workflow_branch
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_oy85pffls5agv0gso3sg7hwj2 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
bindings text,
current_node varchar(255),
flow varchar(255),
join_node varchar(255),
json_model varchar(255),
lease_owner varchar(255),
lease_token varchar(255),
leased_at timestamp(6),
model varchar(255),
park_key varchar(255),
record_id bigint,
start_node varchar(255),
status varchar(255) not null,
subflow varchar(255),
vars text,
wake_at timestamp(6),
created_by bigint constraint fk_cvcse5klb63le9ve8nvo7lg4o references auth_user,
updated_by bigint constraint fk_3xukqj2skb5p7lsaj8i6ub8fw references auth_user,
run bigint not null constraint fk_jyxk7idxi3xvo5371n8fqpbhv references meta_workflow_run,
split bigint constraint fk_a3n2ve6hp4qgybok3mj7qfho0 references meta_workflow_split,
constraint uk_6jj60fl44yhwr01vikwiif1yi
unique (split, flow)
);
create index meta_workflow_branch_run_idx on meta_workflow_branch (run);
create index meta_workflow_branch_run_status_idx on meta_workflow_branch (run, status);
create index meta_workflow_branch_split_idx on meta_workflow_branch (split);
create index meta_workflow_branch_split_status_idx on meta_workflow_branch (split, status);
create index meta_workflow_branch_status_wake_at_idx on meta_workflow_branch (status, wake_at);
create sequence meta_workflow_branch_seq;
create table meta_workflow_capture
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_gpewwdiow99x3xkjagruqlnik unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attempts integer,
captured_at timestamp(6) not null,
changed_fields text,
effect_started boolean,
error_message text,
json_model varchar(255),
last_attempt_at timestamp(6),
lease_owner varchar(255),
lease_token varchar(255),
leased_at timestamp(6),
model varchar(255) not null,
old text,
reconciled_at timestamp(6),
reconciliation_reason text,
record_id bigint not null,
registry_stamp varchar(255),
self text,
status varchar(255) not null,
trigger_type varchar(255) not null,
created_by bigint constraint fk_1siqhpvuobtso9tuemv7ayeku references auth_user,
updated_by bigint constraint fk_267gir069auog0r0c8fulv9im references auth_user,
changed_by bigint constraint fk_k2alukapksb8ubnbd7wthbiwg references auth_user,
reconciled_by bigint constraint fk_dbvf427g9oxnp1baqrn07ay0e references auth_user
);
create index meta_workflow_capture_changed_by_idx on meta_workflow_capture (changed_by);
create index meta_workflow_capture_reconciled_by_idx on meta_workflow_capture (reconciled_by);
create index meta_workflow_capture_status_captured_at_idx on meta_workflow_capture (status, captured_at);
create index meta_workflow_capture_status_leased_at_idx on meta_workflow_capture (status, leased_at);
create sequence meta_workflow_capture_seq;
create table meta_workflow_message
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_3993b5ox1vuuo348erln5ptwu unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attempts integer,
cascade_depth integer,
cascade_id varchar(255),
correlation_key varchar(255),
delivered_count integer,
expect varchar(255) not null,
expires_at timestamp(6),
last_attempt_at timestamp(6),
name varchar(255) not null,
payload text,
sent_at timestamp(6) not null,
status varchar(255) not null,
created_by bigint constraint fk_rx4nvsi5ocs0atuo5ln4sroju references auth_user,
updated_by bigint constraint fk_l8n2ngyx29eidi8dqaha70wcx references auth_user,
sender_run bigint constraint fk_bk1buwn87mprulavcmrt5qj04 references meta_workflow_run
);
create index meta_workflow_message_name_idx on meta_workflow_message (name);
create index meta_workflow_message_sender_run_idx on meta_workflow_message (sender_run);
create index meta_workflow_message_status_attempts_sent_at_idx on meta_workflow_message (status, attempts, sent_at);
create sequence meta_workflow_message_seq;
create table meta_workflow_task
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_fb2alc3ylo3xu5rprwc14dujq unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
cancel_denied boolean,
claimed_at timestamp(6),
comment text,
comment_mode varchar(255),
completed_at timestamp(6),
description text,
due_at timestamp(6),
element_json_model varchar(255),
element_model varchar(255),
element_record_id bigint,
element_record_name varchar(255),
force_complete_denied boolean,
json_model varchar(255),
lease_owner varchar(255),
lease_token varchar(255),
leased_at timestamp(6),
model varchar(255) not null,
node varchar(255) not null,
node_title varchar(255),
outcome varchar(255),
park_key varchar(255),
record_id bigint not null,
record_name varchar(255),
reject_denied boolean,
status varchar(255) not null,
visit integer,
workflow varchar(255),
workflow_name varchar(255) not null,
created_by bigint constraint fk_76oa4y18uid7dkgr6qbvju4e2 references auth_user,
updated_by bigint constraint fk_eejax8r30o98b6mbqo0esila8 references auth_user,
assigned_group bigint constraint fk_khdlcyt0nwoqdnpk9uytq2ybe references auth_group,
assigned_role bigint constraint fk_rqleb6bhgnlac3m0alomv05hn references auth_role,
assignee bigint constraint fk_51ij10g5ihmlpal1lsl2liimg references auth_user,
branch bigint constraint fk_dhcjfgs1i5jctks0c6htf8qlg references meta_workflow_branch,
claimed_by bigint constraint fk_aeiifgxdbsuj53a9x19xoa3e5 references auth_user,
completed_by bigint constraint fk_n7kwcva1ldhyif5p78mcdh9bw references auth_user,
origin_run bigint constraint fk_mfx36305vggakirfet11mlosg references meta_workflow_run
);
create index meta_workflow_task_assigned_group_idx on meta_workflow_task (assigned_group);
create index meta_workflow_task_assigned_role_idx on meta_workflow_task (assigned_role);
create index meta_workflow_task_assignee_idx on meta_workflow_task (assignee);
create index meta_workflow_task_branch_idx on meta_workflow_task (branch);
create index meta_workflow_task_claimed_by_idx on meta_workflow_task (claimed_by);
create index meta_workflow_task_completed_by_idx on meta_workflow_task (completed_by);
create index meta_workflow_task_model_record_id_idx on meta_workflow_task (model, record_id);
create index meta_workflow_task_origin_run_idx on meta_workflow_task (origin_run);
create index meta_workflow_task_park_key_idx on meta_workflow_task (park_key);
create index meta_workflow_task_status_due_at_idx on meta_workflow_task (status, due_at);
create index meta_workflow_task_workflow_record_id_node_idx on meta_workflow_task (workflow, record_id, node);
create sequence meta_workflow_task_seq;
create table meta_workflow_park
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_t2u26du5i8ntg52u57k2ivcf2 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
deadlines text,
effect_started boolean,
fired text,
owner_id bigint,
owner_type varchar(255),
park_key varchar(255) not null constraint uk_lnwnf80tgaqr7puxq46okbyjh unique,
parked_at timestamp(6),
created_by bigint constraint fk_ge4wposhia5jwm0a0o6b030rg references auth_user,
updated_by bigint constraint fk_aafp9tkmaw7qxiphevqvjd4x4 references auth_user
);
create sequence meta_workflow_park_seq;
create table meta_workflow_node_run
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_knnkucdliwow8yg4qw0impilx unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
ended_at timestamp(6),
episode bigint,
error_message text,
exit_via varchar(255),
moved_to varchar(255),
node varchar(255) not null,
node_title varchar(255),
node_type varchar(255),
parked_ms bigint,
resumed_at timestamp(6),
seq integer,
started_at timestamp(6),
status varchar(255),
subflow varchar(255),
taken varchar(255),
visit integer,
work_ms bigint,
created_by bigint constraint fk_6goe2bnfcsv45dakb90jgirm7 references auth_user,
updated_by bigint constraint fk_38ew604s8fvj1028v2w54s34u references auth_user,
branch bigint constraint fk_p7vooxiurijy8kqunogdu0yr7 references meta_workflow_branch,
moved_by bigint constraint fk_pirh9e8384xhlevr87daq5epj references auth_user,
park bigint constraint uk_nt6iv5vxwgm0fpnvdb8kpnyol unique constraint fk_nt6iv5vxwgm0fpnvdb8kpnyol references meta_workflow_park,
run bigint not null constraint fk_1m0qwenevg9yl3vgx0g4khh0u references meta_workflow_run,
task bigint constraint fk_m04w578fq1pe85194j036mk1l references meta_workflow_task
);
create index meta_workflow_node_run_branch_idx on meta_workflow_node_run (branch);
create index meta_workflow_node_run_moved_by_idx on meta_workflow_node_run (moved_by);
create index meta_workflow_node_run_node_status_idx on meta_workflow_node_run (node, status);
create index meta_workflow_node_run_run_idx on meta_workflow_node_run (run);
create index meta_workflow_node_run_task_idx on meta_workflow_node_run (task);
create sequence meta_workflow_node_run_seq;
create table meta_workflow_revision
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_hf3d9lf3ern6tri76m60nmwv7 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
json_model varchar(255),
model varchar(255),
revision integer not null,
workflow varchar(255) not null,
workflow_name varchar(255),
xml text not null,
created_by bigint constraint fk_2j90sxpebapw0obc7xlefqt9m references auth_user,
updated_by bigint constraint fk_mfiqkswru3flmr4bbmwgh3tjj references auth_user,
constraint uk_rxaj9l3jkn8gpu17k6nfs6aqs
unique (workflow, revision)
);
create sequence meta_workflow_revision_seq;
create table meta_workflow_state
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_63v6a5m4aamr1uqcbrcbkv7b9 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
activated_at timestamp(6),
done_at timestamp(6),
due_at timestamp(6),
episode bigint,
json_model varchar(255),
kind varchar(255),
last_run_episode bigint,
lease_owner varchar(255),
lease_token varchar(255),
leased_at timestamp(6),
model varchar(255) not null,
reap_count integer,
record_id bigint not null,
status varchar(255),
workflow varchar(255) not null,
workflow_name varchar(255),
created_by bigint constraint fk_7oo5ofpv19wl6qtm1bxspa17d references auth_user,
updated_by bigint constraint fk_qfc67umq6m88s8ce4wq0acd1t references auth_user,
armed_by bigint constraint fk_ifsx0peqh8ehh6il1gt36vimv references auth_user,
constraint uk_abmri9iwtcg6p2c77gx0n5qif
unique (workflow, record_id)
);
create index meta_workflow_state_armed_by_idx on meta_workflow_state (armed_by);
create index meta_workflow_state_due_at_status_idx on meta_workflow_state (due_at, status);
create index meta_workflow_state_status_leased_at_idx on meta_workflow_state (status, leased_at);
create sequence meta_workflow_state_seq;
create table meta_workflow_subscription
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_t0n5vr9jv0ygom0dljstb3iy5 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
boundary_id varchar(255),
correlation_key varchar(255),
name varchar(255) not null,
created_by bigint constraint fk_1aevvsvn2oea8vi2kbainjmww references auth_user,
updated_by bigint constraint fk_lqmf17j44pvi65pt8qe3l2h0f references auth_user,
park bigint not null constraint fk_ppnfbx8euqawh9qq63x499o99 references meta_workflow_park
);
create index meta_workflow_subscription_name_correlation_key_idx on meta_workflow_subscription (name, correlation_key);
create index meta_workflow_subscription_name_idx on meta_workflow_subscription (name);
create index meta_workflow_subscription_park_idx on meta_workflow_subscription (park);
create sequence meta_workflow_subscription_seq;
alter table meta_workflow_split add constraint fk_n458bd3e0tp3l0c755eicjpav foreign key (parent_branch) references meta_workflow_branch;
-- AI tables of the former Enterprise Edition
-- The tables that the data moves below write to
create sequence ai_agent_permission_seq;
create sequence ai_mcp_server_seq;
create table ai_agent_permission
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_rkesuj5eeptrni299osab7xbh unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
can_create boolean,
can_read boolean,
can_remove boolean,
can_write boolean,
object varchar(255) not null,
created_by bigint constraint fk_bhktusmq1pnkuwotbcpsaklsu references auth_user,
updated_by bigint constraint fk_4qtto57u5nkes27jlp6pnts0u references auth_user,
agent bigint not null constraint fk_avolsil40j5m6qpbyxmw4ksqo references ai_agent,
constraint uk_gh6ebhx2q0f78xuhpacvnlm53
unique (agent, object)
);
create index ai_agent_permission_agent_idx on ai_agent_permission (agent);
create table ai_mcp_server
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_9ch9apuq9mb29y8se2o8hqaqi unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
auth_type varchar(255) not null,
code varchar(255) not null constraint uk_n59ypc5tg4cf0ogib6a9foh2l unique,
connection_status varchar(255),
description text,
is_enabled boolean,
last_synced_on timestamp(6),
name varchar(255) not null,
secrets text,
timeout_seconds integer,
url varchar(1024) not null,
created_by bigint constraint fk_o2ftj7sfd9rtnsw3gjj8832nu references auth_user,
updated_by bigint constraint fk_3tjxsloo87adhh5gft2ifmnbk references auth_user
);
create index ai_mcp_server_name_idx on ai_mcp_server (name);
create table ai_usage_policy_groups
(
ai_usage_policy bigint not null constraint fk_et5qgka54h1egpkr0cj64jgv8 references ai_usage_policy,
groups bigint not null constraint fk_gq0i0vj5m3uk4p0n7o8kp4tf8 references auth_group,
primary key (ai_usage_policy, groups)
);
create table ai_usage_policy_roles
(
ai_usage_policy bigint not null constraint fk_smq3142h8nus8f4q67mh4h7ky references ai_usage_policy,
roles bigint not null constraint fk_b2hqrf0cfroias1erwf6ykmbq references auth_role,
primary key (ai_usage_policy, roles)
);
create table ai_usage_policy_users
(
ai_usage_policy bigint not null constraint fk_b9y0xmjxf9xd2dllkaumbxwno references ai_usage_policy,
users bigint not null constraint fk_oyospi20suoaa80mdxco102r references auth_user,
primary key (ai_usage_policy, users)
);
-- ai_agent: `allowed_models` becomes one ai_agent_permission row per line, `audience` is new
-- and `tool_policy` is gone
alter table ai_agent add audience varchar(255);
update ai_agent set audience = 'BUSINESS';
alter table ai_agent alter audience set not null;
insert into ai_agent_permission (id, version, agent, object, can_read, can_write, can_create, can_remove)
select nextval('ai_agent_permission_seq'), 0, p.agent, p.object,
bool_and(p.can_read), bool_and(p.can_write), bool_and(p.can_create), bool_and(p.can_remove)
from (select a.id agent,
split_part(trim(l), ' ', 1) object,
trim(l) !~ '(^| )!read( |$)' can_read,
trim(l) !~ '(^| )!update( |$)' can_write,
trim(l) !~ '(^| )!create( |$)' can_create,
trim(l) !~ '(^| )!delete( |$)' can_remove
from ai_agent a, regexp_split_to_table(a.allowed_models, E'\\r?\\n') l
where trim(l) <> '') p
group by p.agent, p.object;
alter table ai_agent drop column allowed_models;
alter table ai_agent drop column tool_policy;
-- ai_chat
alter table ai_chat add compacted_up_to_message_id varchar(255);
alter table ai_chat add context_field varchar(255);
alter table ai_chat add conversation_mode varchar(255);
alter table ai_chat add is_space boolean;
alter table ai_chat add recap text;
alter table ai_chat add recap_up_to_message_id varchar(255);
alter table ai_chat drop column total_input_tokens;
alter table ai_chat drop column total_output_tokens;
-- ai_knowledge_source
alter table ai_knowledge_source add fields text;
-- ai_model
alter table ai_model add background_service_tier varchar(255);
alter table ai_model add use_responses_api boolean;
alter table ai_model drop column supports_streaming;
-- ai_provider
alter table ai_provider add sync_rules text;
-- ai_skill
alter table ai_skill add procedures text;
alter table ai_skill drop column sort_order;
-- ai_tool
alter table ai_tool add action_label varchar(255);
alter table ai_tool add mcp_server bigint constraint fk_rub61uyvpi164sotq6ymalo9s references ai_mcp_server;
alter table ai_tool add mcp_tool_name varchar(255);
alter table ai_tool add constraint uk_k9d67986khsbpagwruwy3p41e unique (mcp_server, mcp_tool_name);
alter table ai_tool drop column result_schema;
-- ai_usage_log: `status` is required, and SUCCESS was already the default
alter table ai_usage_log add fields text;
update ai_usage_log set status = 'SUCCESS' where status is null;
alter table ai_usage_log alter status set not null;
-- ai_usage_policy: named policies listing the roles, groups and users they apply to
alter table ai_usage_policy add name varchar(255);
alter table ai_usage_policy add description text;
alter table ai_usage_policy add active boolean;
alter table ai_usage_policy add is_global boolean;
update ai_usage_policy set name = 'Policy ' || id, active = true,
is_global = (group_id is null and role is null and user_id is null);
insert into ai_usage_policy_roles (ai_usage_policy, roles)
select id, role from ai_usage_policy where role is not null;
insert into ai_usage_policy_groups (ai_usage_policy, groups)
select id, group_id from ai_usage_policy where group_id is not null;
insert into ai_usage_policy_users (ai_usage_policy, users)
select id, user_id from ai_usage_policy where user_id is not null;
alter table ai_usage_policy alter name set not null;
alter table ai_usage_policy add constraint uk_oiflwsytyl48yjgnc3jpvxfse unique (name);
alter table ai_usage_policy drop column group_id;
alter table ai_usage_policy drop column role;
alter table ai_usage_policy drop column user_id;
-- cross-session memories are gone
drop table ai_memory;
drop sequence ai_memory_seq;
create sequence ai_chat_participant_seq;
create sequence ai_chat_read_seq;
create sequence ai_config_bundle_seq;
create sequence ai_policy_seq;
create sequence ai_restriction_field_seq;
create sequence ai_restriction_seq;
create sequence ai_seed_seq;
create table ai_chat_participant
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_rwl8872b20uix5kypbuwn134f unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
opened_on timestamp(6),
role varchar(255) not null,
created_by bigint constraint fk_pn8m4q75r5ghptmc0mnp2twy4 references auth_user,
updated_by bigint constraint fk_1c4jwce0lh2vnfclamrpu31xv references auth_user,
chat bigint not null constraint fk_o3ls37q51g51gjhbi16i62eb1 references ai_chat,
user_id bigint not null constraint fk_2tebt9jxsiglb8ylo4bkssgfx references auth_user,
constraint uk_q71qji7vcx53g982g10oy3ksg
unique (chat, user_id)
);
create index ai_chat_participant_chat_idx on ai_chat_participant (chat);
create index ai_chat_participant_user_id_idx on ai_chat_participant (user_id);
create table ai_chat_read
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_s3jdxepykpkmxwgnlye5l3n5s unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
field varchar(255) not null,
object varchar(255) not null,
created_by bigint constraint fk_oxcwv42djijwbw7obvi970jxg references auth_user,
updated_by bigint constraint fk_lvmim2mcwvfs5hjwpbmo7xcfs references auth_user,
chat bigint not null constraint fk_no1ah0qctjx5m3m5qjqwj2mph references ai_chat,
constraint uk_pi9wmg54c37a76qf9fg7j8dop
unique (chat, object, field)
);
create index ai_chat_read_chat_idx on ai_chat_read (chat);
create table ai_config_bundle
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_k03em0m56m79047u8fsbgpcyg unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
description text,
is_enabled boolean,
last_applied_at timestamp(6),
last_result text,
mode varchar(255),
name varchar(255) not null,
sequence integer,
created_by bigint constraint fk_se9f6youcjpe2w634n4n992jo references auth_user,
updated_by bigint constraint fk_cfm17x1f6me13vvi7pxp748x0 references auth_user,
data_file bigint constraint fk_cydrlgam1psve8omqbc4gfbnn references meta_file
);
create index ai_config_bundle_data_file_idx on ai_config_bundle (data_file);
create index ai_config_bundle_name_idx on ai_config_bundle (name);
create table ai_policy
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_tfnlhl6dlbaxrwkevkb6h1reh unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
active boolean,
attrs jsonb,
description text,
is_global boolean,
name varchar(255) not null constraint uk_soyg1fk8maqfbpw14gqdxa1pm unique,
created_by bigint constraint fk_mnqgmy2c79xmywv1kbf91rgnq references auth_user,
updated_by bigint constraint fk_sbn0iq7i6v7lxrjyhvmt4shb7 references auth_user
);
create table ai_policy_agents
(
ai_policy bigint not null constraint fk_pgksgvbnpb4heps0rxhs3pe40 references ai_policy,
agents bigint not null constraint fk_t4wn0wtykx3lexbcjuk9pmxtt references ai_agent,
primary key (ai_policy, agents)
);
create table ai_policy_models
(
ai_policy bigint not null constraint fk_hw3wt8dhqnkyudknkobbk7sta references ai_policy,
models bigint not null constraint fk_pn01xgnaaj6vwgdhxn78bns8q references ai_model,
primary key (ai_policy, models)
);
create table ai_policy_providers
(
ai_policy bigint not null constraint fk_sgndr4uu320wwho0mupanqi5h references ai_policy,
providers bigint not null constraint fk_s9herw7qjkb0h1okn452bmg references ai_provider,
primary key (ai_policy, providers)
);
create table ai_restriction
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_9sa5bptqsdevgji99s6ymgqac unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
condition_value varchar(1024),
condition_params varchar(255),
object varchar(255) not null,
created_by bigint constraint fk_igmeihmlx7d3j0agrlk5q2630 references auth_user,
updated_by bigint constraint fk_2f4j5to4df9hx97mg4f72khac references auth_user,
policy bigint not null constraint fk_5hej8shomm7wt15ktf2cp1j0f references ai_policy
);
create index ai_restriction_policy_idx on ai_restriction (policy);
create table ai_restriction_field
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_y6dhoddimpxsvnsalk68iq66 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
field varchar(255) not null,
created_by bigint constraint fk_3a888jjajhoaqym1ru8uriaxe references auth_user,
updated_by bigint constraint fk_2ser0yhdju772mkoi12ohgqpj references auth_user,
restriction bigint not null constraint fk_cahjj3l9etsm83e357jdfbjv9 references ai_restriction,
constraint uk_sp8uuhgopkacg2088cr9djnj7
unique (restriction, field)
);
create index ai_restriction_field_field_idx on ai_restriction_field (field);
create index ai_restriction_field_restriction_idx on ai_restriction_field (restriction);
create table ai_seed
(
id bigint not null primary key,
archived boolean,
import_id varchar(255) constraint uk_8ycshpl2kja74khmfo2abkxh2 unique,
version integer,
created_on timestamp(6),
updated_on timestamp(6),
attrs jsonb,
code varchar(255) not null,
seeded_at timestamp(6),
type varchar(255) not null,
created_by bigint constraint fk_noobltjpmnccchqj7qljgletv references auth_user,
updated_by bigint constraint fk_h82n5f5y2ku89x4snbl6agvfj references auth_user,
constraint uk_sgbihv50wivomk8hd80b60y1b
unique (type, code)
);
create index ai_seed_code_idx on ai_seed (code);
create index ai_chat_context_model_context_id_idx on ai_chat (context_model, context_id);
create index ai_chat_message_agent_code_created_on_idx on ai_chat_message (agent_code, created_on);
create index ai_tool_mcp_server_idx on ai_tool (mcp_server);
alter table meta_workflow add constraint fk_rxr47nseno8ksjvi99gcwej95 foreign key (studio_project) references studio_resource;