Skip to content

[Feature Request]: Make all migrations that modify schema deterministic #1191

@dmohns

Description

@dmohns

Preflight Checklist

Problem Description

Currently, some of our migrations that modify schema are non-deterministic. I.e. they have different results depending on the environment they are run in.

Two examples of that are

  • Using config object to create tables in Laravel Permissions
  • Using if (Schema::connection('tenant')->hasTable(....))

This has various downsides. For example it prevents ever changing the value of config that is used in the migration. Also, can produce inconsistencies when migrations are silently not running or running twice.

Proposed Solution

Please change all migration that modify schema to be deterministic. I.e. have a reproducible output.

  • Remove all if (Schema::connection('tenant')->hasTable(....)) constructs
  • Hardcode any values that are currently read from config.

Alternatives Considered

N/A

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions