本文整理汇总了PHP中Doctrine\DBAL\Schema\Schema::getTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Schema::getTable方法的具体用法?PHP Schema::getTable怎么用?PHP Schema::getTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\Schema
的用法示例。
在下文中一共展示了Schema::getTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addOwner
/**
* Adds owner_id field
*
* @param Schema $schema
*/
public static function addOwner(Schema $schema)
{
$table = $schema->getTable('orocrm_contactus_request');
$table->addColumn('owner_id', 'integer', ['notnull' => false]);
$table->addIndex(['owner_id'], 'IDX_342872E87E3C61F9', []);
$table->addForeignKeyConstraint($schema->getTable('oro_organization'), ['owner_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
}
示例2: addOroActivityOwnerForeignKeys
/**
* Add oro_activity_owner foreign keys.
*
* @param Schema $schema
*/
protected static function addOroActivityOwnerForeignKeys(Schema $schema)
{
$table = $schema->getTable('oro_activity_owner');
$table->addForeignKeyConstraint($schema->getTable('oro_user'), ['user_id'], ['id'], ['onDelete' => null, 'onUpdate' => null]);
$table->addForeignKeyConstraint($schema->getTable('oro_organization'), ['organization_id'], ['id'], ['onDelete' => null, 'onUpdate' => null]);
$table->addForeignKeyConstraint($schema->getTable('oro_activity_list'), ['activity_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
}
示例3: addOrganization
/**
* Adds organization_id field
*
* @param Schema $schema
*/
public static function addOrganization(Schema $schema)
{
$table = $schema->getTable('oro_calendar');
$table->addColumn('organization_id', 'integer', ['notnull' => false]);
$table->addIndex(['organization_id'], 'IDX_1D1715132C8A3DE', []);
$table->addForeignKeyConstraint($schema->getTable('oro_organization'), ['organization_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
}
示例4: addOwnerFields
/**
* @param Schema $schema
*/
public static function addOwnerFields(Schema $schema)
{
$table = $schema->getTable('test_activity');
$table->addColumn('owner_id', 'integer', ['notnull' => false]);
$table->addIndex(['owner_id']);
$table->addForeignKeyConstraint($schema->getTable('oro_user'), ['owner_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
}
示例5: changePrimaryKeyType
/**
* @param Schema $schema
* @param QueryBag $queries
* @param string $tableName
* @param string $columnName
* @param string $type
*
* @throws \Exception
*/
public function changePrimaryKeyType(Schema $schema, QueryBag $queries, $tableName, $columnName, $type)
{
$targetColumn = $schema->getTable($tableName)->getColumn($columnName);
$type = Type::getType($type);
if ($targetColumn->getType() === $type) {
return;
}
/** @var ForeignKeyConstraint[] $foreignKeys */
$foreignKeys = [];
foreach ($schema->getTables() as $table) {
/** @var ForeignKeyConstraint[] $tableForeignKeys */
$tableForeignKeys = array_filter($table->getForeignKeys(), function (ForeignKeyConstraint $tableForeignKey) use($tableName, $columnName) {
if ($tableForeignKey->getForeignTableName() !== $tableName) {
return false;
}
return $tableForeignKey->getForeignColumns() === [$columnName];
});
foreach ($tableForeignKeys as $tableForeignKey) {
$foreignKeys[$tableForeignKey->getName()] = $tableForeignKey;
$foreignKeyTableName = $tableForeignKey->getLocalTable()->getName();
$foreignKeyColumnNames = $tableForeignKey->getLocalColumns();
$queries->addPreQuery($this->platform->getDropForeignKeySQL($tableForeignKey, $foreignKeyTableName));
$column = $schema->getTable($foreignKeyTableName)->getColumn(reset($foreignKeyColumnNames));
if ($column instanceof ExtendColumn) {
$column->disableExtendOptions()->setType($type)->enableExtendOptions();
} else {
$column->setType($type);
}
}
}
$targetColumn->setType($type);
foreach ($foreignKeys as $foreignKey) {
$queries->addPostQuery($this->platform->getCreateForeignKeySQL($foreignKey, $foreignKey->getLocalTable()));
}
}
示例6: up
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
$table = $schema->getTable('oro_reminder');
$table->addColumn('sender_id', 'integer', ['notnull' => false]);
$table->addIndex(['sender_id'], 'idx_2f4f9f57f624b39d', []);
$table->addForeignKeyConstraint($schema->getTable('oro_user'), ['sender_id'], ['id'], ['onUpdate' => null, 'onDelete' => 'SET NULL']);
}
示例7: down
public function down(Schema $schema)
{
// remove website creationmode and ismarkedfordeletion column
$schema->getTable('website')->dropColumn('share');
$schema->getTable('website')->dropColumn('creationmode');
$schema->getTable('website')->dropColumn('ismarkedfordeletion');
}
示例8: up
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
$table = $schema->getTable('orocrm_magento_cart');
$table->getColumn('items_qty')->setType(Type::getType('float'));
$table = $schema->getTable('orocrm_magento_order_items');
$table->getColumn('qty')->setType(Type::getType('float'));
}
示例9: up
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
/** Generate table orocrm_case_comment **/
$table = $schema->createTable('orocrm_case_comment');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
$table->addColumn('case_id', 'integer', ['notnull' => false]);
$table->addColumn('updated_by_id', 'integer', ['notnull' => false]);
$table->addColumn('owner_id', 'integer', ['notnull' => false]);
$table->addColumn('contact_id', 'integer', ['notnull' => false]);
$table->addColumn('message', 'text', []);
$table->addColumn('public', 'boolean', ['default' => '0']);
$table->addColumn('createdAt', 'datetime', []);
$table->addColumn('updatedAt', 'datetime', ['notnull' => false]);
$table->setPrimaryKey(['id']);
$table->addIndex(['case_id'], 'IDX_604C70FBCF10D4F5', []);
$table->addIndex(['contact_id'], 'IDX_604C70FBE7A1254A', []);
$table->addIndex(['updated_by_id'], 'FK_604C70FB896DBBDE', []);
$table->addIndex(['owner_id'], 'IDX_604C70FB7E3C61F9', []);
/** End of generate table orocrm_case_comment **/
/** Generate foreign keys for table orocrm_case_comment **/
$table = $schema->getTable('orocrm_case_comment');
$table->addForeignKeyConstraint($schema->getTable('orocrm_case'), ['case_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => null]);
$table->addForeignKeyConstraint($schema->getTable('oro_user'), ['updated_by_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
$table->addForeignKeyConstraint($schema->getTable('oro_user'), ['owner_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
$table->addForeignKeyConstraint($schema->getTable('orocrm_contact'), ['contact_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
/** End of generate foreign keys for table orocrm_case_comment **/
}
示例10: down
public function down(Schema $schema)
{
//start cc_show_instances modifications
$show_instances_table = $schema->getTable('cc_show_instances');
$show_instances_table->dropColumn('record');
$show_instances_table->dropColumn('rebroadcast');
$show_instances_table->dropColumn('instance_id');
$show_instances_table->dropColumn('file_id');
$show_instances_table->dropColumn('soundcloud_id');
//end cc_show_instances modifications
//start cc_show_days modifications
$show_days_table = $schema->getTable('cc_show_days');
$show_days_table->dropColumn('record');
//end cc_show_days modifications
//start cc_show modifications
$show_table = $schema->getTable('cc_show');
$show_table->dropColumn('url');
//end cc_show modifications
//start cc_schedule modifications
$schedule_table = $schema->getTable('cc_schedule');
$playlist_id_col = $schedule_table->getColumn('playlist_id');
$playlist_id_col->setNotnull(true);
//end cc_schedule modifications
//drop cc_show_rebroadcast table
$schema->dropTable('cc_show_rebroadcast');
//end drop cc_show_rebroadcast table
}
示例11: addOwnerToAttachment
public static function addOwnerToAttachment(Schema $schema)
{
$table = $schema->getTable('oro_attachment');
$table->addColumn('owner_user_id', 'integer', ['notnull' => false]);
$table->addIndex(['owner_user_id'], 'IDX_FA0FE0812B18554A', []);
$table->addForeignKeyConstraint($schema->getTable('oro_user'), ['owner_user_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
}
示例12: modifyOrocrmMagentoCartTable
/**
* @param Schema $schema
*/
protected function modifyOrocrmMagentoCartTable(Schema $schema)
{
$table = $schema->getTable('orocrm_magento_cart');
$table->addColumn('data_channel_id', 'integer', ['notnull' => false]);
$table->addIndex(['data_channel_id'], 'IDX_96661A80BDC09B73', []);
$table->addForeignKeyConstraint($schema->getTable('orocrm_channel'), ['data_channel_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null], 'FK_96661A80BDC09B73');
}
示例13: modifyOrocrmSalesSalesFunnelTable
/**
* @param Schema $schema
*/
protected function modifyOrocrmSalesSalesFunnelTable(Schema $schema)
{
$table = $schema->getTable('orocrm_sales_funnel');
$table->addColumn('data_channel_id', 'integer', ['notnull' => false]);
$table->addIndex(['data_channel_id'], 'IDX_E20C7344BDC09B73', []);
$table->addForeignKeyConstraint($schema->getTable('orocrm_channel'), ['data_channel_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null], 'FK_E20C7344BDC09B73');
}
示例14: up
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
// dtb_category
$t_dtb_category = $schema->getTable(self::DTB_CATEGORY);
if ($t_dtb_category->hasColumn('category_name')) {
$t_dtb_category->changeColumn('category_name', array('NotNull' => true));
}
if ($t_dtb_category->hasColumn('rank')) {
$t_dtb_category->changeColumn('rank', array('NotNull' => true));
}
// dtb_class_category
$t_dtb_class_category = $schema->getTable(self::DTB_CLASS_CATEGORY);
if ($t_dtb_class_category->hasColumn('name')) {
$t_dtb_class_category->changeColumn('name', array('NotNull' => true));
}
if ($t_dtb_class_category->hasColumn('rank')) {
$t_dtb_class_category->changeColumn('rank', array('NotNull' => true));
}
// dtb_class_name
$t_dtb_class_name = $schema->getTable(self::DTB_CLASS_NAME);
if ($t_dtb_class_name->hasColumn('name')) {
$t_dtb_class_name->changeColumn('name', array('NotNull' => true));
}
if ($t_dtb_class_name->hasColumn('rank')) {
$t_dtb_class_name->changeColumn('rank', array('NotNull' => true));
}
}
示例15: addOroActivityListForeignKeys
/**
* Add oro_activity_list foreign keys.
*
* @param Schema $schema
*/
protected function addOroActivityListForeignKeys(Schema $schema)
{
$table = $schema->getTable('oro_activity_list');
$table->addForeignKeyConstraint($schema->getTable('oro_user'), ['user_owner_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
$table->addForeignKeyConstraint($schema->getTable('oro_user'), ['user_editor_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
$table->addForeignKeyConstraint($schema->getTable('oro_organization'), ['organization_id'], ['id'], ['onDelete' => 'SET NULL', 'onUpdate' => null]);
}