yii2mod / yii2-cashier

Yii2 Cashier provides an interface to Stripe's subscription billing services.
MIT License
45 stars 23 forks source link

Migrations must have table prefix #8

Closed gogl92 closed 6 years ago

gogl92 commented 6 years ago

Migrations doesn't consider table prefix if exist, should be changed to this

{{%subscription}} and {{%user}}

        $this->createTable('{{%subscription}}', [
            'id' => $this->primaryKey(),
            'userId' => $this->integer()->notNull(),
            'name' => $this->string()->notNull(),
            'stripeId' => $this->string()->notNull(),
            'stripePlan' => $this->string()->notNull(),
            'quantity' => $this->integer()->notNull(),
            'trialEndAt' => $this->timestamp()->null(),
            'endAt' => $this->timestamp()->null(),
            'createdAt' => $this->timestamp()->null(),
            'updatedAt' => $this->timestamp()->null(),
        ], $tableOptions);

        $this->addColumn('{{%user}}', 'stripeId', $this->string());
        $this->addColumn('{{%user}}', 'cardBrand', $this->string());
        $this->addColumn('{{%user}}', 'cardLastFour', $this->string());
        $this->addColumn('{{%user}}', 'trialEndAt', $this->timestamp()->null());
    }

    public function down()
    {
        $this->dropTable('subscription');

        $this->dropColumn('{{%user}}', 'stripeId');
        $this->dropColumn('{{%user}}', 'cardBrand');
        $this->dropColumn('{{%user}}', 'cardLastFour');
        $this->dropColumn('{{%user}}', 'trialEndAt');
    }
ihorchepurnyi commented 6 years ago

Hi, Can you upgrade your package? I have added it's already.

gogl92 commented 6 years ago

Oh I see what the problem is: it is on the master the prefix but is not on the last release. I will try with dev-master

ihorchepurnyi commented 6 years ago

I have created the new release - 1.6, please update your package.