Skip to content

Commit

Permalink
add index
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Apr 15, 2024
1 parent 32e7de5 commit 43bcff4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Migrations/Version20240121100724.php
Expand Up @@ -55,6 +55,7 @@ public function up(Schema $schema): void
$webhookTable->addColumn('name', 'string', ['length' => 32]);
$webhookTable->addColumn('endpoint', 'string', ['length' => 255]);
$webhookTable->setPrimaryKey(['id']);
$webhookTable->addIndex(['tenant_id']);

$webhookTable->addForeignKeyConstraint($schema->getTable('fusio_event'), ['event_id'], ['id'], [], 'webhook_event_id');
$webhookTable->addForeignKeyConstraint($schema->getTable('fusio_user'), ['user_id'], ['id'], [], 'webhook_user_id');
Expand Down Expand Up @@ -91,9 +92,6 @@ public function up(Schema $schema): void
} elseif ($tableName === 'fusio_page') {
$this->dropIndexForColumn($table, ['slug']);
$table->addUniqueIndex(['tenant_id', 'slug']);
} elseif ($tableName === 'fusio_token') {
$table->addUniqueIndex(['tenant_id', 'status', 'token']);
$table->addUniqueIndex(['tenant_id', 'refresh']);
} elseif ($tableName === 'fusio_transaction') {
$this->dropIndexForColumn($table, ['transaction_id']);
$table->addUniqueIndex(['tenant_id', 'transaction_id']);
Expand All @@ -104,8 +102,10 @@ public function up(Schema $schema): void
$table->addUniqueIndex(['tenant_id', 'identity_id', 'remote_id']);
$table->addUniqueIndex(['tenant_id', 'name']);
$table->addUniqueIndex(['tenant_id', 'email']);
} elseif (in_array($tableName, ['fusio_audit', 'fusio_log', 'fusio_webhook'])) {
} elseif (in_array($tableName, ['fusio_audit', 'fusio_log'])) {
$table->addIndex(['tenant_id']);
} elseif (in_array($tableName, ['fusio_token', 'fusio_webhook'])) {
// noop
} else {
$this->dropIndexForColumn($table, ['name']);
$table->addUniqueIndex(['tenant_id', 'name']);
Expand Down

0 comments on commit 43bcff4

Please sign in to comment.