Before creating Table, lets see how to create a column. A column in JsStore is an json object. It has following properties -

  • {
  • Name: string, //name of column
  • PrimaryKey: boolean, //declare this column primary key
  • NotNull: boolean, //ensure this column value should not be null.
  • DataType: string, //datatype of this column.
  • //supported datatype are :- string,boolean,object,number
  • AutoIncrement: boolean, //automatically increment value
  • Unique: boolean //This column will have unique value.
  • Default: any, //Provides a default value for a column when none is specified.
  • }

So Table in JsStore is an Array of columns.

  • var Table1={
  • Name: "table_name",
  • Columns:[{
  • Name: "column1",
  • DataType: 'datatype'
  • PrimaryKey: true
  • },
  • {
  • Name: "column2",
  • DataType: 'datatype'
  • },
  • .....
  • {
  • Name: "columnN",
  • DataType: 'datatype'
  • }
  • ]
  • }

Next