SB-MaterialAdmin / Web

SourceBans Material Design
64 stars 45 forks source link

Schema Manager #175

Open CrazyHackGUT opened 6 years ago

CrazyHackGUT commented 6 years ago

Schema Manager can help easily create, modify or drop tables. My vision for API:

$DB = \DatabaseManager::GetConnection('SourceBans');
$SM = $DB->getSchemaManager();

// 1st argument - table name
// 2st argument - use table prefix or not
// 3st argument - function
$SM->createTable('vac', true, function (Create $table) {
  $table->addColumn('account_id',  'integer')->unsigned()->primaryKey();
  $table->addColumn('status',      'bool')->setDefault(0);
  $table->addColumn('updated_on',  'integer')->unsigned()->setDefault(0);
});

This should be implemented before we start work on new installer and updater!