migrations: getting absolute path

12 views
Skip to first unread message

Stephen Friedrich

unread,
May 14, 2012, 5:25:07 PM5/14/12
to mybati...@googlegroups.com
My migrations include loading file data into MySQL tables using LOAD_FILE(filepath).
Unfortunately MySQL only supports absolute path specifications for filepath.
That means sharing migrations via git does not work :-(

I tried adding
   data_dir=D:/absolute/path/to/migration_repo/data
to the environment.properties and then using LOAD_FILE(${data_dir}/some_file.png)

This is working fine, but actually only shifts the problem, because now everybody must edit the environment properties locally.

I propose to automatically add the migration repo base dir to the environment properties ("mybatis-migration-base-path"?)
From a quick glance at the code, that could be added to BaseCommand.environmentProperties():
   props.put("mybatis-migration-base-path", basePath.getAbsolutePath() );
though MySQL needs forward slashes even on windows.

What do you think?
Or is there a already a way to make this work?
Reply all
Reply to author
Forward
0 new messages