本文整理汇总了PHP中Schema::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Schema::get方法的具体用法?PHP Schema::get怎么用?PHP Schema::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schema
的用法示例。
在下文中一共展示了Schema::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(array $fields, $subs = null, $callback = null)
{
$this->fields = $fields;
$this->subs = $subs;
$this->callback = $callback;
$this->schema = Schema::get($this->className());
}
示例2: onCheckSchema
function onCheckSchema()
{
$schema = Schema::get();
$schema->ensureTable('grades', Grades::schemaDef());
$schema->ensureTable('grades_group', Gradesgroup::schemaDef());
return true;
}
示例3: onCheckSchema
/**
* Database schema setup
*
* @see Schema
* @see ColumnDef
*
* @return boolean hook value; true means continue processing, false means stop.
*/
function onCheckSchema()
{
$schema = Schema::get();
// For storing user-submitted flags on profiles
$schema->ensureTable('bookmark', array(new ColumnDef('id', 'char', 36, false, 'PRI'), new ColumnDef('profile_id', 'integer', null, false, 'MUL'), new ColumnDef('url', 'varchar', 255, false, 'MUL'), new ColumnDef('title', 'varchar', 255), new ColumnDef('description', 'text'), new ColumnDef('uri', 'varchar', 255, false, 'UNI'), new ColumnDef('created', 'datetime', null, false, 'MUL')));
return true;
}
示例4: onCheckSchema
/**
* Hook for ensuring our tables are created
*
* Ensures the fave_tally table is there and has the right columns
*
* @return boolean hook return
*/
function onCheckSchema()
{
$schema = Schema::get();
// For storing total number of times a notice has been faved
$schema->ensureTable('fave_tally', Fave_tally::schemaDef());
return true;
}
示例5: onCheckSchema
/**
* Database schema setup
*
* @see Schema
* @see ColumnDef
*
* @return boolean hook value; true means continue processing, false means stop.
*/
function onCheckSchema()
{
$schema = Schema::get();
$schema->ensureTable('spam_score', Spam_score::schemaDef());
Spam_score::upgrade();
return true;
}
示例6: onCheckSchema
function onCheckSchema()
{
$schema = Schema::get();
$schema->ensureTable('task', Task::schemaDef());
$schema->ensureTable('task_grader', Task_Grader::schemaDef());
return true;
}
示例7: beforeSchemaUpdate
public static function beforeSchemaUpdate()
{
$table = strtolower(get_called_class());
$schema = Schema::get();
$schemadef = $schema->getTableDef($table);
// 2015-12-31 RSVPs refer to Happening by event_uri now, not event_id. Let's migrate!
if (isset($schemadef['fields']['event_uri'])) {
// We seem to have already migrated, good!
return;
}
// this is a "normal" upgrade from StatusNet for example
echo "\nFound old {$table} table, upgrading it to add 'event_uri' field...";
$schemadef['fields']['event_uri'] = array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'Event URI');
$schema->ensureTable($table, $schemadef);
$rsvp = new RSVP();
$rsvp->find();
while ($rsvp->fetch()) {
$event = Happening::getKV('id', $rsvp->event_id);
if (!$event instanceof Happening) {
$rsvp->delete();
continue;
}
$orig = clone $rsvp;
$rsvp->event_uri = $event->uri;
$rsvp->updateWithKeys($orig);
}
print "DONE.\n";
print "Resuming core schema upgrade...";
}
示例8: onCheckSchema
/**
* Database schema setup
*
* We store user registrations in a table registration_ip.
*
* @return boolean hook value; true means continue processing, false means stop.
*/
public function onCheckSchema()
{
$schema = Schema::get();
// For storing user-submitted flags on profiles
$schema->ensureTable('registration_ip', Registration_ip::schemaDef());
return true;
}
示例9: onCheckSchema
/**
* Set up our tables (event and rsvp)
*
* @see Schema
* @see ColumnDef
*
* @return boolean hook value; true means continue processing, false means stop.
*/
function onCheckSchema()
{
$schema = Schema::get();
$schema->ensureTable('happening', Happening::schemaDef());
$schema->ensureTable('rsvp', RSVP::schemaDef());
return true;
}
示例10: onCheckSchema
/**
* Hook for ensuring our tables are created
*
* Ensures that the user_flag_profile table exists
* and has the right columns.
*
* @return boolean hook return
*/
function onCheckSchema()
{
$schema = Schema::get();
// For storing user-submitted flags on profiles
$schema->ensureTable('user_flag_profile', array(new ColumnDef('profile_id', 'integer', null, false, 'PRI'), new ColumnDef('user_id', 'integer', null, false, 'PRI'), new ColumnDef('created', 'datetime', null, false, 'MUL'), new ColumnDef('cleared', 'datetime', null, true, 'MUL')));
return true;
}
示例11: onCheckSchema
/**
* Database schema setup
*
* @return boolean hook value
*/
function onCheckSchema()
{
$schema = Schema::get();
// For storing user-submitted flags on profiles
$schema->ensureTable('email_summary_status', Email_summary_status::schemaDef());
return true;
}
示例12: onCheckSchema
/**
* Hook for ensuring our tables are created
*
* Ensures the fave_tally table is there and has the right columns
*
* @return boolean hook return
*/
function onCheckSchema()
{
$schema = Schema::get();
// For storing total number of times a notice has been faved
$schema->ensureTable('fave_tally', array(new ColumnDef('notice_id', 'integer', null, false, 'PRI'), new ColumnDef('count', 'integer', null, false), new ColumnDef('modified', 'timestamp', null, false, null, 'CURRENT_TIMESTAMP', 'on update CURRENT_TIMESTAMP')));
return true;
}
示例13: onCheckSchema
/**
* Database schema setup
*
* @return boolean hook value
*/
function onCheckSchema()
{
$schema = Schema::get();
// For storing user-submitted flags on profiles
$schema->ensureTable('email_summary_status', array(new ColumnDef('user_id', 'integer', null, false, 'PRI'), new ColumnDef('send_summary', 'tinyint', null, false, null, 1), new ColumnDef('last_summary_id', 'integer', null, true), new ColumnDef('created', 'datetime', null, false), new ColumnDef('modified', 'datetime', null, false)));
return true;
}
示例14: onCheckSchema
/**
* Database schema setup
*
* @see Schema
* @see ColumnDef
*
* @return boolean hook value; true means continue processing, false means stop.
*/
function onCheckSchema()
{
$schema = Schema::get();
$schema->ensureTable('poll', Poll::schemaDef());
$schema->ensureTable('poll_response', Poll_response::schemaDef());
return true;
}
示例15: onCheckSchema
/**
* Database schema setup
*
* We store user registrations in a table registration_ip.
*
* @return boolean hook value; true means continue processing, false means stop.
*/
function onCheckSchema()
{
$schema = Schema::get();
// For storing user-submitted flags on profiles
$schema->ensureTable('registration_ip', array(new ColumnDef('user_id', 'integer', null, false, 'PRI'), new ColumnDef('ipaddress', 'varchar', 15, false, 'MUL'), new ColumnDef('created', 'timestamp', null, false, 'MUL')));
return true;
}