CodeIgniter Forums

Full Version: Database Forge
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Maybe the Database Forge is not designed for more purposes. I use it to create a table, modify a column, I realized it was not flexible enough. So I request some method for this class.

modifyPrimaryKey(string $table_name, string | array $keys); // ALTER TABLE `table_name` DROP PRIMARY KEY, ADD PRIMARY KEY(`key_1`, `key_2`);

This method is designed to modify one or more primary keys from a table.

dropPrimaryKey(string $table_name); // ALTER TABLE `table_name` DROP PRIMARY KEY;

This method is designed to drop all primary keys from a table.

You can use modifyPrimaryKey() method for both method above. If $keys is empty, just drop all primary keys.

It's up to you.

addField(array $field) and modifyColumn(string $table, array $field);
Should be had (bool) 'primary' property in array $field like unsigned, auto_increment.

Thank you.