Class: Mkxms::Mssql::Schema

Inherits:
Object
  • Object
show all
Includes:
ExtendedProperties, Property::Hosting
Defined in:
lib/mkxms/mssql/schema_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ExtendedProperties

#extended_properties

Methods included from Property::Hosting

#extended_properties_sql

Constructor Details

#initialize(name, owner: nil) ⇒ Schema

Returns a new instance of Schema.



9
10
11
12
# File 'lib/mkxms/mssql/schema_handler.rb', line 9

def initialize(name, owner: nil)
  @name = name
  @owner = owner
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



14
15
16
# File 'lib/mkxms/mssql/schema_handler.rb', line 14

def name
  @name
end

#ownerObject

Returns the value of attribute owner.



14
15
16
# File 'lib/mkxms/mssql/schema_handler.rb', line 14

def owner
  @owner
end

Instance Method Details

#property_subject_identifiersObject



24
25
26
# File 'lib/mkxms/mssql/schema_handler.rb', line 24

def property_subject_identifiers
  ['SCHEMA', Utils.unquoted_name(name)]
end

#to_sqlObject



16
17
18
19
20
21
22
# File 'lib/mkxms/mssql/schema_handler.rb', line 16

def to_sql
  if owner
    "CREATE SCHEMA #{name} AUTHORIZATION #{owner};"
  else
    "CREATE SCHEMA #{name};"
  end + extended_properties_sql.joined_on_new_lines
end