Welcome Guest, Not a member yet? Register   Sign In
Database Forge

(This post was last modified: 04-10-2018, 08:39 AM by iceleo.)


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.

Theme © iAndrew 2016 - Forum software by © MyBB