mirror of
https://github.com/ArthurDanjou/artdanj-shortener.git
synced 2026-02-01 20:29:33 +01:00
rework and update deps
This commit is contained in:
1
database/factories/index.ts
Normal file
1
database/factories/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
// import Factory from '@ioc:Adonis/Lucid/Factory'
|
||||
18
database/migrations/1587988332388_users.ts
Normal file
18
database/migrations/1587988332388_users.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
|
||||
|
||||
export default class UsersSchema extends BaseSchema {
|
||||
protected tableName = 'users'
|
||||
|
||||
public async up () {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.increments('id').primary()
|
||||
table.string('email', 255).notNullable()
|
||||
table.string('password', 180).notNullable()
|
||||
table.timestamps(true)
|
||||
})
|
||||
}
|
||||
|
||||
public async down () {
|
||||
this.schema.dropTable(this.tableName)
|
||||
}
|
||||
}
|
||||
19
database/migrations/1618757695309_links.ts
Normal file
19
database/migrations/1618757695309_links.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user