Qore Schema Module Reference  1.1.1
Schema::AbstractVersionedSchema Class Referenceabstract

this class extends Schema::AbstractSchema by providing version logic based on a schema version string contained within the schema itself More...

Inheritance diagram for Schema::AbstractVersionedSchema:

Public Member Functions

private bool checkDowngrade (string current_version)
 this method is called if the current schema version is greater than the target version; returns True if the schema can be downgraded
 
private bool checkDropSchema (bool force)
 this method returns True if the schema can be dropped
 
private bool checkUpdateSchema (bool force, reference initial_schema_info)
 this method returns True if the schema can be updated
 
private bool checkUpgrade (string current_version)
 this method is called if the current schema version is less than the target version; returns True if the schema can be updated
 
 constructor (AbstractDatasource ds, *string dts, *string its, *hash opts)
 creates the object based on the arguments giving the location of the schema More...
 
private *softstring getSchemaVersion ()
 returns the existing schema version or NOTHING if not present
 
private string getVersionColumn ()
 returns the name of the column holding the schema version string by calling getVersionColumnImpl() More...
 
abstract private string getVersionColumnImpl ()
 returns the name of the column holding the schema version string
 
private string getVersionTable ()
 returns the name of the table holding the schema version string by calling getVersionTableImpl() More...
 
abstract private string getVersionTableImpl ()
 returns the name of the table holding the schema version string
 
private hash getVersionWhere ()
 returns the where clause hash defining the row where the schema version string is located by calling getVersionWhereImpl() More...
 
abstract private hash getVersionWhereImpl ()
 returns the where clause hash defining the row where the schema version string is located
 
- Public Member Functions inherited from Schema::AbstractSchema
int align (bool force=False, int verbose=0)
 executes a schema alignment action on the database with the current schema template More...
 
private bool checkDropSchema (bool force)
 this method returns True if the schema can be dropped
 
private bool checkExistence ()
 returns True if the method can detect that DB objects defined in the schema exist in the database More...
 
private bool checkFirstTimeInstall ()
 returns True if checkExistence() returns False
 
private bool checkUpdateSchema (bool force, reference initial_schema_info)
 this method returns True if the schema can be updated
 
 constructor (AbstractDatasource n_ds, *string dts, *string its, *hash opts)
 creates the object from the arguments More...
 
private doPostAlignment (Tables table_cache, bool first_time_install, *hash initial_schema_info)
 this method is called after schema structural alignment has been executed but before schema reference data management
 
private doTable (AbstractTable table, list rows, int upsert_strategy, bool delete_others, int verbose, reference sh)
 this method is called to perform schema reference data managment on the given table with the given data
 
 drop (bool force=False, int verbose=0)
 executes a schema drop operation in the database
 
*hash getColumnOptions ()
 returns column options More...
 
private *hash getColumnOptionsImpl ()
 returns column options More...
 
*hash getCreateOnlyReferenceData ()
 returns a hash of "create-only reference data", describing data that is written to the table when the table is created More...
 
private *hash getCreateOnlyReferenceDataImpl ()
 returns a hash of "create-only reference data", describing data that is written to the table when the table is created More...
 
*hash getCreationOptions ()
 returns schema creation options More...
 
AbstractDatabase getDatabase ()
 returns the AbstractDatabase object used for the schema
 
AbstractDatasource getDatasource ()
 returns the datasource used for the schema
 
*hash getFunctions ()
 returns function definitions More...
 
private *hash getFunctionsImpl ()
 returns function definitions More...
 
private *hash getGenericOptionsImpl ()
 returns schema creation options More...
 
*hash getIndexOptions ()
 returns index options More...
 
private *hash getIndexOptionsImpl ()
 returns index options More...
 
*hash getInsertOnlyReferenceData ()
 returns a hash of "create-only reference data", describing data that will only be inserted if missing, otherwise existing rows with changed data are left unchanged More...
 
private *hash getInsertOnlyReferenceDataImpl ()
 returns a hash of "insert-only reference data", describing data that will only be inserted if missing, otherwise existing rows with changed data are left unchanged More...
 
*hash getMaterializedViews ()
 returns materialized view definitions More...
 
private *hash getMaterializedViewsImpl ()
 returns materialized view definitions More...
 
string getName ()
 returns the name of the schema
 
abstract private string getNameImpl ()
 returns the version of the schema
 
*hash getPackages ()
 returns (Oracle) package definitions More...
 
private *hash getPackagesImpl ()
 returns (Oracle) package definitions More...
 
*hash getProcedures ()
 returns stored procedure definitions More...
 
private *hash getProceduresImpl ()
 returns stored procedure definitions More...
 
*hash getReferenceDataHash ()
 returns a hash of "normal reference data", describing data that must appear in the target table, however additional rows are also acceptable More...
 
private *hash getReferenceDataHashImpl ()
 returns a hash of "normal reference data", describing data that must appear in the target table, however additional rows are also acceptable More...
 
*hash getSequences ()
 returns sequence definitions More...
 
private *hash getSequencesImpl ()
 returns sequence definitions More...
 
*hash getStrictReferenceDataHash ()
 returns a hash of "strict reference data", describing the only data that can appear in the target table More...
 
private *hash getStrictReferenceDataHashImpl ()
 returns a hash of "strict reference data", describing the only data that can appear in the target table More...
 
*hash getTables ()
 returns table definitions More...
 
private *hash getTablesImpl ()
 returns table definitions More...
 
*hash getTypes ()
 returns type definitions More...
 
private *hash getTypesImpl ()
 returns type definitions More...
 
private int getUpsertStrategy (bool first_time_install)
 this method is called to return the upsert strategy before schema reference data management
 
string getVersion ()
 returns the version of the schema
 
abstract private string getVersionImpl ()
 returns the version of the schema
 
 log (string fmt)
 outputs a log message More...
 
 logpf (string fmt)
 outputs a log message prefixed with the schema name More...
 
 logProgress (string str)
 outputs a log message without any newline More...
 
private postDataActions (bool first_time_install)
 this method is called after schema reference data has been managed
 

Private Attributes

string version_column
 the name of the column containing the version string
 
string version_table
 the name of the table containing the version string
 
hash version_where
 a where clause hash defining the row where the schema version string is located
 

Additional Inherited Members

- Static Public Member Functions inherited from Schema::AbstractSchema
static hash combineOptions (*hash h)
 combines option hashes into a single target option hash
 
static list getRows (*softlist l)
 returns a list of hashes from a list of lists where the first list element in the top-level list is a list of column names, and subsequent lists are column values More...
 

Detailed Description

this class extends Schema::AbstractSchema by providing version logic based on a schema version string contained within the schema itself

the location of the version string is defined by the following abstract methods that must be reimplemented in subclasses:

Note
the schema version string (as designated by the return values of the methods listed above) must be included in reference data as returned by either getStrictReferenceDataHashImpl() or getReferenceDataHashImpl().

Member Function Documentation

◆ constructor()

Schema::AbstractVersionedSchema::constructor ( AbstractDatasource  ds,
*string  dts,
*string  its,
*hash  opts 
)

creates the object based on the arguments giving the location of the schema

Parameters
dsthe datasource for the schema
dtsan optional data tablespace name for the schema
itsan optional index tablespace name for the schema
optsoptions for SqlUtil::Database::constructor()

◆ getVersionColumn()

private string Schema::AbstractVersionedSchema::getVersionColumn ( )

returns the name of the column holding the schema version string by calling getVersionColumnImpl()

this function wraps getVersionColumnImpl(); for forwards-compatibility, do not override this method in subclasses, instead re-implement getVersionColumnImpl()

◆ getVersionTable()

private string Schema::AbstractVersionedSchema::getVersionTable ( )

returns the name of the table holding the schema version string by calling getVersionTableImpl()

this function wraps getVersionTableImpl(); for forwards-compatibility, do not override this method in subclasses, instead re-implement getVersionTableImpl()

◆ getVersionWhere()

private hash Schema::AbstractVersionedSchema::getVersionWhere ( )

returns the where clause hash defining the row where the schema version string is located by calling getVersionWhereImpl()

this function wraps getVersionWhereImpl(); for forwards-compatibility, do not override this method in subclasses, instead re-implement getVersionWhereImpl()