You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`);P=P.concat(L(r));consto=p.descendants();for(lett=0;t<o.length;t++){constn=o[t];if(p.optionEQvalue("genpk",!0)&&o[t].parseName()=="id"){constu=n.content.toLowerCase().indexOf("id");P.push(newh(q.duplicateId,newd(n.line,u),newd(n.line,u+2)));continue}constl=n.src[2];if(2<n.src.length&&l.value=="-"){constu=l.begin;P.push(newh(q.invalidDatatype,newd(n.line,u),newd(n.line,u+2)));continue}constc=n.src[1];if(1<n.src.length&&0<c.value.indexOf("0")){constu=c.begin;P.push(newh(q.invalidDatatype,newd(n.line,u)));continue}P=P.concat(D(p,n)),P=P.concat(B(p,n))}returnP}functionD(C,p){varI=[];if(p.parseType()=="view")for(varP=p.src,r=2;r<P.length;r++){varo=C.find(P[r].value);o==null&&I.push(newh(q.undefinedObject+P[r].value,newd(p.line,P[r].begin),newd(p.line,P[r].begin+P[r].value.length)))}returnI}functionB(C,p){varI=[];if(p.isOption("fk")||0<p.indexOf("reference",!0)){letr=p.indexOf("fk");if(r<0&&(r=p.indexOf("reference")),r++,p.src.length-1<r)returnI;varP=C.find(p.src[r].value);P==null&&I.push(newh(q.undefinedObject+p.src[r].value,newd(p.line,p.src[r].begin),newd(p.line,p.src[r].begin+p.src[r].value.length)))}returnI}functionL(C){for(varp=[],I=Pe(C),P=1;P<C.length;P++){varr=C[P-1],o=C[P],t=te(r),n=te(o);n!=0&&t<n&&n<t+I&&p.push(newh(q.misalignedAttribute+I,newd(P,n)))}returnp}returnw}();functionPe(h){letd=[];for(varw=0;w<h.length;w++){varD=h[w];d[w]=te(D)}letB=[];for(letC=0;C<d.length;C++){letp=Ee(d,C);if(p!=null){letI=B[d[C]-d[p]];I==null&&(I=0),B[d[C]-d[p]]=I+1}}letL=null;for(letCinB)(L==null||B[L]<=B[C])&&(L=parseInt(C));returnL}functionte(h){for(vard=h.split(/|\t/),w=0,D=0;D<d.length;D++){varB=d[D];if(B==" "&&(w+=4),B==""){w++;continue}if(!/[^.a-zA-Z0-9_"]/.test(B))returnw}return0}functionEe(h,d){for(letw=d;0<=w;w--)if(h[w]<h[d])returnw;returnnull}constq={duplicateId:"Explicit ID column conflicts with genpk",invalidDatatype:"Invalid Datatype",undefinedObject:"Undefined Object: ",misalignedAttribute:"Misaligned Table or Column; apparent indent = "},ke={findErrors:Be,messages:q},de="identityDataType",oe="guid",fe="Timestamp with time zone",be="Timestamp with local time zone",j=function(){consth={apex:{label:"APEX",value:"no",check:["yes","no"]},auditcols:{label:"Audit Columns",value:"no",check:["yes","no"]},createdcol:{label:"Created Column Name",value:"created"},createdbycol:{label:"Created By Column Name",value:"created_by"},updatedcol:{label:"Updated Column Name",value:"updated"},updatedbycol:{label:"Updated By Column Name",value:"updated_by"},boolean:{label:"Boolean Datatype",value:"not set",check:["yn","native"]},genpk:{label:"Auto Primary Key",value:"yes",check:["yes","no"]},semantics:{label:"Character Strings",value:"CHAR",check:["BYTE","CHAR","Default"]},language:{label:"Data Language",value:"EN",check:["EN","JP","KO"]},datalimit:{label:"Data Limit Rows",value:1e4},date:{label:"Date Data Type",value:"DATE",check:["DATE","TIMESTAMP",fe,be]},db:{label:"Database Version",value:"not set",check:["19c"]},dv:{label:"Duality View",value:"no",check:["yes","no"]},drop:{label:"Include Drops",value:"no",check:["yes","no"]},editionable:{label:"Editinable",value:"no",check:["yes","no"]},inserts:{label:"Generate Inserts",value:!0,check:["yes","no"]},namelen:{label:"Name Character Length",value:255},overridesettings:{label:"Ignore toDDL() second parameter",value:"no",check:["yes","no"]},prefix:{label:"Object Prefix",value:""},pk:{label:"Primary Key Maintenance",value:oe,check:[de,oe,"SEQ","NONE"]},prefixpkwithtname:{label:"Prefix primary keys with table name",value:"no",check:["yes","no"]},rowkey:{label:"Alphanumeric Row Identifier",value:"no",check:["yes","no"]},rowversion:{label:"Row Version Number",value:"no",check:["yes","no"]},schema:{label:"Schema",value:""},api:{label:"Table API",value:"no",check:["yes","no"]},compress:{label:"Table Compression",value:"no",check:["yes","no"]}};functiond(D){if(D==null)returnnull;letB=D;returntypeofB=="string"&&(B=B.toLowerCase()),B=="yes"?!0:B=="no"?!1:B=="y"?!0:B=="n"?!1:B=="true"?!0:B=="false"?!1:B==de.toLowerCase()?"identity":B==oe.toLowerCase()?"guid":B==fe.toLowerCase()?"tswtz":B==be.toLowerCase()?"tswltz":B}functionw(D,B){this.ddl=null,this.erd=null,this.errors=null,this.options=JSON.parse(JSON.stringify(h)),this.input=D,this.postponedAlters=[],this.getOptionValue=function(C){constp=C.toLowerCase();letI=this.options[p];if(!(pinthis.options))for(letPinthis.options){constr=this.options[P].label;if(r==null)continue;r.toLowerCase()==p&&(I=this.options[P])}returnI==null?null:I.value},this.optionEQvalue=function(C,p){varI=this.getOptionValue(C);returnd(I)==d(p)},this.nonDefaultOptions=function(){letC={};for(letpinthis.options)h[p]&&!this.optionEQvalue(p,h[p].value)&&(C[p]=this.options[p].value);returnC},this.unknownOptions=function(){letC=[];for(letpinthis.options)h[p]==null&&C.push(p);returnC},this.setOptionValue=function(C,p){letI=C.toLowerCase();if(!(Iinthis.options)){for(letrinthis.options)if(this.options[r].label==C){this.options[r].value=p;return}}p==null&&(p="");letP=this.options[I];P==null&&(P={},this.options[I]=P),P.value=p},this.semantics=function(){varC="";returnthis.optionEQvalue("semantics","CHAR")?C=" char":this.optionEQvalue("semantics","BYTE")&&(C=" byte"),C},this.name2node=null,this.find=function(C){if(this.name2node!=null)returnthis.name2node[X(C)];this.name2node={};for(varp=0;p<this.forest.length;p++)for(varI=this.forest[p].descendants(),P=0;P<I.length;P++){varr=I[P];this.name2node[r.parseName()]=r}returnthis.name2node[X(C)]},this.setOptions=function(C){C=C.trim(),C.startsWith("#")&&(C=C.substring(1).trim());constp=C.indexOf("=");letI=C.substring(p+1).trim();I.indexOf("{")<0&&(I="{"+C+"}");letP="",r=$(I,!0,!0,"");for(lettinr){letn=r[t];n.type=="identifier"&&n.value!="true"&&n.value!="false"&&n.value!="null"?P+='"'+n.value+'"':P+=n.value}leto=JSON.parse(P);for(lettino)this.setOptionValue(t.toLowerCase(),o[t])},this.descendants=function(){for(varC=[],p=0;p<this.forest.length;p++)C=C.concat(this.forest[p].descendants());returnC},this.additionalColumns=function(){varC=[],p=this.getOptionValue("Auxiliary Columns");if(p==null)returnC;for(varI=p.split(","),P=0;P<I.length;P++){varr=I[P].trim(),o="VARCHAR2(4000)",t=r.indexOf(" ");0<t&&(o=r.substring(t+1).toUpperCase(),r=r.substring(0,t)),C[r]=o}returnC},this.objPrefix=function(C){varp=this.getOptionValue("schema");p==null&&(p=""),p!=""&&C==null?p=p+".":p="";varI="";returnthis.getOptionValue("prefix")!=null&&(I=this.getOptionValue("prefix")),p=p+I,I!=""&&!I.endsWith("_")&&(p=p+"_"),p.toLowerCase()};letL="";0<D.toLowerCase().indexOf("overridesettings")&&he(this),B!=null&&this.optionEQvalue("overrideSettings",!1)&&(L="# settings = "+B+`
236
+
`);P=P.concat(L(r));consto=p.descendants();for(lett=0;t<o.length;t++){constn=o[t];if(p.optionEQvalue("genpk",!0)&&o[t].parseName()=="id"){constu=n.content.toLowerCase().indexOf("id");P.push(newh(q.duplicateId,newd(n.line,u),newd(n.line,u+2)));continue}constl=n.src[2];if(2<n.src.length&&l.value=="-"){constu=l.begin;P.push(newh(q.invalidDatatype,newd(n.line,u),newd(n.line,u+2)));continue}constc=n.src[1];if(1<n.src.length&&0<c.value.indexOf("0")){constu=c.begin;P.push(newh(q.invalidDatatype,newd(n.line,u)));continue}P=P.concat(D(p,n)),P=P.concat(B(p,n))}returnP}functionD(C,p){varI=[];if(p.parseType()=="view")for(varP=p.src,r=2;r<P.length;r++){varo=C.find(P[r].value);o==null&&I.push(newh(q.undefinedObject+P[r].value,newd(p.line,P[r].begin),newd(p.line,P[r].begin+P[r].value.length)))}returnI}functionB(C,p){varI=[];if(p.isOption("fk")||0<p.indexOf("reference",!0)){letr=p.indexOf("fk");if(r<0&&(r=p.indexOf("reference")),r++,p.src.length-1<r)returnI;varP=C.find(p.src[r].value);P==null&&I.push(newh(q.undefinedObject+p.src[r].value,newd(p.line,p.src[r].begin),newd(p.line,p.src[r].begin+p.src[r].value.length)))}returnI}functionL(C){for(varp=[],I=Pe(C),P=1;P<C.length;P++){varr=C[P-1],o=C[P],t=te(r),n=te(o);n!=0&&t<n&&n<t+I&&p.push(newh(q.misalignedAttribute+I,newd(P,n)))}returnp}returnw}();functionPe(h){letd=[];for(varw=0;w<h.length;w++){varD=h[w];d[w]=te(D)}letB=[];for(letC=0;C<d.length;C++){letp=Ee(d,C);if(p!=null){letI=B[d[C]-d[p]];I==null&&(I=0),B[d[C]-d[p]]=I+1}}letL=null;for(letCinB)(L==null||B[L]<=B[C])&&(L=parseInt(C));returnL}functionte(h){for(vard=h.split(/|\t/),w=0,D=0;D<d.length;D++){varB=d[D];if(B==" "&&(w+=4),B==""){w++;continue}if(!/[^.a-zA-Z0-9_"]/.test(B))returnw}return0}functionEe(h,d){for(letw=d;0<=w;w--)if(h[w]<h[d])returnw;returnnull}constq={duplicateId:"Explicit ID column conflicts with genpk",invalidDatatype:"Invalid Datatype",undefinedObject:"Undefined Object: ",misalignedAttribute:"Misaligned Table or Column; apparent indent = "},ke={findErrors:Be,messages:q},de="identityDataType",oe="guid",fe="Timestamp with time zone",be="Timestamp with local time zone",j=function(){consth={apex:{label:"APEX",value:"no",check:["yes","no"]},auditcols:{label:"Audit Columns",value:"no",check:["yes","no"]},createdcol:{label:"Created Column Name",value:"created"},createdbycol:{label:"Created By Column Name",value:"created_by"},updatedcol:{label:"Updated Column Name",value:"updated"},updatedbycol:{label:"Updated By Column Name",value:"updated_by"},boolean:{label:"Boolean Datatype",value:"not set",check:["yn","native"]},genpk:{label:"Auto Primary Key",value:"yes",check:["yes","no"]},semantics:{label:"Character Strings",value:"CHAR",check:["BYTE","CHAR","Default"]},language:{label:"Data Language",value:"EN",check:["EN","JP","KO"]},datalimit:{label:"Data Limit Rows",value:1e4},date:{label:"Date Data Type",value:"DATE",check:["DATE","TIMESTAMP",fe,be]},db:{label:"Database Version",value:"not set"},dv:{label:"Duality View",value:"no",check:["yes","no"]},drop:{label:"Include Drops",value:"no",check:["yes","no"]},editionable:{label:"Editinable",value:"no",check:["yes","no"]},inserts:{label:"Generate Inserts",value:!0,check:["yes","no"]},namelen:{label:"Name Character Length",value:255},overridesettings:{label:"Ignore toDDL() second parameter",value:"no",check:["yes","no"]},prefix:{label:"Object Prefix",value:""},pk:{label:"Primary Key Maintenance",value:oe,check:[de,oe,"SEQ","NONE"]},prefixpkwithtname:{label:"Prefix primary keys with table name",value:"no",check:["yes","no"]},rowkey:{label:"Alphanumeric Row Identifier",value:"no",check:["yes","no"]},rowversion:{label:"Row Version Number",value:"no",check:["yes","no"]},schema:{label:"Schema",value:""},api:{label:"Table API",value:"no",check:["yes","no"]},compress:{label:"Table Compression",value:"no",check:["yes","no"]}};functiond(D){if(D==null)returnnull;letB=D;returntypeofB=="string"&&(B=B.toLowerCase()),B=="yes"?!0:B=="no"?!1:B=="y"?!0:B=="n"?!1:B=="true"?!0:B=="false"?!1:B==de.toLowerCase()?"identity":B==oe.toLowerCase()?"guid":B==fe.toLowerCase()?"tswtz":B==be.toLowerCase()?"tswltz":B}functionw(D,B){this.ddl=null,this.erd=null,this.errors=null,this.options=JSON.parse(JSON.stringify(h)),this.input=D,this.postponedAlters=[],this.getOptionValue=function(C){constp=C.toLowerCase();letI=this.options[p];if(!(pinthis.options))for(letPinthis.options){constr=this.options[P].label;if(r==null)continue;r.toLowerCase()==p&&(I=this.options[P])}returnI==null?null:I.value},this.optionEQvalue=function(C,p){varI=this.getOptionValue(C);returnd(I)==d(p)},this.nonDefaultOptions=function(){letC={};for(letpinthis.options)h[p]&&!this.optionEQvalue(p,h[p].value)&&(C[p]=this.options[p].value);returnC},this.unknownOptions=function(){letC=[];for(letpinthis.options)h[p]==null&&C.push(p);returnC},this.setOptionValue=function(C,p){letI=C.toLowerCase();if(!(Iinthis.options)){for(letrinthis.options)if(this.options[r].label==C){this.options[r].value=p;return}}p==null&&(p="");letP=this.options[I];P==null&&(P={},this.options[I]=P),P.value=p},this.semantics=function(){varC="";returnthis.optionEQvalue("semantics","CHAR")?C=" char":this.optionEQvalue("semantics","BYTE")&&(C=" byte"),C},this.name2node=null,this.find=function(C){if(this.name2node!=null)returnthis.name2node[X(C)];this.name2node={};for(varp=0;p<this.forest.length;p++)for(varI=this.forest[p].descendants(),P=0;P<I.length;P++){varr=I[P];this.name2node[r.parseName()]=r}returnthis.name2node[X(C)]},this.setOptions=function(C){C=C.trim(),C.startsWith("#")&&(C=C.substring(1).trim());constp=C.indexOf("=");letI=C.substring(p+1).trim();I.indexOf("{")<0&&(I="{"+C+"}");letP="",r=$(I,!0,!0,"");for(lettinr){letn=r[t];n.type=="identifier"&&n.value!="true"&&n.value!="false"&&n.value!="null"?P+='"'+n.value+'"':P+=n.value}leto=JSON.parse(P);for(lettino)this.setOptionValue(t.toLowerCase(),o[t])},this.descendants=function(){for(varC=[],p=0;p<this.forest.length;p++)C=C.concat(this.forest[p].descendants());returnC},this.additionalColumns=function(){varC=[],p=this.getOptionValue("Auxiliary Columns");if(p==null)returnC;for(varI=p.split(","),P=0;P<I.length;P++){varr=I[P].trim(),o="VARCHAR2(4000)",t=r.indexOf(" ");0<t&&(o=r.substring(t+1).toUpperCase(),r=r.substring(0,t)),C[r]=o}returnC},this.objPrefix=function(C){varp=this.getOptionValue("schema");p==null&&(p=""),p!=""&&C==null?p=p+".":p="";varI="";returnthis.getOptionValue("prefix")!=null&&(I=this.getOptionValue("prefix")),p=p+I,I!=""&&!I.endsWith("_")&&(p=p+"_"),p.toLowerCase()};letL="";0<D.toLowerCase().indexOf("overridesettings")&&he(this),B!=null&&this.optionEQvalue("overrideSettings",!1)&&(L="# settings = "+B+`
237
237
238
238
`),this.input=L+D,this.forest=he(this),this.getERD=function(){if(this.erd!=null)returnthis.erd;letC=this.descendants(),p={items:[]};for(letr=0;r<C.length;r++){if(C[r].parseType()!="table")continue;leto={name:this.objPrefix("no schema")+C[r].parseName("")},t=this.getOptionValue("schema");t==""&&(t=null),o.schema=t,o.columns=[],p.items.push(o);letn=C[r].getGenIdColName();n!=null&&o.columns.push({name:n,datatype:"number"});for(letc=0;c<C[r].children.length;c++){letu=C[r].children[c];if(u.parseType()!="table"&&(o.columns.push({name:u.parseName(""),datatype:u.parseType(b=>!0)}),0<u.indexOf("file"))){constb=u.parseName();o.columns.push({name:b+"_filename",datatype:"varchar2(255"+this.semantics()+")"}),o.columns.push({name:b+"_mimetype",datatype:"varchar2(255"+this.semantics()+")"}),o.columns.push({name:b+"_charset",datatype:"varchar2(255"+this.semantics()+")"}),o.columns.push({name:b+"_lastupd",datatype:"date"})}}constl=C[r].trimmedContent().toUpperCase();if((this.optionEQvalue("rowkey",!0)||0<l.indexOf("/ROWKEY"))&&o.columns.push({name:"row_key",datatype:"varchar2(30 char)"}),(this.optionEQvalue("rowVersion","yes")||0<l.indexOf("/ROWVERSION"))&&o.columns.push({name:"row_version",datatype:"integer"}),this.optionEQvalue("Audit Columns","yes")||0<l.indexOf("/AUDITCOLS")){letc=this.getOptionValue("createdcol");o.columns.push({name:c,datatype:this.getOptionValue("Date Data Type").toLowerCase()});letu=this.getOptionValue("createdbycol");o.columns.push({name:u,datatype:"varchar2(255"+this.semantics()+")"});letb=this.getOptionValue("updatedcol");o.columns.push({name:b,datatype:this.getOptionValue("Date Data Type").toLowerCase()});letA=this.getOptionValue("updatedbycol");o.columns.push({name:A,datatype:"varchar2(255"+this.semantics()+")"})}varI=this.additionalColumns();for(letcinI){varP=I[c];pad=tab+" ".repeat(this.maxChildNameLen()-c.length),ret+=tab+c.toUpperCase()+pad+P+` not null,
0 commit comments