1 line
5.1 KiB
JavaScript
1 line
5.1 KiB
JavaScript
"use strict";(self.webpackChunkdocusaurus=self.webpackChunkdocusaurus||[]).push([[388],{2268:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>o,frontMatter:()=>l,metadata:()=>r,toc:()=>a});const r=JSON.parse('{"id":"classes/alter-table","title":"AlterTable","description":"Alters a table.","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 l={sidebar_position:9},i="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:"Alters a table."}),"\n",(0,n.jsx)(t.h2,{id:"methods",children:"Methods"}),"\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:"Selects 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:"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:"The new desired structure for the table to get."}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:"Drops columns that are existing in the current table but not in the given structure"}),"\n",(0,n.jsx)(t.li,{children:"Adds columns that are missing in the current table"}),"\n",(0,n.jsx)(t.li,{children:"Modifies all other columns where at least one datatype is not matching"}),"\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:"New structure definition for the table"})]})})]}),"\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.strong,{children:"any"})]}),"\n",(0,n.jsx)(t.admonition,{title:"Possible crash",type:"warning",children:(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.a,{href:"#structure",children:"structure()"})," must always be given."]})}),"\n",(0,n.jsx)(t.p,{children:"Executes the prepared query."}),"\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()"})," - Checks the structure afterwards and returns the check 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:()=>l,x:()=>i});var r=s(6540);const n={},c=r.createContext(n);function l(e){const t=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:l(e.components),r.createElement(c.Provider,{value:t},e.children)}}}]); |