Initial commit: PC Builder AdonisJS project
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { BaseSchema } from '@adonisjs/lucid/schema'
|
||||
|
||||
export default class extends BaseSchema {
|
||||
protected tableName = 'computers'
|
||||
|
||||
async up() {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.increments('id')
|
||||
table.string('title').notNullable()
|
||||
table.integer('state_id').notNullable()
|
||||
table.float('sell_price', 6, 2).nullable()
|
||||
table.integer('gpu_score').notNullable()
|
||||
table.integer('cpu_score').notNullable()
|
||||
table.integer('global_score').notNullable()
|
||||
table.integer('user_id').unsigned().references('id').inTable('users').onDelete('CASCADE')
|
||||
table.timestamp('created_at')
|
||||
table.timestamp('updated_at')
|
||||
})
|
||||
}
|
||||
|
||||
async down() {
|
||||
this.schema.dropTable(this.tableName)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user