text: (window.webpackJsonp=window.webpackJsonp||[]).push([[224],{596:function(t,a,s){"use strict";s.r(a);var r=s(42),e=Object(r.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"schemamigration-hpp"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#schemamigration-hpp"}},[t._v("#")]),t._v(" SchemaMigration.hpp"),s("seo")],1),t._v(" "),s("p",[s("a",{attrs:{href:"https://github.com/oatpp/oatpp/blob/master/src/oatpp/orm/SchemaMigration.hpp",target:"_blank",rel:"noopener noreferrer"}},[t._v("This File On Github"),s("OutboundLink")],1),s("br"),t._v(" "),s("a",{attrs:{href:"https://github.com/oatpp/oatpp/issues/new?title=API%20question&body=In%20file:%20oatpp/orm/SchemaMigration.hpp%0A%0A%23%20Question%0A%0A%3Cyour-question-here%3E",target:"_blank",rel:"noopener noreferrer"}},[t._v("Ask A Question"),s("OutboundLink")],1)]),t._v(" "),s("p",[s("code",[t._v("API: latest")]),s("br"),t._v(" "),s("code",[t._v("module: oatpp")]),s("br"),t._v(" "),s("code",[t._v('#include "oatpp/orm/SchemaMigration.hpp"')])]),t._v(" "),s("h2",{attrs:{id:"schemamigration"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#schemamigration"}},[t._v("#")]),t._v(" SchemaMigration")]),t._v(" "),s("p",[t._v("Database schema migration helper.")]),t._v(" "),s("div",{staticClass:"language-cpp extra-class"},[s("pre",{pre:!0,attrs:{class:"language-cpp"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("namespace")]),t._v(" oatpp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("namespace")]),t._v(" orm "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" \n  "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("SchemaMigration")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("h3",{attrs:{id:"methods"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#methods"}},[t._v("#")]),t._v(" Methods")]),t._v(" "),s("table",[s("thead",[s("tr",[s("th",[t._v("Return Type")]),t._v(" "),s("th",[t._v("Name")]),t._v(" "),s("th",[t._v("Summary")])])]),t._v(" "),s("tbody",[s("tr",[s("td",[s("code",[t._v("[none]")])]),t._v(" "),s("td",[s("a",{attrs:{href:"#schemamigration-schemamigration"}},[t._v("SchemaMigration")])]),t._v(" "),s("td",[t._v("Constructor.")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("[none]")])]),t._v(" "),s("td",[s("a",{attrs:{href:"#schemamigration-~schemamigration"}},[t._v("~SchemaMigration")])]),t._v(" "),s("td",[t._v("Default virtual destructor.")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("void")])]),t._v(" "),s("td",[s("a",{attrs:{href:"#schemamigration-addtext"}},[t._v("addText")])]),t._v(" "),s("td",[t._v("Add migration script as text.")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("void")])]),t._v(" "),s("td",[s("a",{attrs:{href:"#schemamigration-addfile"}},[t._v("addFile")])]),t._v(" "),s("td",[t._v("Add migration script file.")])]),t._v(" "),s("tr",[s("td",[s("code",[t._v("void")])]),t._v(" "),s("td",[s("a",{attrs:{href:"#schemamigration-migrate"}},[t._v("migrate")])]),t._v(" "),s("td",[t._v("Run database schema migration.")])])])]),t._v(" "),s("h3",{attrs:{id:"schemamigration-schemamigration"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#schemamigration-schemamigration"}},[t._v("#")]),t._v(" SchemaMigration::SchemaMigration")]),t._v(" "),s("p",[t._v("Constructor. "),s("ul",[s("li",[s("strong",[t._v("@param")]),t._v(" executor - "),s("RouterLink",{attrs:{to:"/api/latest/oatpp/orm/Executor/#executor"}},[t._v("oatpp::orm::Executor")]),t._v(". ")],1),s("li",[s("strong",[t._v("@param")]),t._v(" suffix - suffix of schema version control table. ")])])]),t._v(" "),s("div",{staticClass:"language-cpp extra-class"},[s("pre",{pre:!0,attrs:{class:"language-cpp"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("SchemaMigration")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" base"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("::")]),t._v("ObjectHandle"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("Executor"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),t._v(" executor"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" oatpp"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("::")]),t._v("String"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),t._v(" suffix "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("nullptr")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h3",{attrs:{id:"schemamigration-schemamigration-2"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#schemamigration-schemamigration-2"}},[t._v("#")]),t._v(" SchemaMigration::~SchemaMigration")]),t._v(" "),s("p",[t._v("Default virtual destructor.")]),t._v(" "),s("div",{staticClass:"language-cpp extra-class"},[s("pre",{pre:!0,attrs:{class:"language-cpp"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("virtual")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("SchemaMigration")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("default")]),t._v("\n")])])]),s("h3",{attrs:{id:"schemamigration-addtext"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#schemamigration-addtext"}},[t._v("#")]),t._v(" SchemaMigration::addText")]),t._v(" "),s("p",[t._v("Add migration script as text. "),s("ul",[s("li",[s("strong",[t._v("@param")]),t._v(" version - schema version corresponding to this script. ")]),s("li",[s("strong",[t._v("@param")]),t._v(" script - script text. ")])])]),t._v(" "),s("div",{staticClass:"language-cpp extra-class"},[s("pre",{pre:!0,attrs:{class:"language-cpp"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addText")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("v_int64 version"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" oatpp"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("::")]),t._v("String"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),t._v(" script"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h3",{attrs:{id:"schemamigration-addfile"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#schemamigration-addfile"}},[t._v("#")]),t._v(" SchemaMigration::addFile")]),t._v(" "),s("p",[t._v("Add migration script file. "),s("ul",[s("li",[s("strong",[t._v("@param")]),t._v(" version - schema version corresponding to this script. ")]),s("li",[s("strong",[t._v("@param")]),t._v(" script - path to script file. ")])])]),t._v(" "),s("div",{staticClass:"language-cpp extra-class"},[s("pre",{pre:!0,attrs:{class:"language-cpp"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addFile")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("v_int64 version"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" oatpp"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("::")]),t._v("String"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),t._v(" filename"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h3",{attrs:{id:"schemamigration-migrate"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#schemamigration-migrate"}},[t._v("#")]),t._v(" SchemaMigration::migrate")]),t._v(" "),s("p",[t._v("Run database schema migration.")]),t._v(" "),s("div",{staticClass:"language-cpp extra-class"},[s("pre",{pre:!0,attrs:{class:"language-cpp"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("migrate")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])])])}),[],!1,null,null,null);a.default=e.exports}}]);