slate/scripts/adjust.js

47 lines
1.3 KiB
JavaScript
Raw Normal View History

import * as Logging from "~/common/logging";
import configs from "~/knexfile";
import knex from "knex";
const envConfig = configs["development"];
Logging.log(`SETUP: database`, envConfig);
const db = knex(envConfig);
Logging.log(`RUNNING: adjust.js`);
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]);
Logging.log(`FINISHED: adjust.js`);
Logging.log(` CTRL +C to return to terminal.`);