2020-07-27 01:37:12 +03:00
|
|
|
import configs from "~/knexfile";
|
|
|
|
import knex from "knex";
|
|
|
|
|
|
|
|
const envConfig = configs["development"];
|
|
|
|
|
|
|
|
console.log(`SETUP: database`, envConfig);
|
|
|
|
|
|
|
|
const db = knex(envConfig);
|
|
|
|
|
2020-07-28 09:54:15 +03:00
|
|
|
console.log(`RUNNING: adjust.js`);
|
2020-07-27 01:37:12 +03:00
|
|
|
|
2020-12-02 10:07:49 +03:00
|
|
|
const createGlobalTable = db.schema.createTable("global", function (table) {
|
|
|
|
table.uuid("id").primary().unique().notNullable().defaultTo(db.raw("uuid_generate_v4()"));
|
2020-10-19 02:26:14 +03:00
|
|
|
table.jsonb("data").nullable();
|
2020-12-02 10:07:49 +03:00
|
|
|
table.timestamp("created_at").notNullable().defaultTo(db.raw("now()"));
|
2020-09-28 23:12:43 +03:00
|
|
|
});
|
|
|
|
|
2020-12-02 10:07:49 +03:00
|
|
|
Promise.all([createGlobalTable]);
|
2020-07-27 01:37:12 +03:00
|
|
|
|
2020-09-29 00:30:12 +03:00
|
|
|
console.log(`FINISHED: adjust.js`);
|
2020-07-27 01:37:12 +03:00
|
|
|
console.log(` CTRL +C to return to terminal.`);
|