Skip to content

3. Setup the database

yopox edited this page Sep 4, 2019 · 1 revision

The Dimensionneuse is a DIY template : it is meant to be hacked to suit your environment. In this page, you will find a configuration example for the database.

Database Management System

You can use any DBMS, here postgreSQL will be used.

Here's the table specification :

CREATE TABLE dimensionneuse
(
  x integer,
  px integer,
  y integer,
  py integer,
  z integer,
  pz integer,
  location text,
  material text,
  volume text,
  id text NOT NULL,
  alive boolean NOT NULL DEFAULT true,
  CONSTRAINT dimensionneuse_pkey PRIMARY KEY (id)
)
  • x : The x dimension of the object
  • y : The y dimension of the object
  • z : The z dimension of the object
  • px : The precision for the x measure (x ± px)
  • py : The precision for the y measure (y ± py)
  • pz : The precision for the z measure (z ± pz)
  • location : Where the object will be stored
  • material : The object's material (kind of wood, of metal, …)
  • volume : The object's category (plank, cleat, …)
  • id : The object's ID (generated)
  • alive : True if the object is available

js code

Setup

Once the database is setup, you need to change some informations on database/index.js :

const dbConfig = {
    user: '…',
    host: '127.0.0.1',
    database: '…',
    password: '…',
    port: ,
}

const tableName = "…"

Plank ID generation

In database/index.js, the plankID function is responsible for assigning planks ID. By default the ID will be location-nb. You can rewrite the function to change the format or use different numbering rules, but the ID needs to be unique !

Clone this wiki locally