fix
This commit is contained in:
@@ -11,6 +11,10 @@
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
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) {
|
Schema::table('music', function (Blueprint $table) {
|
||||||
$table->integer('duration')->nullable()->change();
|
$table->integer('duration')->nullable()->change();
|
||||||
});
|
});
|
||||||
@@ -21,6 +25,9 @@ public function up(): void
|
|||||||
*/
|
*/
|
||||||
public function down(): 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) {
|
Schema::table('music', function (Blueprint $table) {
|
||||||
$table->string('duration')->nullable()->change();
|
$table->string('duration')->nullable()->change();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user