23 lines
621 B
TypeScript
23 lines
621 B
TypeScript
import BaseSchema from "@ioc:Adonis/Lucid/Schema";
|
|
|
|
export default class extends BaseSchema {
|
|
protected tableName = "key_values";
|
|
|
|
public async up() {
|
|
this.schema.createTable(this.tableName, (table) => {
|
|
table.increments("id_key").primary();
|
|
table.string("key", 100).notNullable();
|
|
table.string("value", 200).notNullable();
|
|
table.string("model", 30).notNullable().defaultTo("All");
|
|
/**
|
|
* Uses timestamptz for PostgreSQL and DATETIME2 for MSSQL
|
|
*/
|
|
table.timestamps(true, true);
|
|
});
|
|
}
|
|
|
|
public async down() {
|
|
this.schema.dropTable(this.tableName);
|
|
}
|
|
}
|