Class: XMigra::AccessArtifact

Inherits:
Object
  • Object
show all
Defined in:
lib/xmigra/access_artifact.rb

Direct Known Subclasses

Function, StoredProcedure, View

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#file_pathObject

Returns the value of attribute file_path.



15
16
17
# File 'lib/xmigra/access_artifact.rb', line 15

def file_path
  @file_path
end

#filename_metavariableObject

Returns the value of attribute filename_metavariable.



15
16
17
# File 'lib/xmigra/access_artifact.rb', line 15

def filename_metavariable
  @filename_metavariable
end

Instance Method Details

#check_existence_sql(for_existence, error_message) ⇒ Object



21
22
23
# File 'lib/xmigra/access_artifact.rb', line 21

def check_existence_sql(for_existence, error_message)
  nil
end

#creation_noticeObject



25
26
27
# File 'lib/xmigra/access_artifact.rb', line 25

def creation_notice
  nil
end

#creation_sqlObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/xmigra/access_artifact.rb', line 29

def creation_sql
  raw = begin
    if metavar = filename_metavariable
      @definition.gsub(metavar) {|m| self.name}
    else
      @definition
    end
  end
  
  if Plugin.active
    raw.dup.tap do |sql|
      Plugin.active.amend_source_sql(sql)
    end
  else
    raw
  end
end

#ddl_block_separatorObject



17
18
19
# File 'lib/xmigra/access_artifact.rb', line 17

def ddl_block_separator
  "\n"
end

#definition_sqlObject



5
6
7
8
9
10
11
12
13
# File 'lib/xmigra/access_artifact.rb', line 5

def definition_sql
  [
    check_existence_sql(false, "%s existed before definition"),
    creation_notice,
    creation_sql + ";",
    check_existence_sql(true, "%s was not created by definition"),
    insert_access_creation_record_sql,
  ].compact.join(ddl_block_separator)
end

#insert_access_creation_record_sqlObject



47
48
49
# File 'lib/xmigra/access_artifact.rb', line 47

def insert_access_creation_record_sql
  nil
end

#printable_typeObject



51
52
53
# File 'lib/xmigra/access_artifact.rb', line 51

def printable_type
  self.class.name.split('::').last.scan(/[A-Z]+[a-z]*/).collect {|p| p.downcase}.join(' ')
end