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 as primary key
  • //We strongly recommend to create the primary keys
  • NotNull: boolean, //ensure this column value should not be null.
  • DataType: JsStore.Data_Type, //datatype of this column.
  • 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.
  • MultiEntry: boolean, // Provides support to search inside array values.
  • EnableSearch: boolean - default value is true, // Turn on/off search for this column.
  • }

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'
  • }
  • ]
  • }

Note :- We strongly recommend to create a primary key for every table.

Next