ajout app

This commit is contained in:
2024-04-17 20:22:30 +02:00
parent cc017cfc5e
commit f9d05a2fd3
8025 changed files with 729805 additions and 0 deletions

View File

View File

@ -0,0 +1,64 @@
<?php
/**
* Part of the Sentry package.
*
* NOTICE OF LICENSE
*
* Licensed under the 3-clause BSD License.
*
* This source file is subject to the 3-clause BSD License that is
* bundled with this package in the LICENSE file. It is also available at
* the following URL: http://www.opensource.org/licenses/BSD-3-Clause
*
* @version 2.0.0
* @author Cartalyst LLC
* @license BSD License (3-clause)
* @copyright (c) 2011 - 2013, Cartalyst LLC
* @link http://cartalyst.com
*/
use Illuminate\Database\Migrations\Migration;
class MigrationCartalystSentryInstallUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function ($table) {
$table->increments('id');
$table->string('email');
$table->string('password');
$table->text('permissions')->nullable();
$table->boolean('activated')->default(0);
$table->string('activation_code')->nullable();
$table->timestamp('activated_at')->nullable();
$table->timestamp('last_login')->nullable();
$table->string('persist_code')->nullable();
$table->string('reset_password_code')->nullable();
$table->string('first_name')->nullable();
$table->string('last_name')->nullable();
$table->timestamps();
// We'll need to ensure that MySQL uses the InnoDB engine to
// support the indexes, other engines aren't affected.
$table->engine = 'InnoDB';
$table->unique('email');
$table->index('activation_code');
$table->index('reset_password_code');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}

View File

@ -0,0 +1,51 @@
<?php
/**
* Part of the Sentry package.
*
* NOTICE OF LICENSE
*
* Licensed under the 3-clause BSD License.
*
* This source file is subject to the 3-clause BSD License that is
* bundled with this package in the LICENSE file. It is also available at
* the following URL: http://www.opensource.org/licenses/BSD-3-Clause
*
* @version 2.0.0
* @author Cartalyst LLC
* @license BSD License (3-clause)
* @copyright (c) 2011 - 2013, Cartalyst LLC
* @link http://cartalyst.com
*/
use Illuminate\Database\Migrations\Migration;
class MigrationCartalystSentryInstallGroups extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('permission_groups', function ($table) {
$table->increments('id');
$table->string('name');
$table->text('permissions')->nullable();
$table->timestamps();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// See 2014_11_04_231416_update_group_field_for_reporting.php and 2019_06_12_184327_rename_groups_table.php
Schema::dropIfExists('permission_groups');
Schema::dropIfExists('groups');
}
}

View File

@ -0,0 +1,51 @@
<?php
/**
* Part of the Sentry package.
*
* NOTICE OF LICENSE
*
* Licensed under the 3-clause BSD License.
*
* This source file is subject to the 3-clause BSD License that is
* bundled with this package in the LICENSE file. It is also available at
* the following URL: http://www.opensource.org/licenses/BSD-3-Clause
*
* @version 2.0.0
* @author Cartalyst LLC
* @license BSD License (3-clause)
* @copyright (c) 2011 - 2013, Cartalyst LLC
* @link http://cartalyst.com
*/
use Illuminate\Database\Migrations\Migration;
class MigrationCartalystSentryInstallUsersGroupsPivot extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users_groups', function ($table) {
$table->integer('user_id')->unsigned();
$table->integer('group_id')->unsigned();
// We'll need to ensure that MySQL uses the InnoDB engine to
// support the indexes, other engines aren't affected.
$table->engine = 'InnoDB';
$table->primary(['user_id', 'group_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users_groups');
}
}

View File

@ -0,0 +1,58 @@
<?php
/**
* Part of the Sentry package.
*
* NOTICE OF LICENSE
*
* Licensed under the 3-clause BSD License.
*
* This source file is subject to the 3-clause BSD License that is
* bundled with this package in the LICENSE file. It is also available at
* the following URL: http://www.opensource.org/licenses/BSD-3-Clause
*
* @version 2.0.0
* @author Cartalyst LLC
* @license BSD License (3-clause)
* @copyright (c) 2011 - 2013, Cartalyst LLC
* @link http://cartalyst.com
*/
use Illuminate\Database\Migrations\Migration;
class MigrationCartalystSentryInstallThrottle extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('throttle', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->nullable();
$table->string('ip_address')->nullable();
$table->integer('attempts')->default(0);
$table->boolean('suspended')->default(0);
$table->boolean('banned')->default(0);
$table->timestamp('last_attempt_at')->nullable();
$table->timestamp('suspended_at')->nullable();
$table->timestamp('banned_at')->nullable();
// We'll need to ensure that MySQL uses the InnoDB engine to
// support the indexes, other engines aren't affected.
$table->engine = 'InnoDB';
$table->index('user_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('throttle');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
class UpdateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Update the users table
Schema::table('users', function ($table) {
$table->softDeletes();
$table->string('website')->nullable();
$table->string('country')->nullable();
$table->string('gravatar')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// Update the users table
Schema::table('users', function ($table) {
$table->dropColumn('deleted_at', 'website', 'country', 'gravatar');
});
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateModelsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('models', function ($table) {
$table->increments('id');
$table->string('name');
$table->string('modelno')->nullable();
$table->integer('manufacturer_id')->nullable();
$table->integer('category_id')->nullable();
$table->timestamps();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('models');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateCategoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('categories', function ($table) {
$table->increments('id');
$table->string('name');
$table->integer('parent')->default(0);
$table->timestamps();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('categories');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateManufacturersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('manufacturers', function ($table) {
$table->increments('id');
$table->string('name');
$table->timestamps();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('manufacturers');
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddUserIdToCategories extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('categories', function ($table) {
$table->integer('user_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddUserIdToManufacturers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('manufacturers', function ($table) {
$table->integer('user_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateAssetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('assets', function ($table) {
$table->increments('id');
$table->string('name')->nullable();
$table->string('asset_tag')->nullable();
$table->integer('model_id')->nullable();
$table->string('serial')->nullable();
$table->date('purchase_date')->nullable();
$table->decimal('purchase_cost', 8, 2)->nullable();
$table->string('order_number')->nullable();
$table->integer('assigned_to')->nullable();
$table->text('notes')->nullable();
$table->integer('user_id')->nullable();
$table->timestamps();
$table->boolean('physical')->default(1);
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('assets');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateTempLicensesTable extends Migration
{
/**
* Run the migrations.
*
* This migration is overwritten by a later migration - 2013_11_25_recreate_licenses_table.php
*
* @return void
*/
public function up()
{
//
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// Schema::dropIfExists('licenses');
}
}

View File

@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddLicenseNameToLicenses extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateDepreciationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('depreciations', function ($table) {
$table->increments('id');
$table->string('name');
$table->integer('months');
$table->timestamps();
$table->integer('user_id')->nullable();
$table->engine = 'InnoDB';
//$table->foreign('user_id')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('depreciations');
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddDepreciationIdToModels extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('models', function ($table) {
$table->integer('depreciation_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddUserIdToModels extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('models', function ($table) {
$table->integer('user_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateLocationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('locations', function ($table) {
$table->increments('id');
$table->string('name')->nullable();
$table->string('city')->nullable();
$table->string('state', 2)->nullable();
$table->string('country', 2)->nullable();
$table->timestamps();
$table->integer('user_id')->nullable();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('locations');
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddLocationIdToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->integer('location_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddCheckedoutToToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->integer('checkedout_to')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateHistoryTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Schema::create('history', function ($table) {
// $table->increments('id');
// $table->integer('checkedout_to')->nullable;
// $table->integer('location_id')->nullable;
// $table->timestamps();
// $table->integer('user_id')->nullable();
// $table->engine = 'InnoDB';
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//Schema::drop('history');
}
}

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
class DropLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('licenses');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddPhysicalToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('assets', function ($table) {
//$table->boolean('physical')->default(1);
$table->dropColumn('checkedout_to');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// $table->dropColumn('physical');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::create('settings', function ($table) {
$table->increments('id');
$table->string('option_name');
$table->string('option_value');
$table->timestamps();
$table->integer('user_id')->nullable();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('settings');
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddLicenseToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Schema::table('assets', function ($table) {
// $table->string('license_name')->nullable();
// $table->string('license_email')->nullable();
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddContactsToUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function ($table) {
$table->integer('location_id')->nullable();
$table->string('phone')->nullable();
$table->string('jobtitle')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function ($table) {
$table->dropColumn('location_id');
$table->dropColumn('phone');
$table->dropColumn('jobtitle');
});
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddInfoToLocations extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('locations', function ($table) {
$table->string('address', 80)->nullable();
$table->string('address2', 80)->nullable();
$table->string('zip', 10)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('locations', function ($table) {
$table->dropColumn('address');
$table->dropColumn('address2');
$table->dropColumn('zip');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class RemoveLocationIdFromAsset extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->dropColumn('location_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function ($table) {
$table->integer('location_id')->nullable();
});
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
class SetNullvaluesForUser extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// $prefix = DB::getTablePrefix();
// DB::statement('ALTER TABLE '.$prefix.'users MODIFY phone varchar(20) null');
// DB::statement('ALTER TABLE '.$prefix.'users MODIFY jobtitle varchar(50) null');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateAssetLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('asset_logs', function ($table) {
$table->increments('id');
$table->integer('user_id')->nullable();
$table->string('action_type');
$table->integer('asset_id');
$table->integer('checkedout_to')->nullable();
$table->integer('location_id')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('asset_logs');
}
}

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
class EditAddedOnAssetLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'asset_logs MODIFY added_on timestamp null');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class EditLocationIdAssetLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Schema::table('asset_logs', function ($table) {
// $table->string('location_id')->nullable()->change();
// $table->dateTime('added_on',11)->nullable()->default(DB::raw('CURRENT_TIMESTAMP(0)'))->change();
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddSoftDeleteOnAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddSoftDeleteOnLocations extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('locations', function ($table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddSoftDeleteOnManufacturers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('manufacturers', function ($table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddSoftDeleteOnCategories extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('categories', function ($table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateStatusLabels extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('status_labels', function ($table) {
$table->increments('id');
$table->string('name', 100)->nullable();
$table->integer('user_id')->nullable();
$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('status_labels');
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddStatusIdOnAssetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->integer('status_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function ($table) {
$table->dropColumn('status_id');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddStatusTypeOnStatusLabels extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('status_labels', function ($table) {
$table->boolean('deployable')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('status_labels', function ($table) {
$table->dropColumn('deployable');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddArchivedToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->boolean('archived')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function ($table) {
$table->dropColumn('archived');
});
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddUploadsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('asset_uploads', function ($table) {
$table->increments('id');
$table->integer('user_id')->nullable();
$table->string('filename');
$table->integer('asset_id');
$table->string('filenotes')->nullable();
$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('asset_uploads');
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class RemoveDeployableBooleanFromStatusLabels extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('status_labels', function ($table) {
$table->dropColumn('deployable');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('status_labels', function ($table) {
$table->boolean('deployable');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddOptionLabelToSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Schema::table('settings', function ($table) {
// // $table->string('option_label','80')->nullable();
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// Schema::table('settings', function ($table) {
// $table->dropColumn('option_label');
// });
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
class EditsToSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function ($table) {
// $table->dropColumn('option_label');
//$table->dropColumn('option_name');
// $table->dropColumn('option_value');
$table->integer('per_page')->default(20);
$table->string('site_name', '100')->default('Snipe IT Asset Management');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
class ReCreateLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasTable('licenses')) {
Schema::create('licenses', function ($table) {
$table->increments('id');
$table->string('name');
$table->string('serial');
$table->date('purchase_date')->nullable();
$table->decimal('purchase_cost', 8, 2)->nullable();
$table->string('order_number');
$table->integer('seats');
$table->text('notes');
$table->integer('user_id')->nullable();
$table->integer('depreciation_id');
$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// This was most likely handled in 2013_11_17_054359_drop_licenses_table.php
Schema::dropIfExists('licenses');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateLicenseSeatsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::create('license_seats', function ($table) {
$table->increments('id');
$table->integer('license_id')->nullable();
$table->integer('assigned_to')->nullable();
$table->text('notes')->nullable();
$table->integer('user_id')->nullable();
$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('license_seats');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddTypeToActionlogTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('asset_logs', function ($table) {
$table->string('asset_type')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('asset_logs', function ($table) {
$table->dropColumn('asset_type');
});
}
}

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
class DeleteBadLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::drop('licenses');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateNewLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::create('licenses', function ($table) {
$table->increments('id');
$table->string('name')->nullable();
$table->string('serial')->nullable();
$table->date('purchase_date')->nullable();
$table->decimal('purchase_cost', 8, 2)->nullable();
$table->string('order_number');
$table->integer('seats')->default(1);
$table->text('notes')->nullable();
$table->integer('user_id')->nullable();
$table->integer('depreciation_id')->nullable();
$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::drop('licenses');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddLicensedToLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('licenses', function ($table) {
$table->string('license_name')->nullable();
$table->string('license_email')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('licenses', function ($table) {
$table->dropColumn('license_name');
$table->dropColumn('license_email');
});
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddWarranteeToAssetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('assets', function ($table) {
$table->integer('warrantee_months')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('assets', function ($table) {
$table->dropColumn('warrantee_months');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AlterWarrantyColumnOnAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->renameColumn('warrantee_months', 'warranty_months');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function ($table) {
$table->renameColumn('warranty_months', 'warrantee_months');
});
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
class DropParentFromCategories extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('categories', function ($table) {
$table->dropColumn('parent');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddDepreciateToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('assets', function ($table) {
$table->boolean('depreciate')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function ($table) {
$table->dropColumn('depreciate');
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddDepreciateToLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('licenses', function ($table) {
$table->boolean('depreciate')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('licenses', function ($table) {
$table->dropColumn('depreciate');
});
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
class DropLicenseFromAssetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Schema::table('assets', function ($table) {
// $table->dropColumn('license_name');
// $table->dropColumn('license_email');
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddNoteToAssetLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('asset_logs', function ($table) {
$table->text('note')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('asset_logs', function ($table) {
$table->dropColumn('note');
});
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddFilenameToAssetLog extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('asset_logs', function ($table) {
$table->text('filename')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('asset_logs', function ($table) {
$table->dropColumn('filename');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddNullableToLicensesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('licenses', function ($table) {
$table->string('order_number', 50)->nullable()->change();
$table->string('notes', 255)->nullable()->change();
$table->string('license_name', 120)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddEolOnModelsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('models', function ($table) {
$table->integer('eol')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('models', function ($table) {
$table->dropColumn('eol');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddManagerToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function ($table) {
$table->integer('manager_id')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function ($table) {
$table->dropColumn('manager_id');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddQrCodeToSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function ($table) {
$table->integer('qr_code')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function ($table) {
$table->dropColumn('qr_code');
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddQrTextToSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->string('qr_text', 32)->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function (Blueprint $table) {
$table->dropColumn('qr_text');
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlterDefaultLicenseDepreciationId extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// Schema::table('licenses', function ($table) {
// $table->integer('depreciation_id')->nullable();
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlterDefaultValuesLicenses extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'license_seats MODIFY column notes text NULL');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddAssetNameToSettings extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function ($table) {
$table->integer('display_asset_name')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function ($table) {
$table->dropColumn('display_asset_name');
});
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class MakeAssetLogCheckedoutToNullable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'asset_logs MODIFY column checkedout_to int(11) NULL');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class MakeAssetLogPurchasedateToNullable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'licenses MODIFY column purchase_date date NULL');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddSuppliers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('suppliers', function ($table) {
$table->increments('id');
$table->string('name');
$table->string('address', 50)->nullable()->default(null);
$table->string('address2', 50)->nullable()->default(null);
$table->string('city')->nullable()->default(null);
$table->string('state', 2)->nullable()->default(null);
$table->string('country', 2)->nullable()->default(null);
$table->string('phone', 20)->nullable()->default(null);
$table->string('fax', 20)->nullable()->default(null);
$table->string('email', 150)->nullable()->default(null);
$table->string('contact', 100)->nullable()->default(null);
$table->string('notes')->nullable()->default(null);
$table->timestamps();
$table->integer('user_id')->nullable();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::drop('suppliers');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddSupplierIdToAsset extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->integer('supplier_id')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function ($table) {
$table->dropColumn('supplier_id');
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddZipToSupplier extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('suppliers', function ($table) {
$table->string('zip', 10)->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('suppliers', function ($table) {
$table->dropColumn('zip');
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddUrlToSupplier extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('suppliers', function ($table) {
$table->string('url', 250)->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('suppliers', function ($table) {
$table->dropColumn('url');
});
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddEmployeeIdToUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('users', function ($table) {
$table->text('employee_num', '50')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('users', function ($table) {
$table->dropColumn('employee_num');
});
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddRequestableToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('assets', function ($table) {
$table->tinyInteger('requestable')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('assets', function ($table) {
$table->dropColumn('requestable');
});
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddAssetToSoftware extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('license_seats', function ($table) {
$table->integer('asset_id')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('license_seats', function ($table) {
$table->dropColumn('asset_id');
});
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class MakeAssetIdInLogsNullable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'asset_logs MODIFY column asset_id int NULL');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,75 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class Alpha042Release extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$prefix = DB::getTablePrefix();
Schema::table('assets', function (Blueprint $table) {
//
});
// DB::statement('UPDATE '.$prefix.'assets SET status_id="0" where status_id is null');
// DB::statement('UPDATE '.$prefix.'assets SET purchase_cost=0 where purchase_cost is null');
// DB::statement('UPDATE '.$prefix.'models SET eol=0 where eol is null');
// DB::statement('UPDATE '.$prefix.'users SET location_id=0 where location_id is null');
// DB::statement('UPDATE '.$prefix.'assets SET asset_tag=" " WHERE asset_tag is null');
// DB::statement('UPDATE '.$prefix.'locations SET state=" " where state is null');
// DB::statement('UPDATE '.$prefix.'models SET manufacturer_id="0" where manufacturer_id is null');
// DB::statement('UPDATE '.$prefix.'models SET category_id="0" where category_id is null');
// DB::statement('ALTER TABLE '.$prefix.'assets '
// . 'MODIFY COLUMN name VARCHAR(255) NULL , '
// . 'MODIFY COLUMN asset_tag VARCHAR(255) NOT NULL , '
// . 'MODIFY COLUMN purchase_cost DECIMAL(13,4) NOT NULL DEFAULT "0" , '
// . 'MODIFY COLUMN order_number VARCHAR(255) NULL , '
// . 'MODIFY COLUMN assigned_to INT(11) NULL , '
// . 'MODIFY COLUMN notes TEXT NULL , '
// . 'MODIFY COLUMN archived TINYINT(1) NOT NULL DEFAULT "0" , '
// . 'MODIFY COLUMN depreciate TINYINT(1) NOT NULL DEFAULT "0"');
//
// DB::statement('ALTER TABLE '.$prefix.'licenses '
// . 'MODIFY COLUMN purchase_cost DECIMAL(13,4) NULL , '
// . 'MODIFY COLUMN depreciate TINYINT(1) NULL DEFAULT "0"');
//
// DB::statement('ALTER TABLE '.$prefix.'license_seats '
// . 'MODIFY COLUMN assigned_to INT(11) NULL ');
//
// DB::statement('ALTER TABLE '.$prefix.'locations '
// . 'MODIFY COLUMN state VARCHAR(255) NOT NULL ,'
// . 'MODIFY COLUMN address2 VARCHAR(255) NULL ,'
// . 'MODIFY COLUMN zip VARCHAR(10) NULL ');
//
// DB::statement('ALTER TABLE '.$prefix.'models '
// . 'MODIFY COLUMN modelno VARCHAR(255) NULL , '
// . 'MODIFY COLUMN manufacturer_id INT(11) NOT NULL , '
// . 'MODIFY COLUMN category_id INT(11) NOT NULL , '
// . 'MODIFY COLUMN depreciation_id INT(11) NOT NULL DEFAULT "0" , '
// . 'MODIFY COLUMN eol INT(11) NULL DEFAULT "0"');
//
// DB::statement('ALTER TABLE '.$prefix.'users '
// . 'MODIFY COLUMN first_name VARCHAR(255) NOT NULL , '
// . 'MODIFY COLUMN last_name VARCHAR(255) NOT NULL , '
// . 'MODIFY COLUMN location_id INT(11) NOT NULL');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function (Blueprint $table) {
//
});
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class MakeLocationIdNullable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'users MODIFY column location_id int NULL');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddRtdLocationToAssets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('assets', function ($table) {
$table->integer('rtd_location_id')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('assets', function ($table) {
$table->dropColumn('rtd_location_id');
});
}
}

View File

@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlterSupplierStateTo32 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'suppliers MODIFY column state varchar(32) null');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'suppliers MODIFY column state varchar(2) null');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddDisplayCheckoutDate extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function ($table) {
$table->integer('display_checkout_date')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function ($table) {
$table->dropColumn('display_checkout_date');
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddAvatarFieldToUsersTable extends Migration
{
/**
* Make changes to the table.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('avatar')->nullable();
});
}
/**
* Revert the changes to the table.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('avatar');
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddImageFieldToModelsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('models', function (Blueprint $table) {
$table->string('image')->nullable();
});
}
/**
* Revert the changes to the table.
*
* @return void
*/
public function down()
{
Schema::table('models', function (Blueprint $table) {
$table->dropColumn('image');
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddEolDisplayToSettings extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function ($table) {
$table->integer('display_eol')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function ($table) {
$table->dropColumn('display_eol');
});
}
}

View File

@ -0,0 +1,41 @@
<?php
use App\Models\Group;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class UpdateGroupFieldForReporting extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// This is janky because we had to do a back in time change to handle a MySQL 8+
// compatibility issue.
// Ideally we'd be using the model here, but since we can't really know whether this is an upgrade
// or a fresh install, we have to check which table is being used.
if (Schema::hasTable('permission_groups')) {
Group::where('id', 1)->update(['permissions' => '{"users-foo":1,"reports":1}']);
Group::where('id', 2)->update(['permissions' => '{"users-foo":1,"reports":1}']);
} elseif (Schema::hasTable('groups')) {
DB::update('update '.DB::getTablePrefix().'groups set permissions = ? where id = ?', ['{"admin-foo":1,"users":1,"reports":1}', 1]);
DB::update('update '.DB::getTablePrefix().'groups set permissions = ? where id = ?', ['{"users-foo":1,"reports":1}', 2]);
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddFieldsToLicenses extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('licenses', function ($table) {
$table->integer('supplier_id')->nullable()->default(null);
$table->date('expiration_date')->nullable();
$table->string('purchase_order')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('licenses', function ($table) {
$table->dropColumn('supplier_id');
$table->dropColumn('expiration_date');
$table->dropColumn('purchase_order');
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddImageToSupplier extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('suppliers', function (Blueprint $table) {
$table->string('image')->nullable();
});
}
/**
* Revert the changes to the table.
*
* @return void
*/
public function down()
{
Schema::table('suppliers', function (Blueprint $table) {
$table->dropColumn('image');
});
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddUsernameToUser extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('users', function (Blueprint $table) {
$table->string('username')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('username');
});
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddAutoToSettings extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('settings', function (Blueprint $table) {
$table->integer('auto_increment_assets')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('settings', function (Blueprint $table) {
$table->dropColumn('auto_increment_assets');
});
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddPrefixToSettings extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('settings', function (Blueprint $table) {
$table->string('auto_increment_prefix')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('settings', function (Blueprint $table) {
$table->dropColumn('auto_increment_prefix');
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class ChangeLicenceType extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// $prefix = DB::getTablePrefix();
// DB::statement('ALTER TABLE '.$prefix.'licenses MODIFY COLUMN serial TEXT');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
// $prefix = DB::getTablePrefix();
// DB::statement('ALTER TABLE '.$prefix.'licenses MODIFY COLUMN serial VARCHAR(255)');
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddFieldsMaintainedTermToLicenses extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('licenses', function ($table) {
$table->date('termination_date')->nullable();
$table->boolean('maintained')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('licenses', function ($table) {
$table->dropColumn('termination_date');
$table->dropColumn('maintained');
});
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class IncreaseUserFieldLengths extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'users MODIFY column jobtitle varchar(100) null');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'users MODIFY column jobtitle varchar(50) null');
}
}

View File

@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddSoftDeletedToLog extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string');
Schema::table('asset_logs', function ($table) {
$table->string('asset_type', 100)->nullable()->change();
});
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'asset_logs MODIFY column asset_type varchar(100) null');
// DB::statement('ALTER TABLE ' . DB::getTablePrefix() . 'asset_logs MODIFY column added_on timestamp default "0000-00-00 00:00:00"');
// Schema::table('asset_logs', function ($table) {
// $table->renameColumn('added_on', 'created_at');
// $table->timestamp('updated_at');
// $table->softDeletes();
// });
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// Schema::table('asset_logs', function ($table) {
// $table->renameColumn('created_at', 'added_on');
// $table->dropColumn('updated_at');
// $table->dropSoftDeletes();
// });
}
}

View File

@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class FixBadAssignedToIds extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
DB::update('update '.DB::getTablePrefix().'assets SET assigned_to=NULL where assigned_to=0');
Schema::table('status_labels', function ($table) {
$table->boolean('deployable')->default(0);
$table->boolean('pending')->default(0);
$table->boolean('archived')->default(0);
$table->text('notes')->nullable();
});
DB::table('status_labels')->insert([
['user_id' => 1, 'name' => 'Pending', 'deployable' => 0, 'pending' => 1, 'archived' => 0, 'notes' => 'These assets are not yet ready to be deployed, usually because of configuration or waiting on parts.'],
['user_id' => 1, 'name' => 'Ready to Deploy', 'deployable' => 1, 'pending' => 0, 'archived' => 0, 'notes' => 'These assets are ready to deploy.'],
['user_id' => 1, 'name' => 'Archived', 'deployable' => 0, 'pending' => 0, 'archived' => 1, 'notes' => 'These assets are no longer in circulation or viable.'],
]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('status_labels', function ($table) {
$table->dropColumn('deployable');
$table->dropColumn('pending');
$table->dropColumn('archived');
$table->dropColumn('notes');
});
}
}

View File

@ -0,0 +1,51 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class MigrateDataToNewStatuses extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// get newly added statuses from last migration
$statuses = DB::table('status_labels')->where('name', 'Pending')->orWhere('name', 'Ready to Deploy')->get();
foreach ($statuses as $status) {
if ($status->name == 'Pending') {
$pending_id = [$status->id];
} elseif ($status->name == 'Ready to Deploy') {
$rtd_id = [$status->id];
}
}
// Pending
$pendings = DB::table('assets')->where('status_id', null)->where('physical', '1')->get();
foreach ($pendings as $pending) {
DB::update('update '.DB::getTablePrefix().'assets set status_id = ? where status_id IS NULL AND physical=1', $pending_id);
}
// Ready to Deploy
$rtds = DB::table('assets')->where('status_id', 0)->where('physical', '1')->get();
foreach ($rtds as $rtd) {
//DB::update('update users set votes = 100 where name = ?', array('John'));
DB::update('update '.DB::getTablePrefix().'assets set status_id = ? where status_id = 0 AND physical=1', $rtd_id);
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class MigrateMakeLicenseAssignedNull extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
DB::update('update '.DB::getTablePrefix().'license_seats SET assigned_to=NULL where assigned_to=0');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class MigrateCreateRequestsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::create('requests', function ($table) {
$table->increments('id');
$table->integer('asset_id');
$table->integer('user_id')->nullable();
$table->text('request_code');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::drop('requests');
}
}

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddMacAddressToAsset extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('assets', function ($table) {
$table->string('mac_address')->nullable()->default(null);
});
Schema::table('models', function ($table) {
$table->boolean('show_mac_address')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('assets', function ($table) {
$table->dropColumn('mac_address');
});
Schema::table('models', function ($table) {
$table->dropColumn('show_mac_address');
});
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class ChangeLicenseNotesType extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('licenses', function ($table) {
$table->text('notes')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

Some files were not shown because too many files have changed in this diff Show More