Skip to content

Commit

Permalink
Merge pull request #14 from vrcAlbert/feature/indexs_twinnable
Browse files Browse the repository at this point in the history
add index when a model is twinnable
  • Loading branch information
Foine committed Mar 30, 2015
2 parents b0e2a67 + 6ec27cc commit 0819fd3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions views/admin/generation/basic/misc/model.sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
`<?= $model['column_prefix'] ?>created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`<?= $model['column_prefix'] ?>updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`<?= $model['column_prefix'] ?>id`),
<?php
if (isset($model['has_twinnable_behaviour'])) {
echo ' KEY `' . $model['column_prefix'] . "context` (`". $model['column_prefix'] . "context_common_id`, `". $model['column_prefix'] . "context`),\n";
}
?>
KEY `<?= $model['column_prefix'] ?>created_at` (`<?= $model['column_prefix'] ?>created_at`),
KEY `<?= $model['column_prefix'] ?>updated_at` (`<?= $model['column_prefix'] ?>updated_at`)
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

0 comments on commit 0819fd3

Please sign in to comment.