Topic on Talk:Requests for comment/Abstract table definitions

Mattflaschen (talkcontribs)

Are there any similar existing tools out there? I realize there may be nothing that fits well. However, since this would be a major change regardless, it's worth looking into.

Doctrine has a database abstraction layer that can do schema changes. We may be able to use that even if we don't use other parts of Doctrine.

This post was posted by Mattflaschen, but signed as Superm401.

Dantman (talkcontribs)

Actually even if we don't use Doctrine (I'm not sure how Doctrine's DB coverage compares to our edge cases) that brings up an alternate idea. If someone didn't want to build a DSL or use arrays (which have so much syntax overhead it becomes hard to read the database information) writing the database layout in PHP would be an alternate idea.

Individual PHP based migrations as (classes?) in different files like Ruby's ActiveRecord's migrations which iirc some of the python SQL abstractions do too.

<?php
namespace MediaWiki\DatabaseMigrations;

class DummyMigration extends DatabaseMigration {
  public function up() {
    $foo = $this->table('foo', 'f');
    $foo->addColumn( 'extra', 'bytes' )
      ->after( 'data' );
    $foo->changeColumn( 'ts', 'time', 'timestamp' )
      ->nullable( true );
  }
}
Mattflaschen (talkcontribs)
Saper (talkcontribs)

I didn't know about this thread and I have started a new discussion about trying Doctrine's database abstraction layer on Discourse.

Reply to "Existing tools"