New column not being added during migration?

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
Toxyy
Registered User
Posts: 549
Joined: Mon Oct 24, 2016 3:22 pm
Contact:

New column not being added during migration?

Post by Toxyy » Sat Oct 20, 2018 5:56 pm

I'm trying to add a new column to the posts table, but it's just not being added. I've changed the extension version in my composer, and it adds a column in my first migration (you can see it on github), but not this one:

Code: Select all

<?php
/**
*
* phpBB Extension - toxyy Anonymous Posts
* @copyright (c) 2018 toxyy <thrashtek@yahoo.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/

namespace toxyy\anonymousposts\migrations;

class v_0_6_0 extends \phpbb\db\migration\migration
{
	public function effectively_installed()
	{
		return isset($this->config['anonymous_posts']);
	}

	static public function depends_on()
	{
		return array('\toxyy\anonymousposts\migrations\v_0_5_0');
	}

        public function update_schema()
        {
                return array(
                        'add_columns'   => array(
                                $this->table_prefix . 'posts'   => array(
                                        'anonymous_index' => array('UINT', 0),
                                ),
                        ),
                );
        }

        public function revert_schema()
        {
                return array(
                        'drop_columns'  => array(
                                $this->table_prefix . 'posts'   => array(
                                        'anonymous_index',
                                ),
                        ),
                );
        }
}
I even tried changing it to array('BOOL', 0) like in my first migration and that didn't work, and I've deleted the data as well.

What's wrong here? I found a solution in another thread to use update_data, but I don't want to make a habit out of doing that, I must be doing something wrong. I don't have anything in any of my log files suggesting an error.
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

My extensions:
[3.2][BETA] Anonymous Posts || [3.2][RC] Show User Activity

User avatar
david63
Jr. Extension Validator
Posts: 14916
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: New column not being added during migration?

Post by david63 » Sat Oct 20, 2018 6:02 pm

Are your effectively_installed and depends_on valid? Also is your class name correct?

Try removing them and see what happens.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Toxyy
Registered User
Posts: 549
Joined: Mon Oct 24, 2016 3:22 pm
Contact:

Re: New column not being added during migration?

Post by Toxyy » Sat Oct 20, 2018 6:11 pm

david63 wrote:
Sat Oct 20, 2018 6:02 pm
Are your effectively_installed and depends_on valid? Also is your class name correct?

Try removing them and see what happens.
depends_on is valid, effectively_installed wasn't. Removing it worked. Thanks!
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

My extensions:
[3.2][BETA] Anonymous Posts || [3.2][RC] Show User Activity

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: No registered users and 7 guests