Create indexes
g.sys.system.createIndexes calls the create indexes system API from your code, whatever the settings of that API say about HTTP callers.
Create indexes System API¶
Create indexes using global object 'g'. The same request works on MongoDB, MySQL, MariaDB, SQL Server, PostgreSQL and Oracle ; an index which exists already is left alone (EXISTS), a field the database can not index is SKIPPED with the reason, a refusal of the database is FAILED with its message.
- Without a
name, the index is calledam_ix_<table>_<fields>_<hash>(am_ixu_when unique), the same in every environment, cut to the limit of the database (30 characters on Oracle). order:ASC,DESC,HASHEDandTEXT(MongoDB) ;nullsFirst: trueon PostgreSQL.type:FULLTEXTorSPATIAL(MySQL),CLUSTERED,XML,SPATIAL(SQL Server),hash,gin,gist,spgist,brin(PostgreSQL).method:BTREE,HASH,RTREE(MySQL).- This is the call the migration script
am_index_makerof Index Maker makes on deploy : a migration script of your own can do the same.
Multi-tenant¶
instance: "crm::acme"creates the index in the database of the tenantacmeof the multi-tenant instancecrm. In a custom API called for a tenant,instance: "crm"creates it in the database of that tenant.