Commits

Anonymous committed 69c5deb

Ativando migrations e criando tabela posts.

Ativei o sistema de migrations e criei a primeira tabela do sistema para
os posts.

  • Participants
  • Parent commits 06462ac

Comments (0)

Files changed (5)

File application/config/migration.php

 | whenever you intend to do a schema migration.
 |
 */
-$config['migration_enabled'] = FALSE;
+$config['migration_enabled'] = TRUE;
 
 
 /*
 | be upgraded / downgraded to.
 |
 */
-$config['migration_version'] = 0;
+$config['migration_version'] = 1;
 
 
 /*
 
 
 /* End of file migration.php */
-/* Location: ./application/config/migration.php */
+/* Location: ./application/config/migration.php */

File application/controllers/utils.php

+<?php
+
+class Utils extends CI_Controller
+{
+
+    /**
+     * migrate
+     *
+     * Aplica as migrations
+     * 
+     * @access public
+     * @return void
+     */
+    public function migrate()
+    {
+        $this->load->library('migration');
+
+        if(! $this->migration->current()) {
+            echo $this->migration->error_string();
+        } else {
+            echo "Migration Ok.";
+        }
+    }
+
+}

File application/migrations/001_tabela_posts.php

+<?php
+
+class Migration_Tabela_posts extends CI_Migration {
+
+    public function up()
+    {
+        $this->dbforge->add_field(array(
+            'id' => array(
+                'type' => 'INT',
+                'constraint' => 9,
+                'unsigned' => TRUE,
+                'auto_increment' => TRUE
+            ),
+            'titulo' => array(
+                'type' => 'VARCHAR',
+                'constraint' => 60
+            ),
+            'url' => array(
+                'type' => 'VARCHAR',
+                'constraint' => 60
+            ),
+            'texto' => array(
+                'type' => 'TEXT'
+            ),
+            'publicacao' => array(
+                'type' => 'DATETIME'
+            ), 
+            'autor' => array(
+                'type' => 'VARCHAR',
+                'constraint' => 20
+            ),
+            'tags' => array(
+                'type' => 'VARCHAR',
+                'constraint' => 100,
+                'null' => TRUE
+            )
+        ));
+
+        $this->dbforge->add_key('id', TRUE);
+
+        $this->dbforge->create_table('posts');
+    }
+
+    public function down()
+    {
+        $this->dbforge->drop_table('posts');
+    }
+}

File docs/histograma.dia

Binary file added.

File docs/mer.dia

Binary file added.