Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7705455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:52:09+00:00 2026-05-31T23:52:09+00:00

I want to begin using DBForge and migrations class thats built into CI but

  • 0

I want to begin using DBForge and migrations class thats built into CI but im not sure how to go about creating migrations for all of my tables.

My thoughts are in my installer process to have a migration file for each of the following tables: advertisements, announcements, config, users, points.. When the user is installing the app, it will automatically run through these migration files and create the tables.

IE: 001_advertisements, 001_announcements, 001_config, 001_users, 001_points

001_map_advertisements

class Migration_map_advertisements extends CI_Migration {

public function up(){
    $this->dbforge->add_field(array(
        'id' => array(
            'type' => 'INT',
            'constraint' => 11,
            'unsigned' => TRUE,
            'auto_increment' => TRUE
        ),
        'youtube_id' => array(
            'type' => 'VARCHAR',
            'constraint' => '255',
        ),
        'status' => array(
            'type' => 'int',
            'constraint' => 11,
            'null' => FALSE,
            'default' => 1
        ),
        'timestamp' => array(
            'type' => 'int',
            'constraint' => 11
        ),
        'type' => array(
            'type' => 'VARCHAR',
            'default' => 'video'
        ),
        'filename' => array(
            'type' => 'VARCHAR',
            'constraint' => '255'
        ),
        'url' => array(
            'type' => 'varchar',
            'constraint' => '255'
        ),
        'description' => array(
            'type' => 'varchar',
            'constraint' => 64
        ),
        'title' => array(
            'type' => 'varchar',
            'constraint' => 64
        )
    ));
    $this->dbforge->create_table('map_advertisements', TRUE);
}

public function down()
{
    $this->dbforge->drop_table('map_advertisements');
}

However if i do this and attempt to run a secured controller:

class Developer extends ADMIN_Controller {
function __construct(){
    parent::__construct();
} #end constructor function
public function migrate($index){
    $this->load->library('migration');

    if ( !$this->migration->version($index) ){
        show_error($this->migration->error_string());
    }else{
        echo 'migrated';
    }

}
}

i get an error stating that there are multiple version 1 migrations and it fails the migration process. Is there another way to go about this in CI?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:52:10+00:00Added an answer on May 31, 2026 at 11:52 pm

    Yes, you can only have one migration file per version. A migration is not table-specific, but more like “what schema changes are needed to go from version x to version x+1 of my app?”

    Combine all of your existing migration files into 1, and name it something like 001_initial_schema.php. Then, when add a new feature, create a new schema file for that feature. If you have a deployment cycle (like weekly SCRUM sprints), it’s nice to have one of these migration files per deployment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been using the YUI Components and want to begin using the Loader Utility
I know all about threading applications, but haven't done this over web services before.
where to begin ? i want to create multiplayer flash games using Union (any
I want to draw some texts using Quartz. Now the app draws , but
I am using the article class with the code: \documentclass[12pt]{article} \begin{document} \section{Foo} This is
I know how to execute commands on SQL server asynchronously using Begin/EndExecuteNonQuery, but is
I am using sql server 2005 and want to insert a row into a
I've been using \begin{figure} ... \end{figure} throughout my LaTeX document, but the default styling
Begin Edit: Primarily I want my Clojure program to use a Java class. I've
I want to select some objects from an array. Therefore I'm using begin and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.