HomeMusing Studio

Refactor DB migrations types to be less MySQL-specific
37a1b9d33676Unpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.
This commit no longer exists in the repository. It may have been part of a branch which was deleted.This commit has been deleted in the repository: it is no longer reachable from any branch, tag, or ref.

Description

Refactor DB migrations types to be less MySQL-specific

Notes on these changes:

  • Column types are now interfaces, rather than enums, to allow type-specific customisation
  • The size and default value for a column has now been included as part of the type interfaces, to avoid cases that make very little sense (like DATETIME(1))
  • The smallint and int types have been merged into a single integer type, which can also emit tinyint, mediumint, and bigint for MySQL
  • The "current timestamp" default value is now part of a datetime column type, instead of being a weird hack on top of the column
  • The SQLBuilder interface is now in its own module, since it being specifically in the create module was misleading

The existing migrations which use these types have been modified to accomodate the refactor, which also helps serve as examples for the existing types.

The primary purpose of this refactor is to better accomodate additional database dialects, namely PostgreSQL.

Details

Provenance
ltdk <usr@ltdk.xyz>Authored on May 11 2022, 7:05 PM

Event Timeline

Commit No Longer Exists

This commit no longer exists in the repository.