kutt/server/models/host.model.js

26 lines
586 B
JavaScript
Raw Permalink Normal View History

2024-08-11 18:41:03 +03:30
async function createHostTable(knex) {
const hasTable = await knex.schema.hasTable("hosts");
if (!hasTable) {
await knex.schema.createTable("hosts", table => {
table.increments("id").primary();
table
.string("address")
.unique()
.notNullable();
table
.boolean("banned")
.notNullable()
.defaultTo(false);
table
.integer("banned_by_id")
2024-10-07 14:37:36 +03:30
.unsigned()
.references("id")
.inTable("users");
table.timestamps(false, true);
});
}
}
2024-08-11 18:41:03 +03:30
module.exports = {
createHostTable
}