feat: migration for v2.0.0

v2.0.0
ricky rx 2 years ago
parent aee6d9440c
commit 4bde317a23

@ -0,0 +1,4 @@
Notes:
- Auto Update app
- Auto Update video
- Laravel Sanctum

@ -0,0 +1,2 @@
Notes:
- TV information & Logs

@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void {
Schema::create('outlets', function (Blueprint $table) {
$table->id();
$table->string('code', 50)->index();
$table->string('name', 255)->nullable()->index();
$table->string('address', 255)->nullable();
$table->string('street_address', 255)->nullable();
$table->string('phone', 50)->nullable()->index();
$table->double('lat')->default(0);
$table->double('long')->default(0);
$table->string('notes', 255)->nullable();
$table->string('country', 255);
$table->string('ik_country_id', 255);
$table->string('state', 255);
$table->string('ik_state_id', 255);
$table->string('region', 255);
$table->string('ik_region_id', 255);
$table->string('city', 255);
$table->string('ik_city_id', 255);
$table->string('zipcode', 255)->nullable();
$table->timestampTz('last_visited_at')->nullable();
$table->timestampsTz();
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::drop('outlets');
}
};

@ -0,0 +1,79 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void {
Schema::create('tvs', function (Blueprint $table) {
$table->id();
$table->foreignId('outlet_fk')->nullable();
$table->string('code', 50)->unique();
$table->string('ik_address_id', 255);
$table->string('notes', 255)->nullable();
$table->timestampTz('last_connected_at')->nullable();
$table->string('col1', 255)->nullable();
$table->string('col2', 255)->nullable();
$table->string('col3', 255)->nullable();
$table->string('col4', 255)->nullable();
$table->string('col5', 255)->nullable();
$table->string('col6', 255)->nullable();
$table->string('col7', 255)->nullable();
$table->string('col8', 255)->nullable();
$table->string('col9', 255)->nullable();
$table->string('col10', 255)->nullable();
$table->bool('is_acctive')->default(true);
$table->timestampsTz();
});
Schema::create('tv_sessions', function (Blueprint $table) {
$table->id();
$table->foreignId('tv_fk')->index();
$table->timestampTz('started_at')->index();
$table->timestampTz('finished_at')->nullable()->index();
$table->boolean('is_playing_video');
$table->jsonb('current_videos')->nullable();
$table->timestampsTz();
$table->foreign('tv_fk')->references('id')->on('tvs');
});
Schema::create('tv_app_infos', function (Blueprint $table) {
$table->foreignId('tv_fk')->unique()->index();
$table->timestampTz('installed_at')->nullable()->index();
$table->jsonb('current_videos')->nullable();
$table->timestampTz('last_updated_video')->nullable()->index();
$table->timestampsTz();
$table->foreign('tv_fk')->references('id')->on('tvs');
});
Schema::create('tv_app_logs', function (Blueprint $table) {
$table->id();
$table->foreignId('tv_fk')->index();
$table->string('requested_to');
$table->string('ip', 50);
$table->jsonb('request_data')->nullable();
$table->enum('result', ['success', 'failed']);
$table->jsonb('response_data')->nullable();
$table->timestampsTz();
$table->foreign('tv_fk')->references('id')->on('tvs');
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::drop('tv_app_logs');
Schema::drop('tv_app_infos');
Schema::drop('tv_sessions');
Schema::drop('tvs');
}
};

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void {
Schema::create('sts_logs', function (Blueprint $table) {
$table->id();
$table->string('partner', 255)->nullable();
$table->boolean('is_outgoing');
$table->string('module', 255)->nullable();
$table->string('service_name', 255)->nullable();
$table->string('local_id', 255)->nullable();
$table->string('partner_id', 255)->nullable();
$table->enum('result', ['success', 'failed', 'warning']);
$table->jsonb('error_info')->nullable();
$table->tinyInteger('seq');
$table->jsonb('request_data')->nullable();
$table->timestampTz('request_time')->nullable();
$table->boolean('is_retry');
$table->timestampsTz();
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::drop('sts_logs');
}
};
Loading…
Cancel
Save