Skip to content

Commit

Permalink
Add migration files to create newer tables
Browse files Browse the repository at this point in the history
  • Loading branch information
catdesu committed Feb 28, 2024
1 parent 8928c58 commit 6078de2
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Timbreuse\Database\Migrations;

use CodeIgniter\Database\Migration;

class CreateUserGroupTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'unsigned' => true,
'auto_increment' => true
],
'fk_user_group_id' => [
'type' => 'INT',
'unsigned' => true
],
'name' => [
'type' => 'VARCHAR',
'constraint' => '45'
]
]);

$this->forge->addKey('id', true);
$this->forge->addForeignKey('fk_user_group_id', 'user_group', 'id');
$this->forge->createTable('user_group', true);
}

public function down()
{
//
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Timbreuse\Database\Migrations;

use CodeIgniter\Database\Migration;

class CreateUserSyncGroupTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'unsigned' => true,
'auto_increment' => true
],
'fk_user_group_id' => [
'type' => 'INT',
'unsigned' => true
],
'fk_user_sync_id' => [
'type' => 'INT'
]
]);

$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->createTable('user_sync_group', true);
}

public function down()
{
//
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Timbreuse\Database\Migrations;

use CodeIgniter\Database\Migration;

class CreateEventTypeTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'unsigned' => true,
'auto_increment' => true
],
'name' => [
'type' => 'VARCHAR',
'constraint' => '45'
],
'is_group_event' => [
'type' => 'BOOLEAN'
],
'is_personal_event' => [
'type' => 'BOOLEAN'
],
]);

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

public function down()
{
//
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace Timbreuse\Database\Migrations;

use CodeIgniter\Database\Migration;

class CreatePlanningEventTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'unsigned' => true,
'auto_increment' => true
],
'fk_user_group_id' => [
'type' => 'INT',
'unsigned' => true,
'null' => true
],
'fk_user_sync_id' => [
'type' => 'INT',
'null' => true
],
'fk_event_type_id' => [
'type' => 'INT',
'unsigned' => true
],
'event_date' => [
'type' => 'DATE'
],
'start_time' => [
'type' => 'TIME'
],
'end_time' => [
'type' => 'TIME'
],
'is_work_time' => [
'type' => 'BOOLEAN'
],
]);

$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_type_id', 'event_type', 'id');
$this->forge->createTable('event_planning', true);
}

public function down()
{
//
}
}

0 comments on commit 6078de2

Please sign in to comment.