[{"_path":"/components/avanda-cli/overview","_draft":false,"_partial":false,"_empty":false,"title":"CLI Overview","description":"The Avanda CLI is the cli module of avandajs, it is required to run any avandajs project. It helps in different ways, creating a new project, serving your project while developing, creaating new folder files, interacting with your database and building your project for production.","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"cli-overview"},"children":[{"type":"text","value":"CLI Overview"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The "},{"type":"element","tag":"a","props":{"href":"https://github.com/avandajs/cli","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"Avanda CLI"}]},{"type":"text","value":" is the cli module of avandajs, it is required to run any avandajs project. It helps in different ways, creating a new project, serving your project while developing, creaating new folder files, interacting with your database and building your project for production."}]},{"type":"element","tag":"h2","props":{"id":"installation"},"children":[{"type":"text","value":"Installation"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"it is recommended to use avanda in project scope, to let yarn run avanda, add avanda to list of commands in your "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"package.json"}]},{"type":"text","value":" file then run:"}]},{"type":"element","tag":"h4","props":{"id":"local-installation"},"children":[{"type":"text","value":"Local Installation"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For project scope"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda\n"}]}]}]},{"type":"element","tag":"h4","props":{"id":"global-scope"},"children":[{"type":"text","value":"Global Scope"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"When avanda cli is "},{"type":"element","tag":"a","props":{"href":"/getting-started/quick-start#setup"},"children":[{"type":"text","value":"installed globally"}]},{"type":"text","value":", you don't need to add it to the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"package.json"}]},{"type":"text","value":", you can just run:"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda -h\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda -h\n"}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#commands"},"children":[{"type":"text","value":"guides"}]},{"type":"text","value":" for more info on avanda CLI commands"}]}]},{"type":"element","tag":"h3","props":{"id":"create-a-new-project"},"children":[{"type":"text","value":"Create a new Project"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"With avanda CLI installed you can create a new project with the following lines of commands"}]},{"type":"element","tag":"code","props":{"code":"$ avanda init <project-name>\n$ cd <project-name>\n$ npm install\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ avanda init <project-name>\n$ cd <project-name>\n$ npm install\n"}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"a","props":{"href":"/getting-started/quick-start"},"children":[{"type":"text","value":"Learn More About creating a new project"}]}]}]},{"type":"element","tag":"h2","props":{"id":"comands"},"children":[{"type":"text","value":"Comands"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Once installed, you can execute CLI commands from your command line with the prefix "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"avanda"}]},{"type":"text","value":". To see the available "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"avanda"}]},{"type":"text","value":" commands check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide##commands"},"children":[{"type":"text","value":"Here"}]},{"type":"text","value":" or by entering the following:"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda -h\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda -h\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Get help on an individual command. Substitute any command like "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"create"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":", "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#command-overview"},"children":[{"type":"text","value":"etc"}]},{"type":"text","value":" where you see "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":" in the example below to get detailed help on that command:"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda app -h\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda app -h\n"}]}]}]},{"type":"element","tag":"h3","props":{"id":"command-actions"},"children":[{"type":"text","value":"Command actions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Command Actions are some verbs you add to your commands to give more intructions to the command, Actions available are mainly for the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":" command. "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#actions"},"children":[{"type":"text","value":"Learn more"}]}]},{"type":"element","tag":"h3","props":{"id":"command-options"},"children":[{"type":"text","value":"Command Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Cli options are list of options you can tag along with your command to give more intructions to the commands "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#actions"},"children":[{"type":"text","value":"Learn more"}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"cli-overview"},"children":[{"type":"text","value":"CLI Overview"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The "},{"type":"element","tag":"a","props":{"href":"https://github.com/avandajs/cli","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"Avanda CLI"}]},{"type":"text","value":" is the cli module of avandajs, it is required to run any avandajs project. It helps in different ways, creating a new project, serving your project while developing, creaating new folder files, interacting with your database and building your project for production."}]},{"type":"element","tag":"h2","props":{"id":"installation"},"children":[{"type":"text","value":"Installation"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"it is recommended to use avanda in project scope, to let yarn run avanda, add avanda to list of commands in your "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"package.json"}]},{"type":"text","value":" file then run:"}]},{"type":"element","tag":"h4","props":{"id":"local-installation"},"children":[{"type":"text","value":"Local Installation"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For project scope"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"global-scope"},"children":[{"type":"text","value":"Global Scope"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"When avanda cli is "},{"type":"element","tag":"a","props":{"href":"/getting-started/quick-start#setup"},"children":[{"type":"text","value":"installed globally"}]},{"type":"text","value":", you don't need to add it to the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"package.json"}]},{"type":"text","value":", you can just run:"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda -h\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda -h"}]}]}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#commands"},"children":[{"type":"text","value":"guides"}]},{"type":"text","value":" for more info on avanda CLI commands"}]}]},{"type":"element","tag":"h3","props":{"id":"create-a-new-project"},"children":[{"type":"text","value":"Create a new Project"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"With avanda CLI installed you can create a new project with the following lines of commands"}]},{"type":"element","tag":"code","props":{"code":"$ avanda init <project-name>\n$ cd <project-name>\n$ npm install\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ avanda init "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"project-name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"cd"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"project-name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ npm install"}]}]}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"a","props":{"href":"/getting-started/quick-start"},"children":[{"type":"text","value":"Learn More About creating a new project"}]}]}]},{"type":"element","tag":"h2","props":{"id":"comands"},"children":[{"type":"text","value":"Comands"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Once installed, you can execute CLI commands from your command line with the prefix "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"avanda"}]},{"type":"text","value":". To see the available "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"avanda"}]},{"type":"text","value":" commands check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide##commands"},"children":[{"type":"text","value":"Here"}]},{"type":"text","value":" or by entering the following:"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda -h\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda -h"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Get help on an individual command. Substitute any command like "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"create"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":", "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#command-overview"},"children":[{"type":"text","value":"etc"}]},{"type":"text","value":" where you see "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":" in the example below to get detailed help on that command:"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda app -h\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda app -h"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"command-actions"},"children":[{"type":"text","value":"Command actions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Command Actions are some verbs you add to your commands to give more intructions to the command, Actions available are mainly for the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":" command. "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#actions"},"children":[{"type":"text","value":"Learn more"}]}]},{"type":"element","tag":"h3","props":{"id":"command-options"},"children":[{"type":"text","value":"Command Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Cli options are list of options you can tag along with your command to give more intructions to the commands "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#actions"},"children":[{"type":"text","value":"Learn more"}]}]}],"toc":{"title":"","searchDepth":3,"depth":3,"links":[{"id":"installation","depth":2,"text":"Installation","children":[{"id":"local-installation","depth":4,"text":"Local Installation"},{"id":"global-scope","depth":4,"text":"Global Scope"},{"id":"create-a-new-project","depth":3,"text":"Create a new Project"}]},{"id":"comands","depth":2,"text":"Comands","children":[{"id":"command-actions","depth":3,"text":"Command actions"},{"id":"command-options","depth":3,"text":"Command Options"}]}]}},"_type":"markdown","_id":"content:2.components:1.avanda-cli:1.overview.md","_source":"content","_file":"2.components/1.avanda-cli/1.overview.md","_extension":"md"},{"_path":"/components/avanda-orm/getting-started","_draft":false,"_partial":false,"_empty":false,"title":"ORM Guide","description":"Avanda ORM is the building block of a Model, It includes all the pieces you need to create a schema for your model.","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"orm-guide"},"children":[{"type":"text","value":"ORM Guide"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Avanda ORM is the building block of a "},{"type":"element","tag":"a","props":{"href":"/guide/model"},"children":[{"type":"text","value":"Model"}]},{"type":"text","value":", It includes all the pieces you need to create a schema for your model."}]},{"type":"element","tag":"h2","props":{"id":"define-a-column"},"children":[{"type":"text","value":"Define a column"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"To define a column in your model to install in your database, Each column accepts column datatype, column datatype options,  name of the column, and a semantic datatype of the column in your model.\nIn every model created an "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"id"}]},{"type":"text","value":" is generated as the first column of the model, which accepts a semantic datatype of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"number"}]}]},{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\nexport default class BlogPost extends Model{\n  id?: number;\n  @Column.text()\n  name_of_column?: string;\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\nexport default class BlogPost extends Model{\n  id?: number;\n  @Column.text()\n  name_of_column?: string;\n}\n"}]}]}]},{"type":"element","tag":"h2","props":{"id":"column"},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"@Column"}]},{"type":"text","value":"is use to define the data type of a column in a table, paired with the datatype method suitable for your use case"}]},{"type":"element","tag":"h3","props":{"id":"list-of-columns-datatype"},"children":[{"type":"text","value":"List of Columns Datatype"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the list of datatype available on Avanda ORM"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"text"},"children":[{"type":"text","value":"Text"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store text or string to the table"}]},{"type":"element","tag":"code","props":{"code":"@Column.text()\nname_of_column?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.text()\nname_of_column?: string;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"integer"},"children":[{"type":"text","value":"Integer"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"integer"}]},{"type":"text","value":" datatype to the table"}]},{"type":"element","tag":"code","props":{"code":"@Column.int()\nname_of_column?: number;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.int()\nname_of_column?: number;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"boolean"},"children":[{"type":"text","value":"Boolean"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"boolean"}]},{"type":"text","value":" datatype in a table, and accepts default value of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"true"}]},{"type":"text","value":"| "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"false"}]}]},{"type":"element","tag":"code","props":{"code":"@Column.int()\nname_of_column?: boolean =  false;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.int()\nname_of_column?: boolean =  false;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"decimal"},"children":[{"type":"text","value":"Decimal"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQl "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"decimal"}]},{"type":"text","value":" datatype in a table, and accepts the "},{"type":"element","tag":"a","props":{"href":"#columnOptions"},"children":[{"type":"text","value":"maxSize Option"}]},{"type":"text","value":" to define the floating point"}]},{"type":"element","tag":"code","props":{"code":"@Column.decimal({\n    maxSize:[65,4]\n})\nname_of_column?: number;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.decimal({\n    maxSize:[65,4]\n})\nname_of_column?: number;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"enum"},"children":[{"type":"text","value":"Enum"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"enum"}]},{"type":"text","value":" datatype in a table, the limited values of the enum datatype can be used as a type declaration in the semantic datatype which may accept a default value"}]},{"type":"element","tag":"code","props":{"code":"@Column.enum(['value-1','value-2'])\nname_of_column?: 'value-1' | 'value-2' = 'value-2'\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.enum(['value-1','value-2'])\nname_of_column?: 'value-1' | 'value-2' = 'value-2'\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"json"},"children":[{"type":"text","value":"Json"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is used to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"json"}]},{"type":"text","value":" datatype in a table, semantic datatype for "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"json"}]},{"type":"text","value":" is the type declaration of an object or array in typescript"}]},{"type":"element","tag":"code","props":{"code":"@Column.enum()\nname_of_column?: string\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.enum()\nname_of_column?: string\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"date"},"children":[{"type":"text","value":"Date"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is used to store SQL date datatype in a table"}]},{"type":"element","tag":"code","props":{"code":"import Date from '@avanda/orm/dataTypes/Date';\n@Column.date()\nname_of_column?: Date;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import Date from '@avanda/orm/dataTypes/Date';\n@Column.date()\nname_of_column?: Date;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"point"},"children":[{"type":"text","value":"Point"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is used to store Geographic point or location datatype in a table"}]},{"type":"element","tag":"code","props":{"code":"import {GeoPoint} from \"@avanda/orm\";\n@Column.point()\nname_of_column?: GeoPoint;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {GeoPoint} from \"@avanda/orm\";\n@Column.point()\nname_of_column?: GeoPoint;\n"}]}]}]},{"type":"element","tag":"h3","props":{"id":"column-options"},"children":[{"type":"text","value":"Column Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Column options are arguments passed into the column  datatype to give constraints to the columns on your table"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are a list of columns options available :"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"nullable"},"children":[{"type":"text","value":"nullable"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The default value of any column is a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"NOT NULL"}]},{"type":"text","value":" value or a default value assigned to the column but in some cases where a column might be empty  "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"nullable"}]},{"type":"text","value":" option must be set to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"true"}]},{"type":"text","value":" to avoid the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"NOT NULL"}]},{"type":"text","value":" constraint"}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n  nullable: true\n})\nname_of_column?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.text({\n  nullable: true\n})\nname_of_column?: string;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"references"},"children":[{"type":"text","value":"references"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"With Avanda ORM linking of tables together is as easy as adding a column option "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"references"}]},{"type":"text","value":" with a new instance of the model you are trying to reference\nIn the following example the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"User"}]},{"type":"text","value":" model is referenced"}]},{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\n\n@Column.int({\n        references: new User()\n})\nname_of_column_id?: number;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\n\n@Column.int({\n        references: new User()\n})\nname_of_column_id?: number;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"maxsize"},"children":[{"type":"text","value":"maxSize"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"maxSize"}]},{"type":"text","value":" option gives the functionality of adding a maximum size of a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"text"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"int"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"decimal"}]},{"type":"text","value":" columns datatype"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"It can be used in two ways, First one is using it in "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"text"}]},{"type":"text","value":" or "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"int"}]},{"type":"text","value":" datatype as shown below"}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n    maxSize: 10 //maximum string length is 10\n})\nname_of_column_id?: string;\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.text({\n    maxSize: 10 //maximum string length is 10\n})\nname_of_column_id?: string;\n\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"It can also be used to define the floating point of a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"decimal"}]},{"type":"text","value":" column datatype"}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n    maxSize: [65, 4] //maximum precision is 65 and maximum scale is 4\n})\nname_of_column_id?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.text({\n    maxSize: [65, 4] //maximum precision is 65 and maximum scale is 4\n})\nname_of_column_id?: string;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"onupdated"},"children":[{"type":"text","value":"onUpdated"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"accepts a function, which runs when the column is updated"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"ondeleted"},"children":[{"type":"text","value":"onDeleted"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"accepts a function, which runs when the column is deleted"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"index"},"children":[{"type":"text","value":"index"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"index"}]},{"type":"text","value":" option is used to define an index on a column in the model,\nIt accepts an object with "},{"type":"element","tag":"a","props":{"href":"#index-type"},"children":[{"type":"text","value":"type"}]},{"type":"text","value":" and "},{"type":"element","tag":"a","props":{"href":"#index-name"},"children":[{"type":"text","value":"name"}]}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n    index: {\n      type: \"UNIQUE\",\n      name: \"unique_name\"\n    }\n})\nname_of_column_id?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.text({\n    index: {\n      type: \"UNIQUE\",\n      name: \"unique_name\"\n    }\n})\nname_of_column_id?: string;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"index-options"},"children":[{"type":"text","value":"index options"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the list of options available for the index column option:"}]},{"type":"element","tag":"table","props":{},"children":[{"type":"element","tag":"thead","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Option"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Description"}]}]}]},{"type":"element","tag":"tbody","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"type"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"defines the type of index, accepts "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"UNIQUE"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"FULLTEXT"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"SPATIAL"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"name"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"gives the index a name accepts "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"string"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"install-your-model"},"children":[{"type":"text","value":"Install your model"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"After writing your schema you can use the "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/overview"},"children":[{"type":"text","value":"avanda CLI"}]},{"type":"text","value":" to install the created model to your database"}]},{"type":"element","tag":"code","props":{"code":"yarn avanda app install <modelName>\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"yarn avanda app install <modelName>\n"}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more on models check "},{"type":"element","tag":"a","props":{"href":"/guide/model"},"children":[{"type":"text","value":"here"}]}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"orm-guide"},"children":[{"type":"text","value":"ORM Guide"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Avanda ORM is the building block of a "},{"type":"element","tag":"a","props":{"href":"/guide/model"},"children":[{"type":"text","value":"Model"}]},{"type":"text","value":", It includes all the pieces you need to create a schema for your model."}]},{"type":"element","tag":"h2","props":{"id":"define-a-column"},"children":[{"type":"text","value":"Define a column"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"To define a column in your model to install in your database, Each column accepts column datatype, column datatype options,  name of the column, and a semantic datatype of the column in your model.\nIn every model created an "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"id"}]},{"type":"text","value":" is generated as the first column of the model, which accepts a semantic datatype of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"number"}]}]},{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\nexport default class BlogPost extends Model{\n  id?: number;\n  @Column.text()\n  name_of_column?: string;\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"column"},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"@Column"}]},{"type":"text","value":"is use to define the data type of a column in a table, paired with the datatype method suitable for your use case"}]},{"type":"element","tag":"h3","props":{"id":"list-of-columns-datatype"},"children":[{"type":"text","value":"List of Columns Datatype"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the list of datatype available on Avanda ORM"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"text"},"children":[{"type":"text","value":"Text"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store text or string to the table"}]},{"type":"element","tag":"code","props":{"code":"@Column.text()\nname_of_column?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" string;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"integer"},"children":[{"type":"text","value":"Integer"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"integer"}]},{"type":"text","value":" datatype to the table"}]},{"type":"element","tag":"code","props":{"code":"@Column.int()\nname_of_column?: number;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" number;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"boolean"},"children":[{"type":"text","value":"Boolean"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"boolean"}]},{"type":"text","value":" datatype in a table, and accepts default value of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"true"}]},{"type":"text","value":"| "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"false"}]}]},{"type":"element","tag":"code","props":{"code":"@Column.int()\nname_of_column?: boolean =  false;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" boolean "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"false"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"decimal"},"children":[{"type":"text","value":"Decimal"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQl "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"decimal"}]},{"type":"text","value":" datatype in a table, and accepts the "},{"type":"element","tag":"a","props":{"href":"#columnOptions"},"children":[{"type":"text","value":"maxSize Option"}]},{"type":"text","value":" to define the floating point"}]},{"type":"element","tag":"code","props":{"code":"@Column.decimal({\n    maxSize:[65,4]\n})\nname_of_column?: number;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"decimal"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    maxSize"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"["}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"65"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"4"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"]"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" number;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"enum"},"children":[{"type":"text","value":"Enum"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"enum"}]},{"type":"text","value":" datatype in a table, the limited values of the enum datatype can be used as a type declaration in the semantic datatype which may accept a default value"}]},{"type":"element","tag":"code","props":{"code":"@Column.enum(['value-1','value-2'])\nname_of_column?: 'value-1' | 'value-2' = 'value-2'\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"enum"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(["}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value-1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value-2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"])"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value-1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"|"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value-2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value-2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"json"},"children":[{"type":"text","value":"Json"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is used to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"json"}]},{"type":"text","value":" datatype in a table, semantic datatype for "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"json"}]},{"type":"text","value":" is the type declaration of an object or array in typescript"}]},{"type":"element","tag":"code","props":{"code":"@Column.enum()\nname_of_column?: string\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"enum"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" string"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"date"},"children":[{"type":"text","value":"Date"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is used to store SQL date datatype in a table"}]},{"type":"element","tag":"code","props":{"code":"import Date from '@avanda/orm/dataTypes/Date';\n@Column.date()\nname_of_column?: Date;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Date "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm/dataTypes/Date"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"date"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Date"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"point"},"children":[{"type":"text","value":"Point"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is used to store Geographic point or location datatype in a table"}]},{"type":"element","tag":"code","props":{"code":"import {GeoPoint} from \"@avanda/orm\";\n@Column.point()\nname_of_column?: GeoPoint;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {GeoPoint} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"point"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" GeoPoint;"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"column-options"},"children":[{"type":"text","value":"Column Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Column options are arguments passed into the column  datatype to give constraints to the columns on your table"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are a list of columns options available :"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"nullable"},"children":[{"type":"text","value":"nullable"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The default value of any column is a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"NOT NULL"}]},{"type":"text","value":" value or a default value assigned to the column but in some cases where a column might be empty  "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"nullable"}]},{"type":"text","value":" option must be set to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"true"}]},{"type":"text","value":" to avoid the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"NOT NULL"}]},{"type":"text","value":" constraint"}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n  nullable: true\n})\nname_of_column?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" string;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"references"},"children":[{"type":"text","value":"references"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"With Avanda ORM linking of tables together is as easy as adding a column option "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"references"}]},{"type":"text","value":" with a new instance of the model you are trying to reference\nIn the following example the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"User"}]},{"type":"text","value":" model is referenced"}]},{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\n\n@Column.int({\n        references: new User()\n})\nname_of_column_id?: number;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        references"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" number;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"maxsize"},"children":[{"type":"text","value":"maxSize"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"maxSize"}]},{"type":"text","value":" option gives the functionality of adding a maximum size of a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"text"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"int"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"decimal"}]},{"type":"text","value":" columns datatype"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"It can be used in two ways, First one is using it in "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"text"}]},{"type":"text","value":" or "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"int"}]},{"type":"text","value":" datatype as shown below"}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n    maxSize: 10 //maximum string length is 10\n})\nname_of_column_id?: string;\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    maxSize"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"10"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//maximum string length is 10"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" string;"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"It can also be used to define the floating point of a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"decimal"}]},{"type":"text","value":" column datatype"}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n    maxSize: [65, 4] //maximum precision is 65 and maximum scale is 4\n})\nname_of_column_id?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    maxSize"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" ["}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"65"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"4"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"] "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//maximum precision is 65 and maximum scale is 4"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" string;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"onupdated"},"children":[{"type":"text","value":"onUpdated"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"accepts a function, which runs when the column is updated"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"ondeleted"},"children":[{"type":"text","value":"onDeleted"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"accepts a function, which runs when the column is deleted"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"index"},"children":[{"type":"text","value":"index"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"index"}]},{"type":"text","value":" option is used to define an index on a column in the model,\nIt accepts an object with "},{"type":"element","tag":"a","props":{"href":"#index-type"},"children":[{"type":"text","value":"type"}]},{"type":"text","value":" and "},{"type":"element","tag":"a","props":{"href":"#index-name"},"children":[{"type":"text","value":"name"}]}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n    index: {\n      type: \"UNIQUE\",\n      name: \"unique_name\"\n    }\n})\nname_of_column_id?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    index"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      type"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"UNIQUE"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"unique_name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" string;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"index-options"},"children":[{"type":"text","value":"index options"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the list of options available for the index column option:"}]},{"type":"element","tag":"table","props":{},"children":[{"type":"element","tag":"thead","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Option"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Description"}]}]}]},{"type":"element","tag":"tbody","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"type"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"defines the type of index, accepts "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"UNIQUE"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"FULLTEXT"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"SPATIAL"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"name"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"gives the index a name accepts "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"string"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"install-your-model"},"children":[{"type":"text","value":"Install your model"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"After writing your schema you can use the "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/overview"},"children":[{"type":"text","value":"avanda CLI"}]},{"type":"text","value":" to install the created model to your database"}]},{"type":"element","tag":"code","props":{"code":"yarn avanda app install <modelName>\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"yarn avanda app install "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"modelName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":">"}]}]}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more on models check "},{"type":"element","tag":"a","props":{"href":"/guide/model"},"children":[{"type":"text","value":"here"}]}]}]}],"toc":{"title":"","searchDepth":3,"depth":3,"links":[{"id":"define-a-column","depth":2,"text":"Define a column"},{"id":"column","depth":2,"text":"Column","children":[{"id":"list-of-columns-datatype","depth":3,"text":"List of Columns Datatype","children":[{"id":"text","depth":4,"text":"Text"},{"id":"integer","depth":4,"text":"Integer"},{"id":"boolean","depth":4,"text":"Boolean"},{"id":"decimal","depth":4,"text":"Decimal"},{"id":"enum","depth":4,"text":"Enum"},{"id":"json","depth":4,"text":"Json"},{"id":"date","depth":4,"text":"Date"},{"id":"point","depth":4,"text":"Point"}]},{"id":"column-options","depth":3,"text":"Column Options","children":[{"id":"nullable","depth":4,"text":"nullable"},{"id":"references","depth":4,"text":"references"},{"id":"maxsize","depth":4,"text":"maxSize"},{"id":"onupdated","depth":4,"text":"onUpdated"},{"id":"ondeleted","depth":4,"text":"onDeleted"},{"id":"index","depth":4,"text":"index"},{"id":"index-options","depth":4,"text":"index options"}]},{"id":"install-your-model","depth":3,"text":"Install your model"}]}]}},"_type":"markdown","_id":"content:2.components:2.avanda-orm:1.getting-started.md","_source":"content","_file":"2.components/2.avanda-orm/1.getting-started.md","_extension":"md"}]