How can I set integers in phpMyAdmin for unsigned by default?

How can I set integers in phpMyAdmin for unsigned by default? In most cases, I set their auto-increment, and I do not need negative values. Is there a way I can do this?

+6
source share
4 answers

Add this to common.inc.php :

 $GLOBALS['js_include'][] = 'extension.js'; 

Create the extension.js file in the js folder:

 jQuery(function(){ $('#create_table_form select[name=tbl_collation]').val('utf8_general_ci'); $('#append_fields_form select.column_type, #create_table_form select.column_type').live('change keyup',function(k,v){ var field = $(this).attr('name').replace(/[^0-9]/g,''); var val = $(this).val(); $('[name="field_attribute['+field+']"] option').attr('selected',false); $('[name="field_collation['+field+']"] option').attr('selected',false); $('[name="field_length['+field+']"]').val(''); if(val == 'VARCHAR'){ $('[name="field_length['+field+']"]').val('255'); $('[name="field_collation['+field+']"]').val('utf8_general_ci'); } if(val == 'INT'){ $('[name="field_attribute['+field+']"]').val('UNSIGNED'); $('[name="field_length['+field+']"]').val('11'); } }); }); 

Tested with phpMyAdmin 3.4.2. Also sets a few other useful default settings.

0
source

This is possible in a later version of phpMyAdmin using the Attributes parameter.

+6
source

I think this is not possible using the user interface ...
You should edit / implement it in phpMyAdmin source code ...

Link with additional information on phpMyAdmin development: Developer Wiki Link: Link
You must use GIT to work with source code.

There you can get the source code and implement this function.

Good luck

0
source
  • Setting unsigned integers through an interface.

    • Open the drop-down menu in the "Attributes" column in the table structure.
    • Select "unsigned" and click "Save."

unsigned screenshot phpmyadmin

Unfortunately, by default there is no way to do this. However, you can check several columns and click "Edit" to immediately change them using the phpmyadmin interface, as shown below. enter image description here

0
source

Source: https://habr.com/ru/post/892351/


All Articles