-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change ID type on form_submissions to be a float (#287)
* Change ID type on form_submissions to be a float * Support L10 * Fix up tests * Need dbal 3.5+ for changing tables * Does this fix tests? * Hmm * Update the `down` migration --------- Co-authored-by: Duncan McClean <[email protected]>
- Loading branch information
1 parent
d454e92
commit dc7851c
Showing
8 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
database/migrations/2024_05_15_100000_modify_form_submissions_id.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
use Statamic\Eloquent\Database\BaseMigration as Migration; | ||
|
||
return new class extends Migration | ||
{ | ||
public function up() | ||
{ | ||
Schema::table($this->prefix('form_submissions'), function (Blueprint $table) { | ||
$table->float('id', 10, 4)->index()->unique()->change(); | ||
}); | ||
} | ||
|
||
public function down() | ||
{ | ||
Schema::table($this->prefix('form_submissions'), function (Blueprint $table) { | ||
$table->dropUnique('form_submissions_id_unique'); | ||
$table->string('id')->unique()->change(); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Statamic\Eloquent\Updates; | ||
|
||
use Statamic\UpdateScripts\UpdateScript; | ||
|
||
class ChangeFormSubmissionsIdType extends UpdateScript | ||
{ | ||
public function shouldUpdate($newVersion, $oldVersion) | ||
{ | ||
return $this->isUpdatingTo('4.1.0'); | ||
} | ||
|
||
public function update() | ||
{ | ||
$source = __DIR__.'/../../database/migrations/2024_05_15_100000_modify_form_submissions_id.php'; | ||
$dest = database_path('migrations/2024_05_15_100000_modify_form_submissions_id.php'); | ||
|
||
$this->files->copy($source, $dest); | ||
|
||
$this->console()->info('Migration created'); | ||
$this->console()->comment('Remember to run `php artisan migrate` to apply it to your database.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters