diff --git a/common/config/main.php b/common/config/main.php index 21e6410..5c8ad2d 100755 --- a/common/config/main.php +++ b/common/config/main.php @@ -45,9 +45,9 @@ 'class' => SeoComponent::className(), ], 'imagemanager' => [ - 'class' => 'noam148\imagemanager\components\ImageManagerGetPath', - 'mediaPath' => dirname(dirname(__DIR__)) . '/common/images', - 'cachePath' => 'assets/images', + 'class' => 'artbox\core\components\imagemanager\components\ImageManagerGetPath', + 'mediaPath' => dirname(dirname(__DIR__)) . '/storage', + 'cachePath' => '../../storage/cache', 'useFilename' => true, 'absoluteUrl' => false, ], diff --git a/console/migrations/m171123_140641_create_page_category_table.php b/console/migrations/m171123_140641_create_page_category_table.php new file mode 100644 index 0000000..9278274 --- /dev/null +++ b/console/migrations/m171123_140641_create_page_category_table.php @@ -0,0 +1,29 @@ +createTable('page_category', [ + 'id' => $this->primaryKey(), + 'sort' => $this->integer(), + 'status' => $this->boolean(), + ]); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropTable('page_category'); + } +} diff --git a/console/migrations/m171123_140827_create_page_category_lang_table.php b/console/migrations/m171123_140827_create_page_category_lang_table.php new file mode 100644 index 0000000..3ac5657 --- /dev/null +++ b/console/migrations/m171123_140827_create_page_category_lang_table.php @@ -0,0 +1,30 @@ +createTable('page_category_lang', [ + 'id' => $this->primaryKey(), + 'title' => $this->string(), + 'language_id' => $this->integer(), + 'page_category_id' => $this->integer(), + ]); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropTable('page_category_lang'); + } +} diff --git a/console/migrations/m171123_141322_create_junction_table_for_page_and_page_category_tables.php b/console/migrations/m171123_141322_create_junction_table_for_page_and_page_category_tables.php new file mode 100644 index 0000000..80bdc1b --- /dev/null +++ b/console/migrations/m171123_141322_create_junction_table_for_page_and_page_category_tables.php @@ -0,0 +1,91 @@ +createTable('page_to_category', [ + 'page_id' => $this->integer(), + 'category_id' => $this->integer(), + 'PRIMARY KEY(page_id, category_id)', + ]); + + // creates index for column `page_id` + $this->createIndex( + 'idx-page_to_category-page_id', + 'page_to_category', + 'page_id' + ); + + // add foreign key for table `page` + $this->addForeignKey( + 'fk-page_to_category-page_id', + 'page_to_category', + 'page_id', + 'page', + 'id', + 'CASCADE' + ); + + // creates index for column `category_id` + $this->createIndex( + 'idx-page_to_category-category_id', + 'page_to_category', + 'category_id' + ); + + // add foreign key for table `page_category` + $this->addForeignKey( + 'fk-page_to_category-category_id', + 'page_to_category', + 'category_id', + 'page_category', + 'id', + 'CASCADE' + ); + } + + /** + * @inheritdoc + */ + public function down() + { + // drops foreign key for table `page` + $this->dropForeignKey( + 'fk-page_to_category-page_id', + 'page_to_category' + ); + + // drops index for column `page_id` + $this->dropIndex( + 'idx-page_to_category-page_id', + 'page_to_category' + ); + + // drops foreign key for table `page_category` + $this->dropForeignKey( + 'fk-page_to_category-category_id', + 'page_to_category' + ); + + // drops index for column `category_id` + $this->dropIndex( + 'idx-page_to_category-category_id', + 'page_to_category' + ); + + $this->dropTable('page_to_category'); + } +} diff --git a/console/migrations/m171123_142225_add_gallery_column_to_page_table.php b/console/migrations/m171123_142225_add_gallery_column_to_page_table.php new file mode 100644 index 0000000..48d0a9e --- /dev/null +++ b/console/migrations/m171123_142225_add_gallery_column_to_page_table.php @@ -0,0 +1,25 @@ +addColumn('page', 'gallery', $this->string(255)); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropColumn('page', 'gallery'); + } +} diff --git a/console/migrations/m171123_151350_create_ImageManager_table.php b/console/migrations/m171123_151350_create_ImageManager_table.php new file mode 100644 index 0000000..dde5951 --- /dev/null +++ b/console/migrations/m171123_151350_create_ImageManager_table.php @@ -0,0 +1,40 @@ +createTable('ImageManagerLang', [ + 'image_id' => $this->integer(), + 'language_id' => $this->integer(), + 'title' => $this->string(), + 'alt' => $this->string(), + 'description' => $this->string(), + ]); + + $this->createIndex( + 'imageManagerIndexLang', + 'ImageManagerLang', + ['image_id', 'language_id'], + true + ); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropIndex('imageManagerIndexLang', "ImageManagerLang"); + + $this->dropTable('ImageManagerLang'); + } +} -- libgit2 0.21.4