Код: Выделить всё
class CreateFactsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('pgsql')->create('facts', function (Blueprint $table) {
$table->bigInteger('entry_id');
$table->string('tag');
$table->timestampTz('time');
$table->double('sensor_value');
$table->index(['entry_id', 'tag', 'time']);
$table->unique(['entry_id', 'tag', 'time']);
});
DB::connection('pgsql')->statement('SELECT create_hypertable(\'facts\', \'time\');');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// Tried both, neither would delete the table
Schema::connection('pgsql')->dropIfExists('facts');
//DB::connection('pgsql')->statement('DROP TABLE facts;');
}
}
Когда я запускаю миграцию php artisan:fresh up() не может создать таблицу и выдает ошибку дублирования таблицы:
Код: Выделить всё
Duplicate table: 7 ERROR: relation "facts" already exists
Подробнее здесь: https://stackoverflow.com/questions/646 ... -extension
Мобильная версия