6 $migration = new Migrations
;
8 if(Schema
::has('users', 'email') === false) {
9 $sql = "alter table `users` add `email` varchar( 140 ) not null after `password`";
10 $migration->query($sql);
13 if(Schema
::has('posts', 'comments') === false) {
14 $sql = "alter table `posts` add `comments` tinyint( 1 ) not null";
15 $migration->query($sql);
18 if(Schema
::has('posts', 'custom_fields') === false) {
19 $sql = "alter table `posts` add `custom_fields` text not null after `js`";
20 $migration->query($sql);
23 $sql = "create table if not exists `comments` (
24 `id` int(6) not null auto_increment,
25 `post` int(6) not null,
26 `status` enum('pending','published','spam') not null,
27 `date` int(11) not null,
28 `name` varchar(140) not null,
29 `email` varchar(140) not null,
33 key `status` (`status`)
34 ) engine=myisam charset=utf8 collate=utf8_general_ci";
35 $migration->query($sql);
38 $sql = "update `meta` set `value` = 'posts_page' where `value` = 'show_posts'";
39 $migration->query($sql);
41 // make posts_page the home page
42 if(Schema
::has('meta', 'key', 'home_page') === false) {
43 $posts_page = Db
::query("select `value` from meta where `key` = 'show_posts'")->fetchColumn();
45 $sql = "insert into `meta` (`key`, `value`) values ('home_page', '" . $posts_page . "')";
46 $migration->query($sql);
49 // [BUGFIX] make sure the password field is big enough
50 $sql = "alter table `users` change `password` `password` text character set utf8 COLLATE utf8_general_ci not null";
51 $migration->query($sql);
57 Config
::set('application.admin_folder', 'admin');
58 Config
::set('application.key', random(32));
63 $migration = new Migrations
;
65 $sql = "create table if not exists `sessions` (
66 `id` char( 32 ) not null ,
67 `date` datetime not null ,
68 `ip` varchar( 15 ) not null ,
69 `ua` varchar( 140 ) not null ,
71 ) engine=innodb charset=utf8 collate=utf8_general_ci;";
72 $migration->query($sql);
74 // comments auto published option
75 if(Schema
::has('meta', 'key', 'auto_published_comments') === false) {
76 $sql = "insert into `meta` (`key`, `value`) values ('auto_published_comments', '0')";
77 $migration->query($sql);
81 if(Schema
::has('meta', 'key', 'posts_per_page') === false) {
82 $sql = "insert into `meta` (`key`, `value`) values ('posts_per_page', '10')";
83 $migration->query($sql);
90 Config
::set('session.name', 'testcms');
91 Config
::set('session.expire', 3600);
92 Config
::set('session.path', '/');
93 Config
::set('session.domain', '');
95 Config
::set('error.ignore', array(E_NOTICE
, E_USER_NOTICE
, E_DEPRECATED
, E_USER_DEPRECATED
));
96 Config
::set('error.detail', true);
97 Config
::set('error.log', false);