Skip to content

Commit

Permalink
cleanup database
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpapst committed Sep 17, 2024
1 parent ad70502 commit 5efcfb7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
16 changes: 6 additions & 10 deletions Entity/SharedProjectTimesheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@
use Symfony\Component\Validator\Constraints as Assert;

#[ORM\Table(name: 'kimai2_customer_portals')]
#[ORM\Index(columns: ['customer_id'])]
#[ORM\Index(columns: ['project_id'])]
#[ORM\Index(columns: ['share_key'])]
#[ORM\Index(columns: ['customer_id', 'project_id', 'share_key'])]
#[ORM\Entity(repositoryClass: SharedProjectTimesheetRepository::class)]
#[ORM\UniqueConstraint(columns: ['customer_id', 'project_id', 'share_key'])]
#[ORM\UniqueConstraint(columns: ['share_key'])]
#[UniqueEntity(fields: ['shareKey'])]
class SharedProjectTimesheet
Expand Down Expand Up @@ -53,26 +49,26 @@ class SharedProjectTimesheet
#[Assert\Length(max: 255)]
private ?string $password = null;

#[ORM\Column(name: 'entry_user_visible', type: 'boolean', nullable: false)]
#[ORM\Column(name: 'entry_user_visible', type: 'boolean', nullable: false, options: ['default' => false])]
private bool $entryUserVisible = false;

#[ORM\Column(name: 'entry_rate_visible', type: 'boolean', nullable: false)]
#[ORM\Column(name: 'entry_rate_visible', type: 'boolean', nullable: false, options: ['default' => false])]
private bool $entryRateVisible = false;

#[ORM\Column(name: 'record_merge_mode', type: 'string', length: 50, nullable: false)]
#[Assert\Length(max: 50)]
private string $recordMergeMode = RecordMergeMode::MODE_NONE;

#[ORM\Column(name: 'annual_chart_visible', type: 'boolean', nullable: false)]
#[ORM\Column(name: 'annual_chart_visible', type: 'boolean', nullable: false, options: ['default' => false])]
private bool $annualChartVisible = false;

#[ORM\Column(name: 'monthly_chart_visible', type: 'boolean', nullable: false)]
#[ORM\Column(name: 'monthly_chart_visible', type: 'boolean', nullable: false, options: ['default' => false])]
private bool $monthlyChartVisible = false;

#[ORM\Column(name: 'budget_stats_visible', type: 'boolean', nullable: false)]
#[ORM\Column(name: 'budget_stats_visible', type: 'boolean', nullable: false, options: ['default' => false])]
private bool $budgetStatsVisible = false;

#[ORM\Column(name: 'time_budget_stats_visible', type: 'boolean', nullable: false)]
#[ORM\Column(name: 'time_budget_stats_visible', type: 'boolean', nullable: false, options: ['default' => false])]
private bool $timeBudgetStatsVisible = false;

public function getId(): ?int
Expand Down
6 changes: 3 additions & 3 deletions Migrations/Version20240915125912.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ public function up(Schema $schema): void
$table->addColumn('customer_id', Types::INTEGER, ['notnull' => false]);
$table->addColumn('share_key', Types::STRING, ['length' => 20, 'notnull' => true]);
$table->addColumn('password', Types::STRING, ['length' => 255, 'default' => null, 'notnull' => false]);
$table->addColumn('record_merge_mode', Types::STRING, ['length' => 50, 'notnull' => true, 'default' => RecordMergeMode::MODE_NONE]);
$table->addColumn('record_merge_mode', Types::STRING, ['length' => 50, 'notnull' => true]);
$table->addColumn('entry_user_visible', Types::BOOLEAN, ['default' => false, 'notnull' => true]);
$table->addColumn('entry_rate_visible', Types::BOOLEAN, ['default' => false, 'notnull' => true]);
$table->addColumn('annual_chart_visible', Types::BOOLEAN, ['default' => false, 'notnull' => true]);
$table->addColumn('monthly_chart_visible', Types::BOOLEAN, ['default' => false, 'notnull' => true]);
$table->addColumn('budget_stats_visible', Types::BOOLEAN, ['default' => false, 'notnull' => true]);
$table->addColumn('time_budget_stats_visible', Types::BOOLEAN, ['default' => false, 'notnull' => true]);

$table->addForeignKeyConstraint('kimai2_projects', ['project_id'], ['id'], ['onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE']);
$table->addForeignKeyConstraint('kimai2_customers', ['customer_id'], ['id'], ['onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE']);
$table->addForeignKeyConstraint('kimai2_projects', ['project_id'], ['id'], ['onDelete' => 'CASCADE'], 'FK_7747AE6B166D1F9C');
$table->addForeignKeyConstraint('kimai2_customers', ['customer_id'], ['id'], ['onDelete' => 'CASCADE'], 'FK_7747AE6B9395C3F3');

$table->setPrimaryKey(['id']);
$table->addUniqueIndex(['share_key']);
Expand Down

0 comments on commit 5efcfb7

Please sign in to comment.