This commit is contained in:
2026-05-24 23:25:36 +03:30
parent 5800f64f88
commit 74e42d5fb4
@@ -11,6 +11,10 @@
*/
public function up(): void
{
// For PostgreSQL, we need to use a raw statement with USING clause
DB::statement('ALTER TABLE music ALTER COLUMN duration TYPE integer USING (duration::integer)');
// Then make it nullable if needed
Schema::table('music', function (Blueprint $table) {
$table->integer('duration')->nullable()->change();
});
@@ -21,8 +25,11 @@ public function up(): void
*/
public function down(): void
{
// Convert back to string/text
DB::statement('ALTER TABLE music ALTER COLUMN duration TYPE text USING (duration::text)');
Schema::table('music', function (Blueprint $table) {
$table->string('duration')->nullable()->change();
});
}
};
};