42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
class NewsletterMigration extends AbstractMigration
|
|
{
|
|
/**
|
|
* Change Method.
|
|
*
|
|
* Write your reversible migrations using this method.
|
|
*
|
|
* More information on writing migrations is available here:
|
|
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
|
*
|
|
* The following commands can be used in this method and Phinx will
|
|
* automatically reverse them when rolling back:
|
|
*
|
|
* createTable
|
|
* renameTable
|
|
* addColumn
|
|
* renameColumn
|
|
* addIndex
|
|
* addForeignKey
|
|
*
|
|
* Remember to call "create()" or "update()" and NOT "save()" when working
|
|
* with the Table class.
|
|
*/
|
|
public function change()
|
|
{
|
|
$this->execute('CREATE TABLE `ps_newsletter_cmsps` (
|
|
`id_newsletter` int(11) NOT NULL,
|
|
`id_category` int(11) NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
|
|
|
|
$this->execute('ALTER TABLE `ps_newsletter_cmsps`
|
|
ADD UNIQUE KEY `id_newsletter` (`id_newsletter`,`id_category`)');
|
|
|
|
}
|
|
|
|
|
|
}
|