From 4bde317a233ea70c28d43dd2451d3b9fdb4c8eca Mon Sep 17 00:00:00 2001 From: ricky rx Date: Sat, 18 May 2024 11:24:44 +0700 Subject: [PATCH] feat: migration for v2.0.0 --- .../2014_10_11_000000_V1.0.1_MARKER | 4 + .../2024_05_15_000000_V2.0.0_MARKER | 2 + .../migrations/2024_05_18_033101_outlet.php | 43 ++++++++++ database/migrations/2024_05_18_033105_tv.php | 79 +++++++++++++++++++ .../migrations/2024_05_18_033128_sts_log.php | 37 +++++++++ 5 files changed, 165 insertions(+) create mode 100644 database/migrations/2014_10_11_000000_V1.0.1_MARKER create mode 100644 database/migrations/2024_05_15_000000_V2.0.0_MARKER create mode 100644 database/migrations/2024_05_18_033101_outlet.php create mode 100644 database/migrations/2024_05_18_033105_tv.php create mode 100644 database/migrations/2024_05_18_033128_sts_log.php diff --git a/database/migrations/2014_10_11_000000_V1.0.1_MARKER b/database/migrations/2014_10_11_000000_V1.0.1_MARKER new file mode 100644 index 0000000..c9e720f --- /dev/null +++ b/database/migrations/2014_10_11_000000_V1.0.1_MARKER @@ -0,0 +1,4 @@ +Notes: +- Auto Update app +- Auto Update video +- Laravel Sanctum \ No newline at end of file diff --git a/database/migrations/2024_05_15_000000_V2.0.0_MARKER b/database/migrations/2024_05_15_000000_V2.0.0_MARKER new file mode 100644 index 0000000..f2532ed --- /dev/null +++ b/database/migrations/2024_05_15_000000_V2.0.0_MARKER @@ -0,0 +1,2 @@ +Notes: +- TV information & Logs \ No newline at end of file diff --git a/database/migrations/2024_05_18_033101_outlet.php b/database/migrations/2024_05_18_033101_outlet.php new file mode 100644 index 0000000..923f94e --- /dev/null +++ b/database/migrations/2024_05_18_033101_outlet.php @@ -0,0 +1,43 @@ +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'); + } +}; diff --git a/database/migrations/2024_05_18_033105_tv.php b/database/migrations/2024_05_18_033105_tv.php new file mode 100644 index 0000000..1092337 --- /dev/null +++ b/database/migrations/2024_05_18_033105_tv.php @@ -0,0 +1,79 @@ +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'); + } +}; diff --git a/database/migrations/2024_05_18_033128_sts_log.php b/database/migrations/2024_05_18_033128_sts_log.php new file mode 100644 index 0000000..caa949b --- /dev/null +++ b/database/migrations/2024_05_18_033128_sts_log.php @@ -0,0 +1,37 @@ +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'); + } +};