@@ -14,12 +14,16 @@ class UpdateColumnsToTextType extends Migration
1414 public function up ()
1515 {
1616 Schema::table ('users ' , function (Blueprint $ table ) {
17- $ table ->text ('littlelink_description ' )->change ();
17+ $ table ->text ('littlelink_description ' )->nullable ()-> change ();
1818 });
19-
19+
2020 Schema::table ('links ' , function (Blueprint $ table ) {
21- $ table ->text ('title ' )->change ();
21+ $ table ->text ('title ' )->nullable ()-> change ();
2222 });
23+
24+ // Set the new character limit to 1000 for both columns
25+ DB ::statement ('ALTER TABLE users MODIFY COLUMN littlelink_description TEXT(1000) ' );
26+ DB ::statement ('ALTER TABLE links MODIFY COLUMN title TEXT(1000) ' );
2327 }
2428
2529 /**
@@ -30,11 +34,15 @@ public function up()
3034 public function down ()
3135 {
3236 Schema::table ('users ' , function (Blueprint $ table ) {
33- $ table ->string ('littlelink_description ' , 255 )->change ();
37+ $ table ->string ('littlelink_description ' , 255 )->nullable ()-> change ();
3438 });
3539
3640 Schema::table ('links ' , function (Blueprint $ table ) {
37- $ table ->string ('title ' , 255 )->change ();
41+ $ table ->string ('title ' , 255 )->nullable ()-> change ();
3842 });
43+
44+ // Revert the character limit to 255 for both columns
45+ DB ::statement ('ALTER TABLE users MODIFY COLUMN littlelink_description VARCHAR(255) ' );
46+ DB ::statement ('ALTER TABLE links MODIFY COLUMN title VARCHAR(255) ' );
3947 }
4048}
0 commit comments