From: Andrey Kutejko Date: Sat, 27 Jul 2013 17:58:29 +0000 (+0300) Subject: simplify column definition X-Git-Tag: 0.5~121 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=17ef15a1075913d2c90441672c3a68a27c7bb577;p=ipf.git simplify column definition --- diff --git a/ipf/admin/models/_generated/BaseAdminLog.php b/ipf/admin/models/_generated/BaseAdminLog.php index 264672f..b10e831 100644 --- a/ipf/admin/models/_generated/BaseAdminLog.php +++ b/ipf/admin/models/_generated/BaseAdminLog.php @@ -12,13 +12,13 @@ abstract class BaseAdminLog extends IPF_ORM_Record { $table = $this->getTable(); $table->setTableName('admin_log'); - $this->getTable()->setColumn('username', 'string', 32, array('type' => 'string', 'length' => '32')); - $this->getTable()->setColumn('user_id', 'integer', null, array('type' => 'integer')); - $this->getTable()->setColumn('object_id', 'integer', null, array('type' => 'integer')); - $this->getTable()->setColumn('object_class', 'string', 200, array('type' => 'string', 'length' => '200')); - $this->getTable()->setColumn('object_repr', 'string', 200, array('type' => 'string', 'length' => '200')); - $this->getTable()->setColumn('action_flag', 'integer', null, array('type' => 'integer')); - $this->getTable()->setColumn('change_message', 'string', 200, array('type' => 'string', 'length' => '200')); + $table->setColumn('username', 'string', 32, array('type' => 'string', 'length' => '32')); + $table->setColumn('user_id', 'integer', null, array('type' => 'integer')); + $table->setColumn('object_id', 'integer', null, array('type' => 'integer')); + $table->setColumn('object_class', 'string', 200, array('type' => 'string', 'length' => '200')); + $table->setColumn('object_repr', 'string', 200, array('type' => 'string', 'length' => '200')); + $table->setColumn('action_flag', 'integer', null, array('type' => 'integer')); + $table->setColumn('change_message', 'string', 200, array('type' => 'string', 'length' => '200')); $table->addIndex('idx_object_id', array('fields' => 'object_id')); $table->addIndex('idx_object_class', array('fields' => 'object_class')); $table->addIndex('idx_created_at', array('fields' => 'created_at')); diff --git a/ipf/auth/models/_generated/BasePermission.php b/ipf/auth/models/_generated/BasePermission.php index 832cdbf..50f1231 100644 --- a/ipf/auth/models/_generated/BasePermission.php +++ b/ipf/auth/models/_generated/BasePermission.php @@ -12,7 +12,7 @@ abstract class BasePermission extends IPF_ORM_Record { $table = $this->getTable(); $table->setTableName('auth_permission'); - $this->getTable()->setColumn('name', 'string', 255, array('unique' => true, 'type' => 'string', 'length' => '255')); + $table->setColumn('name', 'string', 255, array('unique' => true, 'type' => 'string', 'length' => '255')); $table->setOption('type', 'INNODB'); $table->setOption('collate', 'utf8_unicode_ci'); $table->setOption('charset', 'utf8'); diff --git a/ipf/auth/models/_generated/BaseRole.php b/ipf/auth/models/_generated/BaseRole.php index 79bc9fb..f600980 100644 --- a/ipf/auth/models/_generated/BaseRole.php +++ b/ipf/auth/models/_generated/BaseRole.php @@ -12,7 +12,7 @@ abstract class BaseRole extends IPF_ORM_Record { $table = $this->getTable(); $table->setTableName('auth_role'); - $this->getTable()->setColumn('name', 'string', 255, array('unique' => true, 'type' => 'string', 'notblank' => true, 'length' => '255')); + $table->setColumn('name', 'string', 255, array('unique' => true, 'type' => 'string', 'notblank' => true, 'length' => '255')); $table->setOption('type', 'INNODB'); $table->setOption('collate', 'utf8_unicode_ci'); $table->setOption('charset', 'utf8'); diff --git a/ipf/auth/models/_generated/BaseRolePermission.php b/ipf/auth/models/_generated/BaseRolePermission.php index 67b6eb7..85bc274 100644 --- a/ipf/auth/models/_generated/BaseRolePermission.php +++ b/ipf/auth/models/_generated/BaseRolePermission.php @@ -12,8 +12,8 @@ abstract class BaseRolePermission extends IPF_ORM_Record { $table = $this->getTable(); $table->setTableName('auth_role_permission'); - $this->getTable()->setColumn('role_id', 'integer', null, array('type' => 'integer', 'primary' => true)); - $this->getTable()->setColumn('permission_id', 'integer', null, array('type' => 'integer', 'primary' => true)); + $table->setColumn('role_id', 'integer', null, array('type' => 'integer', 'primary' => true)); + $table->setColumn('permission_id', 'integer', null, array('type' => 'integer', 'primary' => true)); $table->setOption('type', 'INNODB'); $table->setOption('collate', 'utf8_unicode_ci'); $table->setOption('charset', 'utf8'); diff --git a/ipf/auth/models/_generated/BaseUser.php b/ipf/auth/models/_generated/BaseUser.php index c11f08c..58fefed 100644 --- a/ipf/auth/models/_generated/BaseUser.php +++ b/ipf/auth/models/_generated/BaseUser.php @@ -12,15 +12,15 @@ abstract class BaseUser extends IPF_ORM_Record { $table = $this->getTable(); $table->setTableName('auth_user'); - $this->getTable()->setColumn('username', 'string', 32, array('type' => 'string', 'notblank' => true, 'notnull' => true, 'unique' => true, 'length' => '32')); - $this->getTable()->setColumn('password', 'string', 128, array('type' => 'string', 'notblank' => true, 'notnull' => true, 'length' => '128')); - $this->getTable()->setColumn('first_name', 'string', 32, array('type' => 'string', 'length' => '32')); - $this->getTable()->setColumn('last_name', 'string', 32, array('type' => 'string', 'length' => '32')); - $this->getTable()->setColumn('email', 'string', 200, array('type' => 'string', 'email' => true, 'notnull' => true, 'notblank' => true, 'unique' => true, 'length' => '200')); - $this->getTable()->setColumn('is_staff', 'boolean', null, array('type' => 'boolean', 'notnull' => true, 'default' => false)); - $this->getTable()->setColumn('is_active', 'boolean', null, array('type' => 'boolean', 'notnull' => true, 'default' => false)); - $this->getTable()->setColumn('is_superuser', 'boolean', null, array('type' => 'boolean', 'notnull' => true, 'default' => false)); - $this->getTable()->setColumn('last_login', 'timestamp', null, array('type' => 'timestamp')); + $table->setColumn('username', 'string', 32, array('type' => 'string', 'notblank' => true, 'notnull' => true, 'unique' => true, 'length' => '32')); + $table->setColumn('password', 'string', 128, array('type' => 'string', 'notblank' => true, 'notnull' => true, 'length' => '128')); + $table->setColumn('first_name', 'string', 32, array('type' => 'string', 'length' => '32')); + $table->setColumn('last_name', 'string', 32, array('type' => 'string', 'length' => '32')); + $table->setColumn('email', 'string', 200, array('type' => 'string', 'email' => true, 'notnull' => true, 'notblank' => true, 'unique' => true, 'length' => '200')); + $table->setColumn('is_staff', 'boolean', null, array('type' => 'boolean', 'notnull' => true, 'default' => false)); + $table->setColumn('is_active', 'boolean', null, array('type' => 'boolean', 'notnull' => true, 'default' => false)); + $table->setColumn('is_superuser', 'boolean', null, array('type' => 'boolean', 'notnull' => true, 'default' => false)); + $table->setColumn('last_login', 'timestamp', null, array('type' => 'timestamp')); $table->setOption('type', 'INNODB'); $table->setOption('collate', 'utf8_unicode_ci'); $table->setOption('charset', 'utf8'); diff --git a/ipf/auth/models/_generated/BaseUserPermission.php b/ipf/auth/models/_generated/BaseUserPermission.php index 827c84a..eee40b0 100644 --- a/ipf/auth/models/_generated/BaseUserPermission.php +++ b/ipf/auth/models/_generated/BaseUserPermission.php @@ -12,8 +12,8 @@ abstract class BaseUserPermission extends IPF_ORM_Record { $table = $this->getTable(); $table->setTableName('auth_user_permission'); - $this->getTable()->setColumn('user_id', 'integer', null, array('type' => 'integer', 'primary' => true)); - $this->getTable()->setColumn('permission_id', 'integer', null, array('type' => 'integer', 'primary' => true)); + $table->setColumn('user_id', 'integer', null, array('type' => 'integer', 'primary' => true)); + $table->setColumn('permission_id', 'integer', null, array('type' => 'integer', 'primary' => true)); $table->setOption('type', 'INNODB'); $table->setOption('collate', 'utf8_unicode_ci'); $table->setOption('charset', 'utf8'); diff --git a/ipf/auth/models/_generated/BaseUserRole.php b/ipf/auth/models/_generated/BaseUserRole.php index 5905cbb..7b5c82a 100644 --- a/ipf/auth/models/_generated/BaseUserRole.php +++ b/ipf/auth/models/_generated/BaseUserRole.php @@ -12,8 +12,8 @@ abstract class BaseUserRole extends IPF_ORM_Record { $table = $this->getTable(); $table->setTableName('auth_user_role'); - $this->getTable()->setColumn('user_id', 'integer', null, array('type' => 'integer', 'primary' => true)); - $this->getTable()->setColumn('role_id', 'integer', null, array('type' => 'integer', 'primary' => true)); + $table->setColumn('user_id', 'integer', null, array('type' => 'integer', 'primary' => true)); + $table->setColumn('role_id', 'integer', null, array('type' => 'integer', 'primary' => true)); $table->setOption('type', 'INNODB'); $table->setOption('collate', 'utf8_unicode_ci'); $table->setOption('charset', 'utf8'); diff --git a/ipf/orm/import/builder.php b/ipf/orm/import/builder.php index 3be0494..cf027a2 100644 --- a/ipf/orm/import/builder.php +++ b/ipf/orm/import/builder.php @@ -164,7 +164,7 @@ class IPF_ORM_Import_Builder $result = array(); foreach ($columns as $name => $column) { $columnName = isset($column['name']) ? $column['name']:$name; - $build = " ".'$this->getTable()->setColumn(\'' . $columnName . '\', \'' . $column['type'] . '\''; + $build = " ".'$table->setColumn(\'' . $columnName . '\', \'' . $column['type'] . '\''; if ($column['length']) { if (is_numeric($column['length'])) diff --git a/ipf/session/models/_generated/BaseSession.php b/ipf/session/models/_generated/BaseSession.php index 9498fa0..a03b6fe 100644 --- a/ipf/session/models/_generated/BaseSession.php +++ b/ipf/session/models/_generated/BaseSession.php @@ -12,9 +12,9 @@ abstract class BaseSession extends IPF_ORM_Record { $table = $this->getTable(); $table->setTableName('session'); - $this->getTable()->setColumn('session_key', 'string', 40, array('primary' => true, 'type' => 'string', 'length' => '40')); - $this->getTable()->setColumn('session_data', 'string', null, array('type' => 'string')); - $this->getTable()->setColumn('expire_data', 'timestamp', null, array('type' => 'timestamp')); + $table->setColumn('session_key', 'string', 40, array('primary' => true, 'type' => 'string', 'length' => '40')); + $table->setColumn('session_data', 'string', null, array('type' => 'string')); + $table->setColumn('expire_data', 'timestamp', null, array('type' => 'timestamp')); }