Skip to content

Commit fe335e7

Browse files
committed
Refactor user ClubLog fields migration
Update migration to use array definitions for new user ClubLog fields instead of raw SQL strings. This improves compatibility and clarity when adding columns to the 'users' table.
1 parent 765e469 commit fe335e7

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

application/migrations/018_clubloguserfields.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,29 @@ public function up()
88
{
99
// Check and add each field only if it does not exist
1010
$fields_to_add = array(
11-
'user_clublog_name' => 'VARCHAR(255) DEFAULT NULL',
12-
'user_clublog_password' => 'VARCHAR(255) DEFAULT NULL',
13-
'user_clublog_callsign' => 'VARCHAR(255) DEFAULT NULL'
11+
'user_clublog_name' => array(
12+
'type' => 'VARCHAR',
13+
'constraint' => 255,
14+
'null' => TRUE,
15+
),
16+
'user_clublog_password' => array(
17+
'type' => 'VARCHAR',
18+
'constraint' => 255,
19+
'null' => TRUE,
20+
),
21+
'user_clublog_callsign' => array(
22+
'type' => 'VARCHAR',
23+
'constraint' => 255,
24+
'null' => TRUE,
25+
),
1426
);
1527

1628
// Get current columns in 'users' table
1729
$fields = $this->db->list_fields('users');
1830

1931
foreach ($fields_to_add as $field => $definition) {
2032
if (!in_array($field, $fields)) {
21-
$this->dbforge->add_column('users', array($field . ' ' . $definition));
33+
$this->dbforge->add_column('users', array($field => $definition));
2234
}
2335
}
2436
}

0 commit comments

Comments
 (0)