Level 3
I share this, in case it is useful for someone else:
<?php
class AddTaskTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::connection()->getPdo()->exec(
"CREATE TABLE task (
id SERIAL PRIMARY KEY,
done boolean,
title varchar(100),
description text,
created_at timestamp without time zone DEFAULT NOW(),
updated_at timestamp without time zone DEFAULT NOW()
);
COMMENT ON TABLE task IS 'This table stores tasks';
COMMENT ON COLUMN task.done IS 'If the task was done';
COMMENT ON COLUMN task.title IS 'The task title';
COMMENT ON COLUMN task.description IS 'The task description';"
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::connection()->getPdo()->exec('DROP TABLE task');
}
}