AnatolyUss / nmig

NMIG is a database migration tool, written in Node.js and highly inspired by FromMySqlToPostgreSql.
GNU General Public License v3.0
451 stars 83 forks source link

lowerCaseAllColumnNames option in extra_config #130

Closed josesydor closed 1 month ago

josesydor commented 1 month ago

Hi there, First of, thank you for this tool, it's going to save me a lot of time.

But I need to figure out how to properly add lowerCaseAllColumnNames : true inside extra_config.json as it is not documented.

I tried to simply change ExtraConfigProcessor.ts with: retVal = retVal.toLowerCase();

That indeed changed the column names to lowercase, but the tables didn't get populated because the insert sees them with the old names still: --[populateTable] Error loading table data: _

SELECT Id AS Id,REPLACE(Label, ' ', '') AS Label,Order AS Order,AboutProductInformationStyle AS AboutProductInformationStyle FROM aboutproductinformation;

_

Can I get some help, please?

AnatolyUss commented 1 month ago

Hi Jose, Sure, with pleasure!

Try following, via config:

  1. At config.json, set enable_extra_config: true
  2. At extra_config.json, add lowerCaseAllColumnNames: true at the root of the document.
  3. Make sure to delete tables and foreign_keys sections.
  4. Run nmig as usual.
josesydor commented 1 month ago

Hi Anatoly, Thank you for the quick reply. The column names are lowercase alright due to the extra_config, but no data was inserted. I still get this error:

    --[populateTable] Error loading table data:
SELECT `Id` AS `Id`,REPLACE(`Label`, ' ', '') AS `Label`,`Order` AS `Order`,`AboutProductInformationStyle` AS `AboutProductInformationStyle` FROM `aboutproductinformation`;
AnatolyUss commented 1 month ago

Jose, hello again, I think, the issue is fixed now.

  1. Please, either git pull the latest changes from master, or download the latest release v6.1.1.
  2. At config.json, set enable_extra_config to true.
  3. At extra_config.json, find the lowerCaseAllColumnNames, and set it true.
  4. Run nmig as usual.

Please, let me know if the issue is resolved on your side.

josesydor commented 1 month ago

I confirm it worked. Thank you kindly! Also confirm changing datatypes mapping default worked, as I had to use citext for varchars and map bit to bool because, you know, in MariaDB/MySQL Bit(1) and Boolean are used interchangeably but, in PG, you cannot do, say: WHERE NOT (isSomething) with bit datatypes (varying or not), only Bool

AnatolyUss commented 1 month ago

Great, glad it worked! Thank you, Sir!

On Sat, Aug 31, 2024, 4:10 PM josesydor @.***> wrote:

I confirm it worked. Thank you kindly! Also confirm changing datatypes mapping default worked, as I had to use citext for varchars and map bit to bool because, you know, in MariaDB/MySQL Bit(1) and Boolean are used interchangeably but, in PG, you cannot do, say: WHERE NOT (isSomething) with bit datatypes (varying or not), only Bool

— Reply to this email directly, view it on GitHub https://github.com/AnatolyUss/nmig/issues/130#issuecomment-2322893135, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHR7N5SHORAD4FQDNU7NSLZUG6E5AVCNFSM6AAAAABNGXJO3WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRSHA4TGMJTGU . You are receiving this because you commented.Message ID: @.***>