mirror of
https://github.com/hkalexling/Mango.git
synced 2026-04-29 00:00:45 -04:00
Signature matching
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
class RelativePath < MG::Base
|
||||
def up : String
|
||||
base = Config.current.library_path
|
||||
base = base[...-1] if base.ends_with? "/"
|
||||
|
||||
<<-SQL
|
||||
-- update the path column in ids to relative paths
|
||||
UPDATE ids
|
||||
SET path = REPLACE(path, '#{base}', '');
|
||||
|
||||
-- update the path column in titles to relative paths
|
||||
UPDATE titles
|
||||
SET path = REPLACE(path, '#{base}', '');
|
||||
SQL
|
||||
end
|
||||
|
||||
def down : String
|
||||
base = Config.current.library_path
|
||||
base = base[...-1] if base.ends_with? "/"
|
||||
|
||||
<<-SQL
|
||||
-- update the path column in ids to absolute paths
|
||||
UPDATE ids
|
||||
SET path = '#{base}' || path;
|
||||
|
||||
-- update the path column in titles to absolute paths
|
||||
UPDATE titles
|
||||
SET path = '#{base}' || path;
|
||||
SQL
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user