When we change e.g name of migration file, we should execute the command below
$ composer dump-autoload
When we change e.g name of migration file, we should execute the command below
$ composer dump-autoload
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <KEY>
html
<input type="text" onkeyup="validate_number(this)" onpaste="validate_number(this)"/>
script.js
function validate_number(el, float = false) {
if(el.value.length != 0) {
let value = el.value;
let value_parts = [0];
// change every ',' to '.'
value = value.replace(/\,/g, '.');
// delete every char except numbers and dots
value = value.replace(/[^0-9\.]+/g, '');
// lets check if someone wrote dot
let dot = value[value.length - 1] == '.' && float ? '.' : '';
if(value) {
// value exist so lets divide it - for numbers with multiple dots
value_parts = value.match(/[0-9]+/g);
// first number should be parsed to int for situations like '023'
value_parts[0] = parseInt(value_parts[0]);
}
if(value_parts.length == 1 || value_parts.length > 1 && !float) {
el.value = value_parts[0] + dot;
}
else {
el.value = value_parts[0] + '.' + value_parts[1];
}
}
}
-- create new table
CREATE TABLE new_table (LIKE old_table INCLUDING all);
-- delete default sequence from primary key
ALTER TABLE new_table ALTER ot_id DROP DEFAULT;
-- copy data from old to new table
INSERT INTO new_table SELECT * FROM old_table;
-- change primary key column name to new one
ALTER TABLE new_table RENAME COLUMN ot_id TO nt_id;
-- create new sequence - auto increment
CREATE SEQUENCE new_table_nt_id_seq;
-- set max value for this sequence as max ot_id from old table
SELECT setval('new_table_nt_id_seq', (SELECT max(ot_id) FROM old_table), true);
-- set this sequence as default value for new table primary key
ALTER TABLE new_table ALTER nt_id SET DEFAULT nextval('new_table_nt_id_seq');
-- set new table primary key as owner of this sequence
ALTER SEQUENCE new_table_nt_id_seq OWNED BY new_table.nt_id;