【问题标题】:PhalconPHP create tables dynamicallyPhalconPHP 动态创建表
【发布时间】:2014-01-14 19:44:40
【问题描述】:

使用 PhalconPHP,是否可以使用带有 cmets 元数据的 ORM 模型在数据库中创建表?例如,使用交响乐可以达到我想要的效果:http://symfony.com/doc/current/book/doctrine.html

【问题讨论】:

    标签: php database orm phalcon


    【解决方案1】:

    所以我找到的解决方案是这样的

    $connection->createTable("robots", null, array(
          "columns" => array(
                new Column("id", array(
                    "type"  => Column::TYPE_INTEGER,
                    "size"  => 10,
                    "notNull"       => true,
                    "autoIncrement" => true,
                )),
                new Column("name", array(
                    "type"    => Column::TYPE_VARCHAR,
                    "size"    => 70,
                    "notNull" => true,
                )),
                new Column("year", array(
                    "type"    => Column::TYPE_INTEGER,
                    "size"    => 11,
                    "notNull" => true,
                ))
          ),
          "indexes" => array(
                new Index("PRIMARY", array("id"))
          )
    ));
    

    希望对某人有所帮助:)

    【讨论】:

      猜你喜欢
      • 2012-05-03
      • 2018-08-12
      • 1970-01-01
      • 2017-02-25
      • 2016-08-20
      • 2016-10-14
      • 2017-01-31
      • 2011-12-03
      相关资源
      最近更新 更多