mirror of
https://github.com/ArthurDanjou/artdanj-shortener.git
synced 2026-01-14 13:54:03 +01:00
20 lines
487 B
TypeScript
Executable File
20 lines
487 B
TypeScript
Executable File
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
|
|
|
|
export default class Links extends BaseSchema {
|
|
protected tableName = 'links'
|
|
|
|
public async up () {
|
|
this.schema.createTable(this.tableName, (table) => {
|
|
table.increments('id')
|
|
table.string('code').notNullable()
|
|
table.string('target').notNullable()
|
|
table.integer('visit_count').defaultTo(0)
|
|
table.timestamps(true)
|
|
})
|
|
}
|
|
|
|
public async down () {
|
|
this.schema.dropTable(this.tableName)
|
|
}
|
|
}
|