@@ -14,12 +14,16 @@ class UpdateColumnsToTextType extends Migration
14
14
public function up ()
15
15
{
16
16
Schema::table ('users ' , function (Blueprint $ table ) {
17
- $ table ->text ('littlelink_description ' )->change ();
17
+ $ table ->text ('littlelink_description ' )->nullable ()-> change ();
18
18
});
19
-
19
+
20
20
Schema::table ('links ' , function (Blueprint $ table ) {
21
- $ table ->text ('title ' )->change ();
21
+ $ table ->text ('title ' )->nullable ()-> change ();
22
22
});
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) ' );
23
27
}
24
28
25
29
/**
@@ -30,11 +34,15 @@ public function up()
30
34
public function down ()
31
35
{
32
36
Schema::table ('users ' , function (Blueprint $ table ) {
33
- $ table ->string ('littlelink_description ' , 255 )->change ();
37
+ $ table ->string ('littlelink_description ' , 255 )->nullable ()-> change ();
34
38
});
35
39
36
40
Schema::table ('links ' , function (Blueprint $ table ) {
37
- $ table ->string ('title ' , 255 )->change ();
41
+ $ table ->string ('title ' , 255 )->nullable ()-> change ();
38
42
});
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) ' );
39
47
}
40
48
}
0 commit comments