'use strict';

require('dotenv').config();
const Pg = require('pg');

const MEASUREMENTS_TABLE = process.env.MEASUREMENTS_TABLE;
const STATION_IDS_TABLE = process.env.STATION_IDS_TABLE;

const pg = new Pg.Client({
    connectionString: process.env.DATABASE_URL,
    ssl: true
});

pg.connect();

const measurementsTable = pg.query(`CREATE TABLE ${MEASUREMENTS_TABLE}(timestamp TIMESTAMP NOT NULL, station_id VARCHAR(12) NOT NULL, is_occupied BOOL NOT NULL, distance INT NOT NULL)`)
    .then(result => console.log(`${MEASUREMENTS_TABLE} created`))
    .catch(error => console.log(error));


const stationIdsTable = pg.query(`CREATE TABLE ${STATION_IDS_TABLE}(station_id VARCHAR(12) NOT NULL)`)
    .then(result => console.log(`${STATION_IDS_TABLE} created`))
    .catch(error => console.log(error));

Promise.all([measurementsTable, stationIdsTable]).then(values => pg.end());
@@ -359,16 +359,17 @@
 S_TABLE%7D
+ 
 (timesta
@@ -389,16 +389,28 @@
 NOT NULL
+ PRIMARY KEY
 , statio

Add primary key while creating tables