migration cleanup and new foreign keys on existing migrations

This commit is contained in:
2021-05-30 20:39:02 +09:00
parent 353d8c5183
commit 86534dea29
14 changed files with 48 additions and 1051 deletions

View File

@@ -1,67 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMoonsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('Moons')) {
Schema::create('Moons', function (Blueprint $table) {
$table->increments('id');
$table->string('Region');
$table->string('System');
$table->string('Planet');
$table->string('Moon');
$table->unsignedBigInteger('StructureId')->nullable();
$table->string('StructureName')->default('No Name');
$table->string('FirstOre')->default('None');
$table->integer('FirstQuantity')->default('0');
$table->string('SecondOre')->default('None');
$table->integer('SecondQuantity')->default('0');
$table->string('ThirdOre')->default('None');
$table->integer('ThirdQuantity')->default('0');
$table->string('FourthOre')->default('None');
$table->integer('FourthQuantity')->default('0');
$table->string('RentalCorp')->default('Not Rented');
$table->integer('RentalEnd')->default('0');
$table->string('Paid')->default('No');
});
}
if(!Schema::hasTable('moon_rents')) {
Schema::create('moon_rents', function (Blueprint $table) {
$table->increments('id');
$table->string('System');
$table->string('Planet');
$table->string('Moon');
$table->unsignedBigInteger('StructureId')->nullable();
$table->string('RentalCorp');
$table->dateTime('RentalEnd');
$table->string('Contact');
$table->string('Price');
$table->string('Type');
$table->string('Paid');
$table->string('Paid_Until')->nullable();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('Moons');
Schema::dropIfExists('moon_rents');
}
}

View File

@@ -1,99 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateStructures extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('Structures')) {
Schema::create('Structures', function(Blueprint $table) {
$table->integer('corporation_id');
$table->dateTime('fuel_expires');
$table->dateTime('next_reinforce_apply');
$table->integer('next_reinforce_hour');
$table->integer('next_reinforce_weekday');
$table->integer('profile_id');
$table->integer('reinforce_hour');
$table->integer('reinforce_weekday');
$table->dateTime('services');
$table->string('state');
$table->date('state_timer_end');
$table->date('state_timer_start');
$table->integer('structure_id')->unique();
$table->integer('system_id');
$table->integer('type_id');
$table->dateTime('unanchors_at');
$table->timestamps();
});
}
if(!Schema::hasTable('CorpStructures')) {
Schema::create('CorpStructures', function(Blueprint $table) {
$table->increments('id');
$table->integer('character_id');
$table->integer('corporation_id');
$table->string('corporation_name');
$table->string('region');
$table->string('system');
$table->string('structure_name');
$table->decimal('tax', 10, 2);
$table->string('structure_type');
$table->timestamps();
});
}
if(!Schema::hasTable('corp_tax_ratios')) {
Schema::create('corp_tax_ratios', function (Blueprint $table) {
$table->increments('id');
$table->string('corporation_id');
$table->string('corporation_name');
$table->string('structure_type');
$table->string('ratio');
$table->timestamps();
});
}
if(!Schema::hasTable('alliance_flex_structures')) {
Schema::create('alliance_flex_structures', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('requestor_id');
$table->string('requestor_name');
$table->unsignedBigInteger('requestor_corp_id');
$table->string('requestor_corp_name');
$table->unsignedBigInteger('system_id');
$table->string('system');
$table->enum('structure_type', [
'Cyno Jammer',
'Cyno Beacon',
'Jump Bridge',
'Super Construction Facilities',
'Market',
]);
$table->double('structure_cost', 20, 2);
$table->dateTime('paid_until');
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('Structures');
Schema::dropIfExists('CorpStructures');
Schema::dropIfExists('corp_tax_ratios');
Schema::dropIfExists('flex_structures');
}
}

View File

@@ -1,310 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCorpJournal extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('CorpJournals')) {
Schema::create('CorpJournals', function(Blueprint $table) {
$table->string('id')->unique();
$table->integer('corporation_id')->nullabe();
$table->integer('division')->default(0);
$table->decimal('amount', 20, 2)->nullable();
$table->decimal('balance', 20, 2)->nullable();
$table->integer('context_id')->nullable();
$table->string('context_id_type')->nullable();
$table->dateTime('date')->nullabe();
$table->string('description')->nullabe();
$table->integer('first_party_id')->nullable();
$table->string('reason')->default(' ');
$table->string('ref_type')->nullabe();
$table->integer('second_party_id')->nullable();
$table->decimal('tax', 20, 2)->default(0.00);
$table->integer('tax_receiver_id')->nullable();
$table->timestamps();
});
}
if(!Schema::hasTable('HoldingCorpFinancesJournal')) {
Schema::create('HoldingCorpFinancesJournal', function(Blueprint $table) {
$table->integer('id')->unique();
$table->decimal('amount', 20, 2);
$table->decimal('balance', 20, 2);
$table->integer('context_id');
$table->string('context_id_type');
$table->dateTime('date');
$table->string('description');
$table->integer('first_party_id')->nullable();
$table->string('reason')->nullabe();
$table->string('ref_type');
$table->integer('second_party_id')->nullable();
$table->decimal('tax', 20, 2)->default(0.00);
$table->integer('tax_receiver_id')->nullable();
});
}
if(!Schema::hasTable('jump_bridge_journal')) {
Schema::create('jump_bridge_journal', function(Blueprint $table) {
$table->string('id')->unique();
$table->integer('corporation_id')->nullabe();
$table->integer('division')->default(0);
$table->decimal('amount', 20, 2)->nullable();
$table->decimal('balance', 20, 2)->nullable();
$table->bigInteger('context_id')->nullable();
$table->string('context_id_type')->nullable();
$table->dateTime('date')->nullabe();
$table->string('description')->nullabe();
$table->integer('first_party_id')->nullable();
$table->string('reason')->default(' ');
$table->string('ref_type')->nullabe();
$table->integer('second_party_id')->nullable();
$table->decimal('tax', 20, 2)->default(0.00);
$table->integer('tax_receiver_id')->nullable();
$table->timestamps();
});
}
if(!Schema::hasTable('player_donation_journal')) {
Schema::create('player_donation_journal', function(Blueprint $table) {
$table->string('id')->unique();
$table->integer('corporation_id')->nullabe();
$table->integer('division')->default(0);
$table->decimal('amount', 20, 2)->nullable();
$table->decimal('balance', 20, 2)->nullable();
$table->bigInteger('context_id')->nullable();
$table->string('context_id_type')->nullable();
$table->dateTime('date')->nullabe();
$table->string('description')->nullabe();
$table->integer('first_party_id')->nullable();
$table->string('reason')->default(' ');
$table->string('ref_type')->nullabe();
$table->integer('second_party_id')->nullable();
$table->decimal('tax', 20, 2)->default(0.00);
$table->integer('tax_receiver_id')->nullable();
$table->timestamps();
});
}
if(!Schema::hasTable('reprocessing_tax_journal')) {
Schema::create('reprocessing_tax_journal', function(Blueprint $table) {
$table->string('id')->unique();
$table->integer('corporation_id')->nullabe();
$table->integer('division')->default(0);
$table->decimal('amount', 20, 2)->nullable();
$table->decimal('balance', 20, 2)->nullable();
$table->integer('context_id')->nullable();
$table->string('context_id_type')->nullable();
$table->dateTime('date')->nullabe();
$table->string('description')->nullabe();
$table->integer('first_party_id')->nullable();
$table->string('reason')->default(' ');
$table->string('ref_type')->nullabe();
$table->integer('second_party_id')->nullable();
$table->decimal('tax', 20, 2)->default(0.00);
$table->integer('tax_receiver_id')->nullable();
$table->timestamps();
});
}
if(!Schema::hasTable('office_fees_journal')) {
Schema::create('office_fees_journal', function(Blueprint $table) {
$table->string('id')->unique();
$table->integer('corporation_id')->nullabe();
$table->integer('division')->default(0);
$table->decimal('amount', 20, 2)->nullable();
$table->decimal('balance', 20, 2)->nullable();
$table->integer('context_id')->nullable();
$table->string('context_id_type')->nullable();
$table->dateTime('date')->nullabe();
$table->string('description')->nullabe();
$table->integer('first_party_id')->nullable();
$table->string('reason')->default(' ');
$table->string('ref_type')->nullabe();
$table->integer('second_party_id')->nullable();
$table->decimal('tax', 20, 2)->default(0.00);
$table->integer('tax_receiver_id')->nullable();
$table->timestamps();
});
}
if(!Schema::hasTable('structure_industry_tax_journal')) {
Schema::create('structure_industry_tax_journal', function(Blueprint $table) {
$table->string('id')->unique();
$table->integer('corporation_id')->nullabe();
$table->integer('division')->default(0);
$table->decimal('amount', 20, 2)->nullable();
$table->decimal('balance', 20, 2)->nullable();
$table->integer('context_id')->nullable();
$table->string('context_id_type')->nullable();
$table->dateTime('date')->nullabe();
$table->string('description')->nullabe();
$table->integer('first_party_id')->nullable();
$table->string('reason')->default(' ');
$table->string('ref_type')->nullabe();
$table->integer('second_party_id')->nullable();
$table->decimal('tax', 20, 2)->default(0.00);
$table->integer('tax_receiver_id')->nullable();
$table->timestamps();
});
}
if(!Schema::hasTable('planet_production_tax_journal')) {
Schema::create('planet_production_tax_journal', function(Blueprint $table) {
$table->string('id')->unique();
$table->integer('corporation_id')->nullabe();
$table->integer('division')->default(0);
$table->decimal('amount', 20, 2)->nullable();
$table->decimal('balance', 20, 2)->nullable();
$table->integer('context_id')->nullable();
$table->string('context_id_type')->nullable();
$table->dateTime('date')->nullabe();
$table->string('description')->nullabe();
$table->integer('first_party_id')->nullable();
$table->string('reason')->default(' ');
$table->string('ref_type')->nullabe();
$table->integer('second_party_id')->nullable();
$table->decimal('tax', 20, 2)->default(0.00);
$table->integer('tax_receiver_id')->nullable();
$table->timestamps();
});
}
if(!Schema::hasTable('monthly_market_taxes')) {
Schema::create('monthly_market_taxes', function (Blueprint $table) {
$table->increments('id');
$table->string('character_id');
$table->string('character_name');
$table->string('corporation_id');
$table->string('corporation_name');
$table->decimal('tax_owed', 20, 2);
$table->string('month');
$table->string('year');
$table->timestamps();
});
}
if(!Schema::hasTable('pi_sale_journal')) {
Schema::create('pi_sale_journal', function(Blueprint $table) {
$table->string('id')->unique();
$table->integer('corp_id');
$table->integer('division');
$table->integer('client_id');
$table->string('date');
$table->boolean('is_buy');
$table->integer('journal_ref_id');
$table->integer('location_id');
$table->integer('quantity');
$table->integer('transaction_id');
$table->integer('type_id');
$table->decimal('unit_price');
$table->timestamps();
});
}
if(!Schema::hasTable('alliance_market_journal')) {
Schema::create('alliance_market_journal', function(Blueprint $table) {
$table->string('id')->unique();
$table->integer('corporation_id')->nullabe();
$table->integer('division')->default(0);
$table->decimal('amount', 20, 2)->nullable();
$table->decimal('balance', 20, 2)->nullable();
$table->bigInteger('context_id')->nullable();
$table->string('context_id_type')->nullable();
$table->dateTime('date')->nullabe();
$table->string('description')->nullabe();
$table->integer('first_party_id')->nullable();
$table->string('reason')->default(' ');
$table->string('ref_type')->nullabe();
$table->integer('second_party_id')->nullable();
$table->decimal('tax', 20, 2)->default(0.00);
$table->integer('tax_receiver_id')->nullable();
$table->timestamps();
});
}
if(!Schema::hasTable('corp_market_journal')) {
Schema::create('corp_market_journal', function(Blueprint $table) {
$table->string('id')->unique();
$table->integer('corporation_id')->nullabe();
$table->integer('division')->default(0);
$table->decimal('amount', 20, 2)->nullable();
$table->decimal('balance', 20, 2)->nullable();
$table->bigInteger('context_id')->nullable();
$table->string('context_id_type')->nullable();
$table->dateTime('date')->nullabe();
$table->string('description')->nullabe();
$table->integer('first_party_id')->nullable();
$table->string('reason')->default(' ');
$table->string('ref_type')->nullabe();
$table->integer('second_party_id')->nullable();
$table->decimal('tax', 20, 2)->default(0.00);
$table->integer('tax_receiver_id')->nullable();
$table->timestamps();
});
}
if(!Schema::hasTable('corp_market_structures')) {
Schema::create('corp_market_structures', function(Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('character_id');
$table->unsignedInteger('corporation_id');
$table->decimal('tax', 5, 2);
$table->decimal('ratio', 5, 2);
$table->timestamps();
});
}
if(!Schema::hasTable('sov_bill_journal')) {
Schema::create('sov_bill_journal', function(Blueprint $table) {
$table->string('id')->unique();
$table->integer('corporation_id')->nullabe();
$table->integer('division')->default(0);
$table->decimal('amount', 20, 2)->nullable();
$table->decimal('balance', 20, 2)->nullable();
$table->bigInteger('context_id')->nullable();
$table->string('context_id_type')->nullable();
$table->dateTime('date')->nullabe();
$table->string('description')->nullabe();
$table->integer('first_party_id')->nullable();
$table->string('reason')->default(' ');
$table->string('ref_type')->nullabe();
$table->integer('second_party_id')->nullable();
$table->decimal('tax', 20, 2)->default(0.00);
$table->integer('tax_receiver_id')->nullable();
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('CorpWalletJournals');
Schema::dropIfExists('HoldingcorpFinancesJournal');
Schema::dropIfExists('jump_bridge_journal');
Schema::dropIfExists('player_donation_journal');
Schema::dropIfExists('reprocessing_tax_journal');
Schema::dropIfExists('office_fees_journal');
Schema::dropIfExists('structure_industry_tax');
Schema::dropIfExists('planet_production_tax_journal');
Schema::dropIfExists('monthly_market_taxes');
Schema::dropIfExists('pi_sale_journal');
Schema::dropIfExists('alliance_market_journal');
Schema::dropIfExists('corp_market_journal');
Schema::dropIfExists('corp_market_structures');
Schema::dropIfExists('sov_bill_journal');
}
}

View File

@@ -1,66 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateContractsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('contracts')) {
Schema::create('contracts', function(Blueprint $table) {
$table->increments('contract_id')->unique();
$table->string('title');
$table->string('type');
$table->date('end_date');
$table->text('body');
$table->boolean('finished')->default(false);
$table->decimal('final_cost', 20, 2)->nullable();
$table->timestamps();
});
}
if(!Schema::hasTable('contract_bids')) {
Schema::create('contract_bids', function(Blueprint $table) {
$table->increments('id')->unique();
$table->integer('contract_id');
$table->decimal('bid_amount', 20, 2);
$table->string('character_name');
$table->string('character_id');
$table->string('corporation_name');
$table->string('corporation_id');
$table->text('notes');
$table->timestamps();
});
}
if(!Schema::hasTable('accepted_bids')) {
Schema::create('accepted_bids', function(Blueprint $table) {
$table->increments('id');
$table->integer('contract_id');
$table->integer('bid_id');
$table->decimal('bid_amount', 20, 2);
$table->text('notes')->default(null);
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('contracts');
Schema::dropIfExists('contract_bids');
Schema::dropIfExists('accepted_bids');
}
}

View File

@@ -1,36 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateJobProcessWalletJournal extends Migration
{
/**
* Run the migration
*
* @return void
*/
public function up() {
if(!Schema::hasTable('job_process_wallet_journal')) {
Schema::create('job_process_wallet_journal', function(Blueprint $table) {
$table->increments('id')->unique();
$table->string('charId');
$table->string('division');
$table->integer('page');
$table->timestamps();
});
}
}
/**
* Reverse the migration
*
* @return void
*/
public function down() {
Schema::dropIfExists('job_process_wallet_journal');
}
}
?>

View File

@@ -1,51 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAllianceAnchorStructureTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('alliance_anchor_structure')) {
Schema::create('alliance_anchor_structure', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedInteger('corporation_id');
$table->string('corporation_name');
$table->string('system');
$table->enum('structure_size', [
'M',
'L',
'XL',
]);
$table->enum('structure_type', [
'Flex',
'Citadel',
'Engineering',
'Refinery',
]);
$table->dateTime('requested_drop_time');
$table->unsignedInteger('requester_id');
$table->string('requester');
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('alliance_anchor_structure');
}
}

View File

@@ -1,77 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAllianceMoonsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('alliance_moons')) {
Schema::create('alliance_moons', function (Blueprint $table) {
$table->unsignedBigInteger('id')->unique();
$table->string('Region');
$table->string('System');
$table->string('Planet');
$table->string('Moon');
$table->string('Corporation');
$table->string('StructureName')->default('No Name');
$table->string('FirstOre')->default('None');
$table->integer('FirstQuantity')->default('0');
$table->string('SecondOre')->default('None');
$table->integer('SecondQuantity')->default('0');
$table->string('ThirdOre')->default('None');
$table->integer('ThirdQuantity')->default('0');
$table->string('FourthOre')->default('None');
$table->integer('FourthQuantity')->default('0');
$table->string('MoonType');
$table->enum('Availability', [
'Available',
'Request Pending',
'Reserved',
'Deployed',
])->default('Available');
});
}
if(!Schema::hasTable('alliance_moon_requests')) {
Schema::create('alliance_moon_requests', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('region');
$table->string('system');
$table->string('planet');
$table->string('moon');
$table->string('corporation_name');
$table->string('corporation_ticker');
$table->unsignedBigInteger('corporation_id');
$table->string('requestor_name');
$table->unsignedBigInteger('requestor_id');
$table->string('approver_name')->nullable();
$table->unsignedBigInteger('approver_id')->nullable();
$table->enum('status', [
'Pending',
'Approved',
'Denied',
]);
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('alliance_moons');
Schema::dropIfExists('alliance_moon_requests');
}
}

View File

@@ -1,94 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateRentalMoonLedgerTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('alliance_mining_observers')) {
Schema::create('alliance_mining_observers', function(Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('corporation_id');
$table->string('corporation_name')->nullable();
$table->unsignedBigInteger('observer_id');
$table->string('observer_name')->nullable();
$table->string('observer_type')->nullable();
$table->dateTime('last_updated');
$table->timestamps();
});
}
if(!Schema::hasTable('alliance_rental_moon_ledgers')) {
Schema::create('alliance_rental_moon_ledgers', function(Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('corporation_id');
$table->string('corporation_name')->nullable();
$table->unsignedBigInteger('character_id');
$table->string('character_name')->nullable();
$table->unsignedBigInteger('observer_id');
$table->string('observer_name')->nullable();
$table->unsignedBigInteger('type_id');
$table->string('ore');
$table->unsignedBigInteger('quantity');
$table->unsignedBigInteger('recorded_corporation_id');
$table->string('record_corporation_name');
$table->dateTime('last_updated');
$table->timestamps();
});
}
if(!Schema::hasTable('corp_mining_observers')) {
Schema::create('corp_mining_observers', function(Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('corporation_id');
$table->string('corporation_name')->nullable();
$table->unsignedBigInteger('observer_id');
$table->string('observer_name')->nullable();
$table->string('observer_type')->nullable();
$table->unsignedBigInteger('observer_owner_id');
$table->unsignedBigInteger('solar_system_id');
$table->unsignedBigInteger('observer_type_id');
$table->dateTime('last_updated');
$table->timestamps();
});
}
if(!Schema::hasTable('corp_moon_ledgers')) {
Schema::create('corp_moon_ledgers', function(Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('corporation_id');
$table->string('corporation_name')->nullable();
$table->unsignedBigInteger('character_id');
$table->string('character_name')->nullable();
$table->unsignedBigInteger('observer_id');
$table->string('observer_name')->nullable();
$table->unsignedBigInteger('type_id');
$table->string('ore');
$table->unsignedBigInteger('quantity');
$table->unsignedBigInteger('recorded_corporation_id');
$table->string('recorded_corporation_name')->nullable();
$table->dateTime('last_updated');
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('alliance_rental_moon_ledgers');
Schema::dropIfExists('corp_moon_ledgers');
}
}

View File

@@ -1,53 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAllianceMoonRentalInvoicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('alliance_moon_rental_invoices')) {
Schema::create('alliance_moon_rental_invoices', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('invoice_id')->unique();
$table->unsignedBigInteger('character_id');
$table->string('character_name');
$table->unsignedBigInteger('corporation_id');
$table->string('corporation_name');
$table->text('rental_moons')->nullalbe();
$table->decimal('invoice_amount', 17, 2);
$table->dateTime('due_date');
$table->enum('paid', ['Yes', 'No'])->default('No');
$table->timestamps();
});
}
if(!Schema::hasTable('alliance_moon_rental_payments')) {
Schema::create('alliance_moon_rental_payments', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('invoice_id')->unique();
$table->decimal('payment_amount');
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('alliance_moon_rental_invoices');
Schema::dropIfExists('alliance_moon_rental_payments');
}
}

View File

@@ -1,77 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAllianceMoonRentalsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('alliance_rental_moons')) {
Schema::create('alliance_rental_moons', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('region');
$table->string('system');
$table->string('planet');
$table->string('moon');
$table->unsignedBigInteger('structure_id')->default(0);
$table->string('structure_name')->default('No Name');
$table->string('first_ore')->default('None');
$table->decimal('first_quantity')->default(0.00);
$table->string('second_ore')->default('None');
$table->decimal('second_quantity')->default(0.00);
$table->string('third_ore')->default('None');
$table->decimal('third_quantity')->default(0.00);
$table->string('fourth_ore')->default('None');
$table->decimal('fourth_quantity')->default(0.00);
$table->decimal('moon_worth', 17, 2)->default(0.00);
$table->decimal('alliance_rental_price', 17,2)->default(0.00);
$table->decimal('out_of_alliance_rental_price', 17,2)->default(0.00);
$table->enum('rental_type', [
'Not Rented',
'In Alliance',
'Out of Alliance',
'Alliance',
])->default('Not Rented');
$table->dateTime('rental_until')->nullable();
$table->unsignedBigInteger('rental_contact_id')->default(0);
$table->enum('rental_contact_type', [
'Character',
'Corporation',
'Alliance',
'Unknown',
'Not Rented',
])->default('Not Rented');
$table->enum('paid' ,[
'Yes',
'No',
'Not Rented',
])->default('Not Rented');
$table->dateTime('paid_until')->nullable();
$table->dateTime('alliance_use_until')->nullable();
$table->dateTime('next_moon_pull')->nullable();
$table->timestamps();
});
}
//Drop the older tables
Schema::dropIfExists('moon_rents');
Schema::dropIfExists('RentalMoons');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('alliance_rental_moons');
}
}

View File

@@ -1,41 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateRentalRecordsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('alliance_rental_systems')) {
Schema::create('alliance_rental_systems', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('contact_id');
$table->string('contact_name');
$table->unsignedBigInteger('corporation_id');
$table->string('corporation_name');
$table->unsignedBigInteger('system_id');
$table->string('system_name');
$table->double('rental_cost', 20, 2);
$table->dateTime('paid_until');
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('alliance_rental_systems');
}
}

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RemoveContractTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('public_contracts');
Schema::dropIfExists('public_contract_items');
Schema::dropIfExists('market_groups');
Schema::dropIfExists('market_prices');
Schema::dropIfExists('market_region_orders');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@@ -1,47 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RemoveUnusedTables02142021 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('wiki_groupnames');
Schema::dropIfExists('wiki_member');
Schema::dropIfExists('wiki_user');
Schema::dropIfExists('PlayerDonationJournals');
Schema::dropIfExists('corp_mining_observers');
Schema::dropIfExists('corp_moon_ledgers');
Schema::dropIfExists('alliance_anchor_structure');
Schema::dropIfExists('alliance_rental_moons');
Schema::dropIfExists('alliance_moon_rental_invoices');
Schema::dropIfExists('alliance_moon_rental_payments');
Schema::dropIfExists('alliance_moon_requests');
Schema::dropIfExists('alliance_rental_moons');
Schema::dropIfExists('alliance_rental_moon_ledgers');
Schema::dropIfExists('alliance_rental_systems');
Schema::dropIfExists('fleet_activity_tracking');
Schema::dropIfExists('Fleets');
Schema::dropIfExists('eve_mails');
Schema::dropIfExists('bucks_character_wallet_entries');
Schema::dropIfExists('bucks_alliance_systems');
Schema::dropIfExists('bucks_ratting_daily_pool');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//Do nothing since we are only removing tables
}
}

View File

@@ -13,7 +13,54 @@ class AddForeignKeysToExistingMigrations extends Migration
*/
public function up()
{
Schema::table('user_alts', function(Blueprint $table) {
$table->foreign('main_id')
->references('character_id')
->on('users')
->cascadeOnDelete();
});
Schema::table('user_roles', function(Blueprint $table) {
$table->foreign('character_id')
->references('character_id')
->on('users')
->cascadeOnDelete();
});
Schema::table('EsiScopes', function(Blueprint $table) {
$table->foreign('character_id')
->references('character_id')
->on('EsiTokens')
->cascadeOnDelete();
});
Schema::table('user_permissions', function(Blueprint $table) {
$table->foreign('character_id')
->references('character_id')
->on('users')
->cascadeOnDelete();
});
Schema::table('supply_chain_bids', function(Blueprint $table) {
$table->foreign('contract_id')
->references('contract_id')
->on('supply_chain_contracts')
->cascadeOnDelete();
});
Schema::table('alliance_mining_tax_ledgers', function(Blueprint $table) {
$table->foreign('observer_id')
->references('observer_id')
->on('alliance_mining_tax_observers')
->cascadeOnDelete();
});
Schema::table('alliance_mining_tax_payments', function(Blueprint $table) {
$table->foreign('invoice_id')
->references('invoice_id')
->on('alliance_mining_tax_invoices')
->cascadeOnDelete();
});
}
/**