diff --git a/data/scripts/migrator/usage_mysql.py b/data/scripts/migrator/usage_mysql.py index 1401f1897..66f20ad5d 100755 --- a/data/scripts/migrator/usage_mysql.py +++ b/data/scripts/migrator/usage_mysql.py @@ -33,8 +33,7 @@ print('Setting new values...') cursor.execute('UPDATE cdrs SET `usage` = `usage_old` * 1000000000 WHERE usage_old IS NOT NULL') print('Deleting old column...') -cursor.execute('ALTER TABLEX cdrs DROP COLUMN usage_old') +cursor.execute('ALTER TABLE cdrs DROP COLUMN usage_old') print('Closing MySQL connection...') cnx.close() - diff --git a/data/storage/migrator/pg_tables_update.sql b/data/storage/migrator/pg_tables_update.sql index 05437783e..01eed390e 100755 --- a/data/storage/migrator/pg_tables_update.sql +++ b/data/storage/migrator/pg_tables_update.sql @@ -77,3 +77,7 @@ CREATE TABLE versions ( +ALTER TABLE cdrs RENAME COLUMN usage to usage_old; +ALTER TABLE cdrs ADD usage NUMERIC(30); +UPDATE cdrs SET usage = usage_old * 1000000000 WHERE usage_old IS NOT NULL; +ALTER TABLE cdrs DROP COLUMN usage_old; \ No newline at end of file