[{"data":1,"prerenderedAt":526},["ShallowReactive",2],{"navigation_docs":3,"-apps-persistence-migrations":196,"-apps-persistence-migrations-surround":521},[4,127,166],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":36},"Kinotic Apps","i-lucide-rocket","\u002Fapps","1.apps",[10,14,18,37,58,91,106,122],{"title":11,"path":12,"stem":13},"Introduction","\u002Fapps\u002Fintroduction","1.apps\u002F1.introduction",{"title":15,"path":16,"stem":17},"Quick Start","\u002Fapps\u002Fquick-start","1.apps\u002F2.quick-start",{"title":19,"icon":20,"path":21,"stem":22,"children":23,"page":36},"Application Structure","i-lucide-folder-tree","\u002Fapps\u002Fapplication-structure","1.apps\u002F3.application-structure",[24,28,32],{"title":25,"path":26,"stem":27},"Overview","\u002Fapps\u002Fapplication-structure\u002Foverview","1.apps\u002F3.application-structure\u002F1.overview",{"title":29,"path":30,"stem":31},"Applications and Projects","\u002Fapps\u002Fapplication-structure\u002Fapplications-and-projects","1.apps\u002F3.application-structure\u002F2.applications-and-projects",{"title":33,"path":34,"stem":35},"Artifact Types","\u002Fapps\u002Fapplication-structure\u002Fartifact-types","1.apps\u002F3.application-structure\u002F3.artifact-types",false,{"title":38,"icon":39,"path":40,"stem":41,"children":42,"page":36},"Services","i-lucide-network","\u002Fapps\u002Fservices","1.apps\u002F4.services",[43,46,50,54],{"title":25,"path":44,"stem":45},"\u002Fapps\u002Fservices\u002Foverview","1.apps\u002F4.services\u002F1.overview",{"title":47,"path":48,"stem":49},"Publishing Services","\u002Fapps\u002Fservices\u002Fpublishing-services","1.apps\u002F4.services\u002F2.publishing-services",{"title":51,"path":52,"stem":53},"Service Proxies","\u002Fapps\u002Fservices\u002Fservice-proxies","1.apps\u002F4.services\u002F3.service-proxies",{"title":55,"path":56,"stem":57},"Streaming","\u002Fapps\u002Fservices\u002Fstreaming","1.apps\u002F4.services\u002F4.streaming",{"title":59,"icon":60,"path":61,"stem":62,"children":63,"page":36},"Persistence","i-lucide-database","\u002Fapps\u002Fpersistence","1.apps\u002F5.persistence",[64,67,71,75,79,83,87],{"title":25,"path":65,"stem":66},"\u002Fapps\u002Fpersistence\u002Foverview","1.apps\u002F5.persistence\u002F1.overview",{"title":68,"path":69,"stem":70},"Defining Entities","\u002Fapps\u002Fpersistence\u002Fdefining-entities","1.apps\u002F5.persistence\u002F2.defining-entities",{"title":72,"path":73,"stem":74},"Entity Decorators","\u002Fapps\u002Fpersistence\u002Fentity-decorators","1.apps\u002F5.persistence\u002F3.entity-decorators",{"title":76,"path":77,"stem":78},"CRUD Operations","\u002Fapps\u002Fpersistence\u002Fcrud-operations","1.apps\u002F5.persistence\u002F4.crud-operations",{"title":80,"path":81,"stem":82},"Named Queries","\u002Fapps\u002Fpersistence\u002Fnamed-queries","1.apps\u002F5.persistence\u002F5.named-queries",{"title":84,"path":85,"stem":86},"Multi-Tenancy","\u002Fapps\u002Fpersistence\u002Fmulti-tenancy","1.apps\u002F5.persistence\u002F6.multi-tenancy",{"title":88,"path":89,"stem":90},"Migrations","\u002Fapps\u002Fpersistence\u002Fmigrations","1.apps\u002F5.persistence\u002F7.migrations",{"title":92,"icon":93,"path":94,"stem":95,"children":96,"page":36},"Security","i-lucide-shield-check","\u002Fapps\u002Fsecurity","1.apps\u002F6.security",[97,101],{"title":98,"path":99,"stem":100,"icon":93},"Access Control","\u002Fapps\u002Fsecurity\u002Faccess-control","1.apps\u002F6.security\u002F1.access-control",{"title":102,"path":103,"stem":104,"icon":105},"Authentication","\u002Fapps\u002Fsecurity\u002Fauthentication","1.apps\u002F6.security\u002F2.authentication","i-lucide-key-round",{"title":107,"icon":108,"path":109,"stem":110,"children":111,"page":36},"Deployment","i-lucide-cloud-upload","\u002Fapps\u002Fdeployment","1.apps\u002F7.deployment",[112,117],{"title":113,"path":114,"stem":115,"icon":116},"Deployment Workflow","\u002Fapps\u002Fdeployment\u002Fworkflow","1.apps\u002F7.deployment\u002F1.workflow","i-lucide-git-branch",{"title":118,"path":119,"stem":120,"icon":121},"Environments","\u002Fapps\u002Fdeployment\u002Fenvironments","1.apps\u002F7.deployment\u002F2.environments","i-lucide-server",{"title":123,"path":124,"stem":125,"icon":126},"CLI Reference","\u002Fapps\u002Fcli-reference","1.apps\u002F8.cli-reference","i-lucide-terminal",{"title":128,"icon":121,"path":129,"stem":130,"children":131,"page":36},"Kinotic OS","\u002Fplatform","2.platform",[132,137,141,146,151,156,161],{"title":133,"path":134,"stem":135,"icon":136},"System Architecture","\u002Fplatform\u002Farchitecture","2.platform\u002F1.architecture","i-lucide-boxes",{"title":138,"path":139,"stem":140,"icon":6},"Deployment Guide","\u002Fplatform\u002Fdeployment-guide","2.platform\u002F2.deployment-guide",{"title":142,"path":143,"stem":144,"icon":145},"Configuration","\u002Fplatform\u002Fconfiguration","2.platform\u002F3.configuration","i-lucide-settings",{"title":147,"path":148,"stem":149,"icon":150},"Organization Management","\u002Fplatform\u002Forganization-management","2.platform\u002F4.organization-management","i-lucide-building-2",{"title":152,"path":153,"stem":154,"icon":155},"System Security","\u002Fplatform\u002Fsystem-security","2.platform\u002F5.system-security","i-lucide-shield",{"title":157,"path":158,"stem":159,"icon":160},"Observability","\u002Fplatform\u002Fobservability","2.platform\u002F6.observability","i-lucide-activity",{"title":162,"path":163,"stem":164,"icon":165},"Contributing","\u002Fplatform\u002Fcontributing","2.platform\u002F7.contributing","i-lucide-git-pull-request",{"title":167,"icon":168,"path":169,"stem":170,"children":171,"page":36},"Reference","i-lucide-book-open","\u002Freference","3.reference",[172,177,181,186,191],{"title":173,"path":174,"stem":175,"icon":176},"Decorators Reference","\u002Freference\u002Fdecorators","3.reference\u002F1.decorators","i-lucide-at-sign",{"title":178,"path":179,"stem":180,"icon":60},"Migration SQL Grammar","\u002Freference\u002Fmigration-sql-grammar","3.reference\u002F2.migration-sql-grammar",{"title":182,"path":183,"stem":184,"icon":185},"ABAC Expression Language","\u002Freference\u002Fabac-expression-language","3.reference\u002F3.abac-expression-language","i-lucide-file-code",{"title":187,"path":188,"stem":189,"icon":190},"CRI Format","\u002Freference\u002Fcri-format","3.reference\u002F4.cri-format","i-lucide-link",{"title":192,"path":193,"stem":194,"icon":195},"SDK Packages","\u002Freference\u002Fsdk-packages","3.reference\u002F5.sdk-packages","i-lucide-package",{"id":197,"title":88,"body":198,"description":514,"extension":515,"links":516,"meta":517,"navigation":518,"path":89,"seo":519,"stem":90,"__hash__":520},"docs\u002F1.apps\u002F5.persistence\u002F7.migrations.md",{"type":199,"value":200,"toc":497},"minimark",[201,210,215,218,228,231,250,257,261,278,282,303,307,312,315,323,327,330,339,343,346,355,359,362,371,375,378,387,391,394,403,407,410,419,423,426,435,439,486,493],[202,203,204,205,209],"p",{},"Migrations let you evolve your data schema in a controlled, versioned way. They are written in a SQL-like syntax and executed automatically during ",[206,207,208],"code",{},"kinotic sync",".",[211,212,214],"h2",{"id":213},"file-naming","File Naming",[202,216,217],{},"Migration files follow a strict naming convention:",[219,220,225],"pre",{"className":221,"code":223,"language":224},[222],"language-text","V\u003Cnumber>__\u003Cdescription>.sql\n","text",[206,226,223],{"__ignoreMap":227},"",[202,229,230],{},"Examples:",[232,233,234,240,245],"ul",{},[235,236,237],"li",{},[206,238,239],{},"V1__initial_schema.sql",[235,241,242],{},[206,243,244],{},"V2__add_email_field.sql",[235,246,247],{},[206,248,249],{},"V3__create_sensor_readings.sql",[202,251,252,253,256],{},"The version number determines execution order. The double underscore (",[206,254,255],{},"__",") separates the version from the description.",[211,258,260],{"id":259},"how-it-works","How It Works",[262,263,264,267,270,273],"ol",{},[235,265,266],{},"Migration files are discovered and sorted by version number",[235,268,269],{},"Only unapplied migrations are parsed and executed",[235,271,272],{},"Each migration is recorded after successful execution to prevent re-runs",[235,274,275,276],{},"Migrations run during ",[206,277,208],{},[211,279,281],{"id":280},"example-migration","Example Migration",[219,283,287],{"className":284,"code":285,"language":286,"meta":227,"style":227},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","-- V1__initial_schema.sql\nCREATE TABLE users (name TEXT, age INTEGER, active BOOLEAN);\n","sql",[206,288,289,297],{"__ignoreMap":227},[290,291,294],"span",{"class":292,"line":293},"line",1,[290,295,296],{},"-- V1__initial_schema.sql\n",[290,298,300],{"class":292,"line":299},2,[290,301,302],{},"CREATE TABLE users (name TEXT, age INTEGER, active BOOLEAN);\n",[211,304,306],{"id":305},"supported-statements","Supported Statements",[308,309,311],"h3",{"id":310},"create-table","CREATE TABLE",[202,313,314],{},"Create a new table with field mappings.",[219,316,317],{"className":284,"code":302,"language":286,"meta":227,"style":227},[206,318,319],{"__ignoreMap":227},[290,320,321],{"class":292,"line":293},[290,322,302],{},[308,324,326],{"id":325},"create-component-template","CREATE COMPONENT TEMPLATE",[202,328,329],{},"Define reusable templates with settings that can be applied to multiple tables.",[219,331,333],{"className":284,"code":332,"language":286,"meta":227,"style":227},"CREATE COMPONENT TEMPLATE my_settings WITH (number_of_shards = 1, number_of_replicas = 0);\n",[206,334,335],{"__ignoreMap":227},[290,336,337],{"class":292,"line":293},[290,338,332],{},[308,340,342],{"id":341},"create-index-template","CREATE INDEX TEMPLATE",[202,344,345],{},"Create templates that automatically apply to tables matching a name pattern.",[219,347,349],{"className":284,"code":348,"language":286,"meta":227,"style":227},"CREATE INDEX TEMPLATE my_template MATCHING (logs-*) COMPOSED OF (my_settings);\n",[206,350,351],{"__ignoreMap":227},[290,352,353],{"class":292,"line":293},[290,354,348],{},[308,356,358],{"id":357},"alter-table-add-column","ALTER TABLE ADD COLUMN",[202,360,361],{},"Add new fields to an existing table.",[219,363,365],{"className":284,"code":364,"language":286,"meta":227,"style":227},"ALTER TABLE users ADD COLUMN email TEXT;\n",[206,366,367],{"__ignoreMap":227},[290,368,369],{"class":292,"line":293},[290,370,364],{},[308,372,374],{"id":373},"reindex","REINDEX",[202,376,377],{},"Migrate data between tables with advanced options.",[219,379,381],{"className":284,"code":380,"language":286,"meta":227,"style":227},"REINDEX FROM old_index INTO new_index WITH (SKIP_IF_NO_SOURCE = TRUE);\n",[206,382,383],{"__ignoreMap":227},[290,384,385],{"class":292,"line":293},[290,386,380],{},[308,388,390],{"id":389},"insert-into","INSERT INTO",[202,392,393],{},"Add records to a table.",[219,395,397],{"className":284,"code":396,"language":286,"meta":227,"style":227},"INSERT INTO users (name, age, active) VALUES ('Jane', 28, TRUE) WITH REFRESH;\n",[206,398,399],{"__ignoreMap":227},[290,400,401],{"class":292,"line":293},[290,402,396],{},[308,404,406],{"id":405},"update-set-where","UPDATE ... SET ... WHERE",[202,408,409],{},"Modify existing records.",[219,411,413],{"className":284,"code":412,"language":286,"meta":227,"style":227},"UPDATE users SET active = FALSE WHERE age \u003C 18 WITH REFRESH;\n",[206,414,415],{"__ignoreMap":227},[290,416,417],{"class":292,"line":293},[290,418,412],{},[308,420,422],{"id":421},"delete-from-where","DELETE FROM ... WHERE",[202,424,425],{},"Remove records matching a condition.",[219,427,429],{"className":284,"code":428,"language":286,"meta":227,"style":227},"DELETE FROM users WHERE active = FALSE WITH REFRESH;\n",[206,430,431],{"__ignoreMap":227},[290,432,433],{"class":292,"line":293},[290,434,428],{},[211,436,438],{"id":437},"best-practices","Best Practices",[232,440,441,448,458,466,474,480],{},[235,442,443,447],{},[444,445,446],"strong",{},"Increment version numbers sequentially"," - Gaps are allowed but order must be maintained",[235,449,450,457],{},[444,451,452,453,456],{},"Use ",[206,454,455],{},"IF NOT EXISTS"," where available"," - Makes migrations safe to re-run if the tracking state is reset",[235,459,460,465],{},[444,461,452,462],{},[206,463,464],{},"WITH REFRESH"," on INSERT, UPDATE, and DELETE when subsequent migrations depend on the changed data being immediately visible",[235,467,468,473],{},[444,469,452,470],{},[206,471,472],{},"SKIP_IF_NO_SOURCE = TRUE"," on REINDEX operations for idempotent data migrations",[235,475,476,479],{},[444,477,478],{},"Keep migrations small and focused"," - One logical change per migration file",[235,481,482,485],{},[444,483,484],{},"Never modify a migration after it has been applied"," - Create a new migration instead",[202,487,488,489,209],{},"For the complete SQL grammar reference, see the ",[490,491,492],"a",{"href":179},"Migration SQL Grammar Reference",[494,495,496],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":227,"searchDepth":299,"depth":299,"links":498},[499,500,501,502,513],{"id":213,"depth":299,"text":214},{"id":259,"depth":299,"text":260},{"id":280,"depth":299,"text":281},{"id":305,"depth":299,"text":306,"children":503},[504,506,507,508,509,510,511,512],{"id":310,"depth":505,"text":311},3,{"id":325,"depth":505,"text":326},{"id":341,"depth":505,"text":342},{"id":357,"depth":505,"text":358},{"id":373,"depth":505,"text":374},{"id":389,"depth":505,"text":390},{"id":405,"depth":505,"text":406},{"id":421,"depth":505,"text":422},{"id":437,"depth":299,"text":438},"Schema evolution using versioned migration scripts for Kinotic's persistence layer.","md",null,{},true,{"title":88,"description":514},"A6wabIUt2lOfgEVXuxJLFB3Spl3_kPeazum7sjhxjKI",[522,524],{"title":84,"path":85,"stem":86,"description":523,"children":-1},"Multi-tenant data isolation in Kinotic with automatic tenant filtering.",{"title":98,"path":99,"stem":100,"description":525,"icon":93,"children":-1},"Attribute-Based Access Control (ABAC) for published services and entity data.",1775187765463]