CodeForAfrica / HURUmap-Data

0 stars 0 forks source link

Pushing data to database #6

Open karimkawambwa opened 4 years ago

karimkawambwa commented 4 years ago

A better migration could be used but for now I manually run each script using TablePlus and sometimes I use this script:

const fs = require("fs");
const knex = require("knex")({ client: "postgres" });

(async () => {
  await new Promise.all(
    fs
      .readdirSync("./sql")
      .map(async (filename) =>
        knex.raw(fs.readFileSync(`./sql/${filename}`).toString())
      )
  );
})();
karimkawambwa commented 4 years ago

cc @KhadijaMahanga @ascii-dev

karimkawambwa commented 4 years ago

cc @kilemensi