Skip to content

Commit

Permalink
Update migrations with newer table event_series
Browse files Browse the repository at this point in the history
  • Loading branch information
catdesu committed Mar 5, 2024
1 parent 1a13362 commit 7cf8c33
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace Timbreuse\Database\Migrations;

use CodeIgniter\Database\Migration;

class CreateEventSerieTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'unsigned' => true,
'auto_increment' => true
],
'start_date' => [
'type' => 'DATE'
],
'end_date' => [
'type' => 'DATE'
],
'recurrence_frequency' => [
'type' => 'ENUM',
'constraint' => [
'weekly',
'monthly'
]
],
'recurrence_interval' => [
'type' => 'INT'
],
'days_of_week' => [
'type' => 'JSON'
],
]);

$this->forge->addKey('id', true);
$this->forge->createTable('event_series', true);
}

public function down()
{
$this->forge->dropTable('event_series', true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ public function up()
'unsigned' => true,
'auto_increment' => true
],
'fk_event_series_id' => [
'type' => 'INT',
'unsigned' => true,
'null' => true
],
'fk_user_group_id' => [
'type' => 'INT',
'unsigned' => true,
Expand Down Expand Up @@ -44,13 +49,15 @@ public function up()
$this->forge->addKey('id', true);
$this->forge->addForeignKey('fk_user_group_id', 'user_group', 'id');
$this->forge->addForeignKey('fk_user_sync_id', 'user_sync', 'id_user');
$this->forge->addForeignKey('fk_event_series_id', 'event_series', 'id');
$this->forge->addForeignKey('fk_event_type_id', 'event_type', 'id');
$this->forge->createTable('event_planning', true);
}

public function down()
{
$this->forge->dropForeignKey('event_planning', 'event_planning_fk_event_type_id_foreign');
$this->forge->dropForeignKey('event_planning', 'event_planning_fk_event_series_id_foreign');
$this->forge->dropForeignKey('event_planning', 'event_planning_fk_user_group_id_foreign');
$this->forge->dropForeignKey('event_planning', 'event_planning_fk_user_sync_id_foreign');

Expand Down

0 comments on commit 7cf8c33

Please sign in to comment.