mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Fix tests and fix migrations to always explicitly include nullable()
This commit is contained in:
parent
7b930357e4
commit
7e1295bac7
|
@ -12,8 +12,8 @@ class AddSoftDeletedToLog extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
//$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
//$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
|
||||
Schema::table('asset_logs', function ($table) {
|
||||
$table->string('asset_type', 100)->nullable()->change();
|
||||
|
|
|
@ -14,7 +14,7 @@ class ChangeLicenseNotesType extends Migration
|
|||
{
|
||||
//
|
||||
Schema::table('licenses', function ($table) {
|
||||
$table->text('notes')->change();
|
||||
$table->text('notes')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class MigrateMacAddress extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
|
||||
//DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
|
||||
|
||||
$f2 = new \App\Models\CustomFieldset(['name' => 'Asset with MAC Address']);
|
||||
$f2->timestamps = false; //when this model was first created, it had no timestamps. But later on it gets them.
|
||||
|
|
|
@ -13,7 +13,7 @@ class UpdateLdapFilterToLongerField extends Migration
|
|||
public function up()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->text('ldap_filter')->default(null)->change();
|
||||
$table->text('ldap_filter')->nullable()->default(null)->change();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ class MakePurchaseCostNullable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
//$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
//$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
|
||||
Schema::table('assets', function ($table) {
|
||||
$table->decimal('purchase_cost', 8, 2)->nullable()->default(null)->change();
|
||||
|
|
|
@ -12,8 +12,8 @@ class IncreasePurchaseCostSize extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
//$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
//$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
|
||||
Schema::table('assets', function ($table) {
|
||||
$table->decimal('purchase_cost', 20, 2)->nullable()->default(null)->change();
|
||||
|
@ -47,8 +47,8 @@ class IncreasePurchaseCostSize extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
//$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
//$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
|
||||
Schema::table('assets', function ($table) {
|
||||
$table->decimal('purchase_cost', 8, 2)->nullable()->default(null)->change();
|
||||
|
|
|
@ -43,8 +43,8 @@ class FixUtf8CustomFieldColumnNames extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
//$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
//$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
|
||||
if (! Schema::hasColumn('custom_fields', 'db_column')) {
|
||||
Schema::table('custom_fields', function ($table) {
|
||||
|
|
|
@ -13,11 +13,11 @@ class SetAssetArchivedToZeroDefault extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
//$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
//$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
|
||||
Schema::table('assets', function (Blueprint $table) {
|
||||
$table->boolean('archived')->default(0)->change();
|
||||
$table->boolean('archived')->default(0)->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ class MakeSerialNullable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
//$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
//$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
|
||||
Schema::table('assets', function (Blueprint $table) {
|
||||
$table->string('serial')->nullable()->default(null)->change();
|
||||
|
|
|
@ -29,7 +29,7 @@ class PassportUpgrade extends Migration
|
|||
{
|
||||
if (Schema::hasTable('oauth_clients')) {
|
||||
Schema::table('oauth_clients', function (Blueprint $table) {
|
||||
$table->string('secret', 100)->change();
|
||||
$table->string('secret', 100)->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class ChangeWebhookSettingsVariableType extends Migration
|
|||
public function up()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->text('webhook_endpoint')->change();
|
||||
$table->text('webhook_endpoint')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ class ChangeWebhookSettingsVariableType extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->string('webhook_endpoint')->change();
|
||||
$table->string('webhook_endpoint')->nullable()->change();
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ return new class extends Migration {
|
|||
*/
|
||||
if (Schema::hasTable('report_templates') && Schema::hasColumn('report_templates', 'options')) {
|
||||
Schema::table('report_templates', function (Blueprint $table) {
|
||||
$table->text('options')->change();
|
||||
$table->text('options')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ return new class extends Migration
|
|||
]);
|
||||
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->string('label2_2d_type')->default('QRCODE')->change();
|
||||
$table->string('label2_1d_type')->default('C128')->change();
|
||||
$table->string('label2_2d_type')->default('QRCODE')->nullable(false)->change();
|
||||
$table->string('label2_1d_type')->default('C128')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ use Tests\TestCase;
|
|||
|
||||
class ShowSetUpPageTest extends TestCase
|
||||
{
|
||||
|
||||
static ?TestResponse $latestResponse;
|
||||
/**
|
||||
* We do not want to make actual http request on every test to check .env file
|
||||
* visibility because that can be really slow especially in some cases where an
|
||||
|
@ -34,7 +36,8 @@ class ShowSetUpPageTest extends TestCase
|
|||
Http::fake([URL::to('.env') => Http::response(null, 404)]);
|
||||
}
|
||||
|
||||
return $this->get('/setup');
|
||||
self::$latestResponse = $this->get('/setup');
|
||||
return self::$latestResponse;
|
||||
}
|
||||
|
||||
public function testView(): void
|
||||
|
|
Loading…
Reference in a new issue