From 80f9159f4dc41d43a38404c27701a9370b436ee8 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Mon, 6 Jan 2025 14:29:18 -0800 Subject: [PATCH] Change options to text type --- ...3_232739_create_report_templates_table.php | 14 ++++++- ...templates_options_to_column_text_field.php | 39 +++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2025_01_06_210534_change_report_templates_options_to_column_text_field.php diff --git a/database/migrations/2023_08_23_232739_create_report_templates_table.php b/database/migrations/2023_08_23_232739_create_report_templates_table.php index d9438f2cc8..296e140662 100644 --- a/database/migrations/2023_08_23_232739_create_report_templates_table.php +++ b/database/migrations/2023_08_23_232739_create_report_templates_table.php @@ -17,7 +17,19 @@ class CreateReportTemplatesTable extends Migration $table->id(); $table->integer('created_by')->nullable(); $table->string('name'); - $table->json('options'); + + /* + * The "options" column was originally json but this causes issues + * with older versions of mariadb so it was changed text. + * + * A follow-up migration definitively changes it to a text column + * for the systems that had successfully run the migration: + * 2025_01_06_210534_change_report_templates_options_to_column_text_field. + * + * https://github.com/snipe/snipe-it/issues/16015 + */ + $table->text('options'); + $table->softDeletes(); $table->timestamps(); $table->index('created_by'); diff --git a/database/migrations/2025_01_06_210534_change_report_templates_options_to_column_text_field.php b/database/migrations/2025_01_06_210534_change_report_templates_options_to_column_text_field.php new file mode 100644 index 0000000000..8681db07da --- /dev/null +++ b/database/migrations/2025_01_06_210534_change_report_templates_options_to_column_text_field.php @@ -0,0 +1,39 @@ +text('options')->change(); + }); + } + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('report_templates', function (Blueprint $table) { + // Instead of attempting to roll this back to json let's just + // keep it as text since that works for mysql, mariadb, and sqlite. + }); + } +};