Creating new table in octobercms

I must create new table in octobercms project and I followed documentation and added new migration file inside plugin update file I have create_currency_rates_table.php file and it has this codes

<?php namespace RainLabUserUpdates;
use Schema;
use OctoberRainDatabaseUpdatesMigration;

class CreateCurrencyRateTable extends Migration
{
    public function up()
    {
        Schema::create('currency_rates', function($table)
        {
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->string('currency');
         
        });
    }

    public function down()
    {
        Schema::drop('currency_rate');
    }
}

when I used php artisan october:up it is not detecting new migration. How can I create new table?Can anyone help me?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You also need to update plugins<author><plugin_name>updatesversion.yaml this file and add your file name there as well.

So, in your case, you added a file like create_currency_rates_table.php then you need to add details of your file in version.yaml

for ex:

1.0.1: First version of Demo
1.0.2:
  - Description About what is this update about?
  - create_currency_rates_table.php

now when you next time just login to backend this table will be created automatically.

if any doubt please comment.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x