New column not being added during migration?

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

New column not being added during migration?

Post by Toxyy »

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 <[email protected]>
* @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!

Some of my extensions:
[3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: New column not being added during migration?

Post by david63 »

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!

I now no longer support any of my extensions but they will start to become available here
User avatar
Toxyy
Registered User
Posts: 938
Joined: Mon Oct 24, 2016 3:22 pm
Location: Namek
Contact:

Re: New column not being added during migration?

Post by Toxyy »

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!

Some of my extensions:
[3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
Post Reply

Return to “Extension Writers Discussion”