本文整理汇总了PHP中Phinx\Db\Table\Column类的典型用法代码示例。如果您正苦于以下问题:PHP Column类的具体用法?PHP Column怎么用?PHP Column使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Column类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: up
/**
* Migrate up
*/
public function up()
{
$table = $this->table('settings');
$table->addColumn('scope', 'string', ['limit' => 255, 'null' => true])->addColumn('field', 'string', ['limit' => 255, 'null' => true])->addColumn('value', 'text', ['null' => true])->addColumn('serialized', 'boolean', ['null' => false, 'default' => 0])->addColumn('created', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])->addColumn('modified', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
}
示例2: up
/**
* Migrate up
*/
public function up()
{
$table = $this->table('blog_categories')->addColumn('name', 'string', ['limit' => 255, 'null' => false])->addColumn('description', 'text', ['null' => true, 'default' => null])->addColumn('slug', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('meta_description', 'text', ['null' => true, 'default' => null])->addColumn('post_count', 'integer', ['limit' => 11, 'signed' => false, 'null' => false, 'default' => 0])->addColumn('created', 'datetime', ['default' => '0000-00-00 00:00', 'null' => false])->addColumn('modified', 'datetime', ['default' => '0000-00-00 00:00', 'null' => false]);
$table->addIndex('name', ['name' => 'BY_NAME', 'unique' => false]);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
}
示例3: up
/**
* Migrate up
*/
public function up()
{
$table = $this->table('blog_blog_authors')->addColumn('name', 'string', ['limit' => 255, 'null' => false])->addColumn('description_single_post', 'text', ['null' => true, 'default' => null])->addColumn('description_author_page', 'text', ['null' => true, 'default' => null])->addColumn('slug', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('is_default_author', 'integer', ['default' => 0, 'null' => false])->addColumn('meta_description', 'text', ['null' => true, 'default' => null])->addColumn('user_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('website', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('created', 'datetime', ['default' => '0000-00-00 00:00', 'null' => false])->addColumn('modified', 'datetime', ['default' => '0000-00-00 00:00', 'null' => false]);
$table->addIndex('name', ['name' => 'BY_NAME', 'unique' => false])->addIndex('user_id', ['name' => 'FK_USER_ID', 'unique' => false]);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
}
示例4: up
/**
* Migrate up
*/
public function up()
{
$table = $this->table('blog_posts_tags')->addColumn('post_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('tag_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false]);
$table->addIndex('post_id', ['name' => 'FK_POST_ID', 'unique' => false])->addIndex('tag_id', ['name' => 'FK_TAG_ID', 'unique' => false]);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
}
示例5: up
/**
* Migrate up
*/
public function up()
{
$table = $this->table('cms_collections');
$table->addColumn('page_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('type', 'string', ['limit' => 255, 'null' => false])->addColumn('identifier', 'string', ['limit' => 255, 'null' => false])->addColumn('model', 'string', ['limit' => 255, 'null' => false])->addColumn('created', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])->addColumn('modified', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']);
$table->addIndex('page_id', ['name' => 'FK_PAGE_ID'])->addIndex('type', ['name' => 'BY_TYPE'])->addIndex('identifier', ['name' => 'BY_IDENTIFIER']);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
}
示例6: up
/**
* Migrate up
*/
public function up()
{
$table = $this->table('routes');
$table->addColumn('url', 'text', ['default' => null, 'null' => false])->addColumn('model', 'string', ['length' => 255, 'default' => null, 'null' => false])->addColumn('foreign_key', 'integer', ['length' => 11, 'signed' => false, 'default' => null, 'null' => false])->addColumn('language_id', 'integer', ['length' => 11, 'signed' => false, 'default' => null, 'null' => false])->addColumn('page_type', 'string', ['length' => 255, 'default' => 'simple', 'null' => false])->addColumn('redirect_to', 'integer', ['length' => 11, 'signed' => false, 'default' => null, 'null' => true])->addColumn('status_code', 'integer', ['length' => 11, 'signed' => false, 'default' => null, 'null' => true])->addColumn('created', 'datetime', ['default' => null, 'null' => false])->addColumn('modified', 'datetime', ['default' => null, 'null' => false]);
$table->addIndex(['model', 'foreign_key', 'language_id'], ['name' => 'BY_MODEL_FOREIGN_KEY_LANG_ID', 'unique' => false])->addIndex('redirect_to', ['name' => 'BY_REDIRECT_TO', 'unique' => false]);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
}
示例7: up
/**
* Migrate up
*/
public function up()
{
$table = $this->table('tokens');
$table->addColumn('user_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('token', 'string', ['limit' => 32, 'null' => false])->addColumn('token_type', 'string', ['limit' => 50, 'null' => false])->addColumn('used', 'boolean', ['default' => 0, 'null' => false])->addColumn('created', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])->addColumn('expires', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']);
$table->addIndex('user_id', ['name' => 'FK_USER_ID', 'unique' => false])->addIndex('token', ['name' => 'BY_TOKEN', 'unique' => true]);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
}
示例8: up
/**
* Migrate up.
*/
public function up()
{
$table = $this->table('cms_contents');
$table->addColumn('page_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('language_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('content', 'text', ['limit' => 255])->addColumn('created_by_user_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('modified_by_user_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('created', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])->addColumn('modified', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']);
$table->addIndex('page_id', ['name' => 'BY_PAGE_ID'])->addIndex('language_id', ['name' => 'BY_LANGUAGE_ID'])->addIndex(['page_id', 'language_id'], ['name' => ['BY_PAGE_ID_AND_LANGUAGE_ID']])->addIndex('created_by_user_id', ['name' => 'BY_CREATED_BY_USER_ID'])->addIndex('modified_by_user_id', ['name' => 'BY_MODIFIED_BY_USER_ID']);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
}
示例9: up
/**
* Migration up
*/
public function up()
{
$table = $this->table('group_permissions');
$table->addColumn('group_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('path', 'string', ['limit' => 255, 'null' => false])->addColumn('plugin', 'string', ['limit' => 255, 'null' => false])->addColumn('controller', 'string', ['limit' => 255, 'null' => false])->addColumn('action', 'string', ['limit' => 255, 'null' => false])->addColumn('allowed', 'boolean', ['null' => false, 'default' => 0])->addColumn('created', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])->addColumn('modified', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']);
$table->addIndex('group_id', ['name' => 'FK_GROUP_ID', 'unique' => false]);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
}
示例10: up
/**
* Migrate up
*/
public function up()
{
$table = $this->table('cms_attributes');
$table->addColumn('model', 'string', ['limit' => 255, 'null' => false])->addColumn('foreign_key', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('language_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('name', 'string', ['limit' => 255, 'null' => false])->addColumn('content', 'text', ['null' => true, 'default' => null])->addColumn('created', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])->addColumn('modified', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']);
$table->addIndex('model', ['name' => 'BY_MODEL', 'unique' => false])->addIndex('foreign_key', ['name' => 'BY_FOREIGN_KEY', 'unique' => false])->addIndex('language_id', ['name' => 'FK_LANGUAGE_ID', 'unique' => false]);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
}
示例11: up
/**
* Migrate up
*/
public function up()
{
$table = $this->table('menus');
$table->addColumn('name', 'string', ['limit' => 255, 'null' => false])->addColumn('menu_item_count', 'integer', ['default' => 0, 'null' => false])->addColumn('created', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])->addColumn('modified', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']);
$table->addIndex('name', ['name' => 'BY_NAME', 'unique' => false]);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
}
示例12: up
/**
* Migrate up
*/
public function up()
{
$table = $this->table('blog_posts');
$table->addColumn('category_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('blog_author_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('name', 'string', ['limit' => 255, 'null' => false])->addColumn('slug', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('short', 'text', ['null' => true, 'default' => null])->addColumn('content', 'text', ['null' => true, 'default' => null])->addColumn('more_information', 'text', ['null' => true, 'default' => null])->addColumn('comments', 'integer', ['default' => 0, 'null' => false])->addColumn('comments_closed', 'integer', ['default' => 0, 'null' => false])->addColumn('comments_count', 'integer', ['default' => 0, 'null' => false])->addColumn('is_online', 'integer', ['default' => 0, 'null' => false])->addColumn('is_outdated', 'integer', ['default' => 0, 'null' => false])->addColumn('outdated_text', 'text', ['null' => true, 'default' => null])->addColumn('published_on', 'datetime', ['default' => '0000-00-00 00:00', 'null' => false])->addColumn('meta_description', 'text', ['null' => true, 'default' => null])->addColumn('created', 'datetime', ['default' => '0000-00-00 00:00', 'null' => false])->addColumn('modified', 'datetime', ['default' => '0000-00-00 00:00', 'null' => false]);
$table->addIndex('category_id', ['name' => 'FK_CATEGORY_ID', 'unique' => false])->addIndex('blog_author_id', ['name' => 'FK_BLOG_AUTHOR_ID', 'unique' => false]);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
}
示例13: up
/**
* Migrate up
*/
public function up()
{
$table = $this->table('cms_menu_items');
$table->addColumn('menu_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('parent_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => true, 'default' => null])->addColumn('lft', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('rght', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('name', 'string', ['limit' => 255, 'null' => false])->addColumn('type', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('target', 'text', ['null' => true, 'default' => null])->addColumn('external_link', 'text', ['null' => true, 'default' => null])->addColumn('foreign_model', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('foreign_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => true, 'default' => null])->addColumn('plugin', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('controller', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('action', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('params', 'text', ['null' => true, 'default' => null])->addColumn('query', 'text', ['null' => true, 'default' => null])->addColumn('created', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])->addColumn('modified', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']);
$table->addIndex('menu_id', ['name' => 'FK_MENU_ID', 'unique' => false]);
$table->addIndex('parent_id', ['name' => 'FK_PARENT_ID', 'unique' => false]);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
}
示例14: up
/**
* Migrate up
*/
public function up()
{
$table = $this->table('groups');
$table->addColumn('name', 'string', ['limit' => 255, 'null' => false])->addColumn('user_count', 'integer', ['limit' => 11, 'signed' => false, 'null' => false, 'default' => 0])->addColumn('created', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])->addColumn('modified', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']);
$table->addIndex('name', ['name' => 'BY_NAME', 'unique' => true]);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
$group = new Group(['name' => 'Super Admin']);
$Groups = TableRegistry::get('Wasabi/Core.Groups');
$Groups->save($group);
}
示例15: up
/**
* Migrate up
*/
public function up()
{
$table = $this->table('users');
$table->addColumn('group_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('username', 'string', ['limit' => 255, 'null' => false])->addColumn('password', 'string', ['limit' => 60, 'null' => false])->addColumn('email', 'string', ['limit' => 255, 'null' => false])->addColumn('verified', 'boolean', ['default' => 0, 'null' => false])->addColumn('active', 'boolean', ['default' => 0, 'null' => false])->addColumn('created', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])->addColumn('modified', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']);
$table->addIndex('username', ['name' => 'BY_USERNAME', 'unique' => true])->addIndex('group_id', ['name' => 'FK_GROUP_ID', 'unique' => false])->addIndex('email', ['name' => 'BY_EMAIL', 'unique' => true])->addIndex('active', ['name' => 'BY_ACTIVE', 'unique' => false]);
$table->create();
$id = new Column();
$id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
$table->changeColumn('id', $id)->save();
$user = new User(['username' => 'admin', 'group_id' => 1, 'email' => 'example@example.com', 'password' => 'admin', 'verified' => 1, 'active' => 1]);
$Users = TableRegistry::get('Wasabi/Core.Users');
$Users->save($user);
}