awSQL/docs/docusaurus/build/assets/js/c8ec3168.0f7a63be.js
2025-04-13 14:28:04 +02:00

1 line
5.5 KiB
JavaScript

"use strict";(self.webpackChunkdocusaurus=self.webpackChunkdocusaurus||[]).push([[388],{2268:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>o,frontMatter:()=>i,metadata:()=>r,toc:()=>a});const r=JSON.parse('{"id":"classes/alter-table","title":"AlterTable","description":"Modifies an existing table by altering its structure.","source":"@site/docs/classes/alter-table.md","sourceDirName":"classes","slug":"/classes/alter-table","permalink":"/awSQL/classes/alter-table","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":9,"frontMatter":{"sidebar_position":9},"sidebar":"defaultSidebar","previous":{"title":"CreateTable","permalink":"/awSQL/classes/create-table"},"next":{"title":"Typedefs","permalink":"/awSQL/category/typedefs"}}');var n=s(4848),c=s(8453);const i={sidebar_position:9},l="AlterTable",d={},a=[{value:"Methods",id:"methods",level:2},{value:"selectDatabase()",id:"selectdatabase",level:3},{value:"structure()",id:"structure",level:3},{value:"execute()",id:"execute",level:3}];function h(e){const t={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",hr:"hr",li:"li",p:"p",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,c.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.header,{children:(0,n.jsx)(t.h1,{id:"altertable",children:"AlterTable"})}),"\n",(0,n.jsx)(t.p,{children:"Modifies an existing table by altering its structure."}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h2,{id:"methods",children:"Methods"}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h3,{id:"selectdatabase",children:"selectDatabase()"}),"\n",(0,n.jsxs)(t.p,{children:["\u2192 (",(0,n.jsx)(t.code,{children:"database"})," = ",(0,n.jsx)(t.strong,{children:"String"}),") \u2192 ",(0,n.jsx)(t.code,{children:"this"})]}),"\n",(0,n.jsx)(t.p,{children:"Switches to a different database for this query."}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.strong,{children:"Parameters"})}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Parameter"}),(0,n.jsx)(t.th,{children:"Type"}),(0,n.jsx)(t.th,{children:"Description"})]})}),(0,n.jsx)(t.tbody,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.code,{children:"database"})}),(0,n.jsx)(t.td,{children:(0,n.jsx)(t.strong,{children:"String"})}),(0,n.jsx)(t.td,{children:"The name of the database to select."})]})})]}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.strong,{children:"Returns"})}),"\n",(0,n.jsxs)(t.p,{children:["\u2192 ",(0,n.jsx)(t.code,{children:"this"})]}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h3,{id:"structure",children:"structure()"}),"\n",(0,n.jsxs)(t.p,{children:["\u2192 (",(0,n.jsx)(t.code,{children:"structure"})," = ",(0,n.jsx)(t.a,{href:"./structure",children:"Structure"}),") \u2192 ",(0,n.jsx)(t.code,{children:"this"})]}),"\n",(0,n.jsx)(t.p,{children:"Defines the new table structure."}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.strong,{children:"Behavrior"})}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"Drops"})," columns that exist in the current table but not in the new structure."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"Adds"})," missing columns."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"Modifies"})," columns where datatypes differ."]}),"\n"]}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.strong,{children:"Parameters"})}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Parameter"}),(0,n.jsx)(t.th,{children:"Type"}),(0,n.jsx)(t.th,{children:"Description"})]})}),(0,n.jsx)(t.tbody,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.code,{children:"structure"})}),(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"./structure",children:"Structure"})}),(0,n.jsx)(t.td,{children:"The new structure definition."})]})})]}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.strong,{children:"Returns"})}),"\n",(0,n.jsxs)(t.p,{children:["\u2192 ",(0,n.jsx)(t.code,{children:"this"})]}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h3,{id:"execute",children:"execute()"}),"\n",(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"async"})," \u2192 () \u2192 ",(0,n.jsx)(t.a,{href:"./instance#checkstructure",children:"Instance.checkStructure()"})]}),"\n",(0,n.jsx)(t.p,{children:"Executes the prepared table alteration query."}),"\n",(0,n.jsx)(t.admonition,{title:"Important",type:"warning",children:(0,n.jsxs)(t.p,{children:["The ",(0,n.jsx)(t.a,{href:"#structure",children:"structure()"})," method ",(0,n.jsx)(t.strong,{children:"must"})," be called before executing, or the operation may fail."]})}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.strong,{children:"Returns"})}),"\n",(0,n.jsxs)(t.p,{children:["\u2192 ",(0,n.jsx)(t.a,{href:"./instance#checkstructure",children:"Instance.checkStructure()"})," - Performs a post-execution structure check and returns the result."]}),"\n",(0,n.jsx)(t.hr,{})]})}function o(e={}){const{wrapper:t}={...(0,c.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(h,{...e})}):h(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>l});var r=s(6540);const n={},c=r.createContext(n);function i(e){const t=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),r.createElement(c.Provider,{value:t},e.children)}}}]);