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

current_timestamp() as default value gets not migrated from mariadb to postgresql #109

Open Triggsy22 opened 1 year ago

Triggsy22 commented 1 year ago

In a migration from mariadb to postgresql, when a column in mariadb has default of current_timstamp(), this default value gets not transfered to postgresql. Instead it gets no default value at all.

MariaDB Version: 10.3.38 PostgreSQL Version: 12.15

From the Log Files:

SQL: ALTER TABLE "public"."directus_files" ALTER COLUMN "modified_on" SET DEFAULT 'current_timestamp()'; --[DefaultProcessor::default] error: invalid input syntax for type timestamp: "current_timestamp()"

I think the real query should be: ALTER TABLE "public"."directus_files" ALTER COLUMN "modified_on" SET DEFAULT CURRENT_TIMESTAMP;