2021-06-11 22:25:58 +03:00
|
|
|
import * as Logging from "~/common/logging";
|
|
|
|
|
2020-07-27 01:37:12 +03:00
|
|
|
import configs from "~/knexfile";
|
|
|
|
import knex from "knex";
|
|
|
|
|
|
|
|
const envConfig = configs["development"];
|
|
|
|
|
2021-06-11 22:25:58 +03:00
|
|
|
Logging.log(`SETUP: database`, envConfig);
|
2020-07-27 01:37:12 +03:00
|
|
|
|
|
|
|
const db = knex(envConfig);
|
|
|
|
|
2021-06-11 22:25:58 +03:00
|
|
|
Logging.log(`RUNNING: adjust.js`);
|
2020-07-27 01:37:12 +03:00
|
|
|
|
2021-07-07 23:50:57 +03:00
|
|
|
const addNewFieldsLinks = db.schema.table("files", function (table) {
|
|
|
|
table.string("url").nullable();
|
|
|
|
table.boolean("isLink").notNullable().defaultTo(false);
|
2021-05-25 01:19:48 +03:00
|
|
|
});
|
|
|
|
|
2021-07-07 23:50:57 +03:00
|
|
|
const addNewFieldsFiles = db.schema.table("files", function (table) {
|
|
|
|
table.string("type").nullable();
|
|
|
|
table.integer("size").notNullable().defaultTo(0);
|
|
|
|
table.string("name").nullable();
|
|
|
|
table.string("body").nullable();
|
|
|
|
table.jsonb("coverImage").nullable();
|
|
|
|
table.string("author").nullable();
|
|
|
|
table.string("source").nullable();
|
2021-05-25 01:19:48 +03:00
|
|
|
});
|
|
|
|
|
2021-07-07 23:50:57 +03:00
|
|
|
const addNewFieldsUsers = db.schema.table("users", function (table) {
|
|
|
|
table.string("name").nullable();
|
|
|
|
table.string("body").nullable();
|
|
|
|
table.string("photo").nullable();
|
|
|
|
table.string("twitter").nullable();
|
|
|
|
table.boolean("twitterVerified").notNullable().defaultTo(false);
|
2021-05-25 01:19:48 +03:00
|
|
|
});
|
|
|
|
|
2021-07-07 23:50:57 +03:00
|
|
|
const addNewFieldsSlates = db.schema.table("slates", function (table) {
|
|
|
|
table.string("name").nullable();
|
|
|
|
table.string("body").nullable();
|
|
|
|
table.string("preview").nullable();
|
2021-05-25 01:19:48 +03:00
|
|
|
});
|
|
|
|
|
2021-07-07 23:50:57 +03:00
|
|
|
Promise.all([addNewFieldsLinks]);
|
2020-07-27 01:37:12 +03:00
|
|
|
|
2021-06-11 22:25:58 +03:00
|
|
|
Logging.log(`FINISHED: adjust.js`);
|
|
|
|
Logging.log(` CTRL +C to return to terminal.`);
|