Skip to content

Commit

Permalink
add: resolutions migration
Browse files Browse the repository at this point in the history
  • Loading branch information
HDVinnie committed Jun 6, 2020
1 parent c22701b commit e269456
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 0 deletions.
69 changes: 69 additions & 0 deletions app/Models/Resolution.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D
*
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
* @author HDVinnie
*/

namespace App\Models;

use App\Traits\Auditable;
use Illuminate\Database\Eloquent\Model;

/**
* App\Models\Resolution.
*
* @property int $id
* @property string $name
* @property string $slug
* @property int $position
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TorrentRequest[] $requests
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Torrent[] $torrents
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution wherePosition($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution whereSlug($value)
* @mixin \Eloquent
* @property-read int|null $requests_count
* @property-read int|null $torrents_count
*/
class Resolution extends Model
{
use Auditable;

/**
* Indicates If The Model Should Be Timestamped.
*
* @var bool
*/
public $timestamps = false;

/**
* Has Many Torrents.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function torrents()
{
return $this->hasMany(Torrent::class);
}

/**
* Has Many Torrent Requests.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function requests()
{
return $this->hasMany(TorrentRequest::class);
}
}
44 changes: 44 additions & 0 deletions database/migrations/2020_06_06_185230_create_resolutions_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author HDVinnie <[email protected]>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateResolutionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('resolutions', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('slug');
$table->integer('position');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('resolutions');
}
}

0 comments on commit e269456

Please sign in to comment.