Sentinel Migrations

This contains important information regarding migrations.

Migration Errors

NB these migrations should only been run on MEDIDEV

This is an important step, the current DB_USER on mediuk is not as powerful as a user with QSECOFR, migrations will fail with a resource 904 error, to overcome this change the active env file DB_USERNAME and DB_PASSWORD and re-run the migration.

When running migrations on production always for this with care

To run a migration

php artisan module:migrate Settings

to revert the migration

php artisan module:migrate-rollback Settings

Writing Migrations

In line with general Laravel Migration creation and Taylor Ortwel we do not create a down action to prevent tables being erased in error. Also we should check if a table exists and example ois below.

 /**
     * Run the migrations.
     */
    public function up(): void
    {
        if (!Schema::hasTable(Priority::TABLE)) {
            Schema::create(Priority::TABLE, function (Blueprint $table) {
                $table->id();
                $table->integer('is_default')->default(0);
                $table->integer('is_protected')->default(0);
                $table->integer('sort_order')->default(0);
                $table->string('title')->nullable();
                $table->string('slug')->nullable();
                $table->text('description')->nullable();
                $table->char('uuid', 36)->nullable();
                $table->timestamp('deleted_at')->nullable();
                $table->timestamps();
            });
        }
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
    }

One should never run migrations on production, any tables are to be created using IBM Utilities. *** and Never run the commands php artisan migrate, php artisan migrate-rollback or php artisan db:wipe.