-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prend en charge les catégories pour les caractéristiques spéciales (API)
- Loading branch information
Showing
11 changed files
with
397 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
server/src/database/migrations/20210126172803_add_attributes_categories_relation.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
use Phinx\Migration\AbstractMigration; | ||
|
||
class AddAttributesCategoriesRelation extends AbstractMigration | ||
{ | ||
public function up() | ||
{ | ||
$table = $this->table('attribute_categories'); | ||
$table | ||
->addColumn('attribute_id', 'integer') | ||
->addColumn('category_id', 'integer') | ||
->addIndex(['attribute_id']) | ||
->addForeignKey('attribute_id', 'attributes', 'id', [ | ||
'delete' => 'CASCADE', | ||
'update' => 'NO_ACTION', | ||
'constraint' => 'fk_attribute_categories_attribute' | ||
]) | ||
->addIndex(['category_id']) | ||
->addForeignKey('category_id', 'categories', 'id', [ | ||
'delete' => 'CASCADE', | ||
'update' => 'NO_ACTION', | ||
'constraint' => 'fk_attribute_categories_category' | ||
]) | ||
->create(); | ||
} | ||
|
||
public function down() | ||
{ | ||
$this->table('attribute_categories')->drop()->save(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"attribute_id": 1, | ||
"category_id": 1 | ||
}, | ||
{ | ||
"attribute_id": 1, | ||
"category_id": 2 | ||
}, | ||
{ | ||
"attribute_id": 3, | ||
"category_id": 1 | ||
} | ||
] |
Oops, something went wrong.