From 43f46f987981cae598eee65d51de1608d012b567 Mon Sep 17 00:00:00 2001 From: phl0 Date: Fri, 30 Sep 2022 11:11:11 +0200 Subject: [PATCH] Restore initial data type of frequency column in cat table Signed-off-by: phl0 --- application/config/migration.php | 2 +- .../101_make_frequency_bigint_again.php | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 application/migrations/101_make_frequency_bigint_again.php diff --git a/application/config/migration.php b/application/config/migration.php index 3090a89d..da99decf 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 100; +$config['migration_version'] = 101; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/101_make_frequency_bigint_again.php b/application/migrations/101_make_frequency_bigint_again.php new file mode 100644 index 00000000..275c7bdd --- /dev/null +++ b/application/migrations/101_make_frequency_bigint_again.php @@ -0,0 +1,45 @@ +db->table_exists('cat')) { + if ($this->db->field_exists('frequency', 'cat')) { + $fields = array( + 'frequency' => array( + 'name' => 'frequency', + 'type' => 'BIGINT', + 'null' => TRUE, + 'default' => NULL, + ), + ); + $this->dbforge->modify_column('cat', $fields); + } + } + } + + public function down() + { + if ($this->db->table_exists('cat')) { + if ($this->db->field_exists('frequency', 'cat')) { + $fields = array( + 'frequency' => array( + 'name' => 'frequency', + 'type' => 'VARCHAR(10)', + 'null' => TRUE, + 'default' => NULL, + ), + ); + $this->dbforge->modify_column('cat', $fields); + } + } + } +}