pixelfed/database/migrations/2019_08_07_184030_create_places_table.php
Daniel Supernault 3ed275df31
Add Place model
2019-08-08 00:06:31 -06:00

45 lines
1.2 KiB
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePlacesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('places', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('slug')->index();
$table->string('name')->index();
$table->string('country')->index();
$table->json('aliases')->nullable();
$table->decimal('lat', 9, 6)->nullable();
$table->decimal('long', 9, 6)->nullable();
$table->unique(['slug', 'country', 'lat', 'long']);
$table->timestamps();
});
Schema::table('statuses', function (Blueprint $table) {
$table->bigInteger('place_id')->unsigned()->nullable()->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('places');
Schema::table('statuses', function (Blueprint $table) {
$table->dropColumn('place_id');
});
}
}