128 hash<GenericColumnInfo>
c_int(
bool notnull = False, *
string comment);
138 hash<GenericColumnInfo>
c_int(
string comment);
147 hash<GenericColumnInfo>
c_varchar(
int size,
bool notnull = False, *
string comment);
154 hash<GenericColumnInfo>
c_varchar(
int size,
string comment);
163 hash<GenericColumnInfo>
c_char(
int size,
bool notnull = False, *
string comment);
170 hash<GenericColumnInfo>
c_char(
int size,
string comment);
180 hash<GenericColumnInfo>
c_date(
bool notnull = False, *
string comment);
188 hash<GenericColumnInfo>
c_date(
string comment);
198 hash<GenericColumnInfo>
c_timestamp(
bool notnull = False, *
string comment);
217 hash<GenericColumnInfo>
c_number(
bool notnull = False, *
string comment);
229 hash<GenericColumnInfo>
c_number(
int size,
int scale,
bool notnull = False, *
string comment);
240 hash<GenericColumnInfo>
c_number(
int size,
bool notnull = False, *
string comment);
249 hash<GenericColumnInfo>
c_number(
int size,
string comment);
259 hash<GenericColumnInfo>
c_blob(
bool notnull = False, *
string comment);
267 hash<GenericColumnInfo>
c_blob(
string comment);
277 hash<GenericColumnInfo>
c_clob(
bool notnull = False, *
string comment);
285 hash<GenericColumnInfo>
c_clob(
string comment);
311 int change_count = 0;
315 list<string> sql_cache = ();
330 AbstractDatabase::AC_Create: True,
331 AbstractDatabase::AC_Add: True,
332 AbstractDatabase::AC_Insert: True,
347 infoCallback(
string str,
int ac, *
string type, *
string name, *
string table, *
string new_name, *
string info);
518 int align(
bool force = False,
int verbose = 0,
bool do_msgs = True);
534 hash<SchemaAlignmentInfo>
alignWithInfo(
bool force = False,
int verbose = 0,
bool do_msgs = True);
556 drop(
bool force = False,
int verbose = 0,
bool do_msgs = True);
816 doPostAlignment(Tables table_cache,
bool first_time_install, *hash<auto> initial_schema_info,
int verbose);
822 doPostAlignment(Tables table_cache,
bool first_time_install, *hash<auto> initial_schema_info);
834 postDataActions(Tables table_cache,
bool first_time_install, *hash<auto> initial_schema_info,
int verbose);
845 private doTable(AbstractTable table, list rows,
int upsert_strategy,
bool delete_others,
int verbose,
846 reference<hash<string, int>> sh) {
853 hash<string, int> tsh;
854 code cb = (
string table_name, hash row,
int result);
857 table.upsertFromIterator(
AbstractSchema::getRows(rows).iterator(), upsert_strategy, (
"delete_others": delete_others,
"info_callback": cb));
the AbstractSchema class is a base class to assist with automatic schema management
Definition: Schema.qm.dox.h:408
doPostAlignment(Tables table_cache, bool first_time_install, *hash< auto > initial_schema_info, int verbose)
this method is called after schema structural alignment has been executed but before schema reference...
doPostAlignment(Tables table_cache, bool first_time_install, *hash< auto > initial_schema_info)
this method is called after schema structural alignment has been executed but before schema reference...
hash schema
the schema template, as assembled from method callbacks providing schema element definitions
Definition: Schema.qm.dox.h:418
string getVersion()
returns the version of the schema
constructor(Qore::SQL::AbstractDatasource ds, *hash< SchemaOptionInfo > opts)
creates the object from the arguments
*hash< auto > getTablesImpl()
returns table definitions
hash callback_opts
callback options plus all options
Definition: Schema.qm.dox.h:440
string drv
the name of the database driver
Definition: Schema.qm.dox.h:432
abstract string getNameImpl()
returns the name of the schema
static list getRows(*softlist< auto > l)
returns a list of hashes from a list of lists where the first list element in the top-level list is a...
*hash< auto > getPackages()
returns (Oracle) package definitions
SqlUtil::Database db
the Database object for the schema
Definition: Schema.qm.dox.h:435
static hash combineOptions(*hash h)
combines option hashes into a single target option hash
*hash< auto > getMaterializedViewsImpl()
returns materialized view definitions
*hash< auto > getReferenceDataHashImpl()
returns a hash of "normal reference data", describing data that must appear in the target table,...
Qore::SQL::AbstractDatasource ds
the datasource for the schema
Definition: Schema.qm.dox.h:430
*string data_ts
explicit data tablespace name
Definition: Schema.qm.dox.h:446
*hash< auto > getTypesImpl()
returns type definitions
*hash< auto > getMaterializedViews()
returns materialized view definitions
constructor(Qore::SQL::AbstractDatasource ds, *string dts, *string its, *hash opts)
creates the object from the arguments
logpf(string fmt)
outputs a log message prefixed with the schema name
postDataActions(Tables table_cache, bool first_time_install, *hash< auto > initial_schema_info, int verbose)
this method is called after schema reference data has been managed
*hash creation_options
creation options, as provided by getCreationOptions()
Definition: Schema.qm.dox.h:423
*hash< auto > getReferenceDataHash()
returns a hash of "normal reference data", describing data that must appear in the target table,...
int align(bool force=False, int verbose=0, bool do_msgs=True)
executes a schema alignment action on the database with the current schema template
*hash< auto > getFunctionsImpl()
returns function definitions
bool checkDropSchema(bool force)
this method returns True if the schema can be dropped
*hash< auto > getTables()
returns table definitions
hash< SchemaAlignmentInfo > alignWithInfo(bool force=False, int verbose=0, bool do_msgs=True)
executes a schema alignment action on the database with the current schema template
*hash< auto > getTypes()
returns type definitions
*hash< auto > getGenericOptionsImpl()
returns schema creation options
*hash< auto > getProcedures()
returns stored procedure definitions
private doTable(AbstractTable table, list rows, int upsert_strategy, bool delete_others, int verbose, reference< hash< string, int > > sh)
this method is called to perform schema reference data managment on the given table with the given da...
Definition: Schema.qm.dox.h:845
hash pure_callback_opts
just callback options
Definition: Schema.qm.dox.h:438
init(Qore::SQL::AbstractDatasource ds, *hash< SchemaOptionInfo > opts)
shared constructor initialization
*hash column_options
column options, as provided by getColumnOptions()
Definition: Schema.qm.dox.h:425
code info_callback
the info callback for schema operations; can be used for explicit logging
Definition: Schema.qm.dox.h:443
*hash< auto > getCreateOnlyReferenceData()
returns a hash of "create-only reference data", describing data that is written to the table when the...
*string index_ts
explicit index tablespace name
Definition: Schema.qm.dox.h:449
*hash< auto > getCreationOptions()
returns schema creation options
string version
the version of the schema
Definition: Schema.qm.dox.h:415
postDataActions(bool first_time_install)
this method is called after schema reference data has been managed
*hash< auto > getColumnOptionsImpl()
returns column options
Qore::SQL::AbstractDatasource getDatasource()
returns the datasource used for the schema
int getUpsertStrategy(bool first_time_install)
this method is called to return the upsert strategy before schema reference data management
*hash index_options
index options, as provided by getIndexOptions()
Definition: Schema.qm.dox.h:421
*hash< auto > getIndexOptions()
returns index options
bool checkFirstTimeInstall()
returns True if checkExistence() returns False
*hash< auto > getColumnOptions()
returns column options
*hash< auto > getProceduresImpl()
returns stored procedure definitions
*hash< auto > getIndexOptionsImpl()
returns index options
*hash< auto > getPackagesImpl()
returns (Oracle) package definitions
abstract string getVersionImpl()
returns the version of the schema
SqlUtil::AbstractDatabase getDatabase()
returns the AbstractDatabase object used for the schema
*hash< auto > getFunctions()
returns function definitions
bool checkExistence()
returns True if the method can detect that DB objects defined in the schema exist in the database
*hash< auto > getInsertOnlyReferenceDataImpl()
returns a hash of "insert-only reference data", describing data that will only be inserted if missing...
string getName()
returns the name of the schema
*hash< auto > getCreateOnlyReferenceDataImpl()
returns a hash of "create-only reference data", describing data that is written to the table when the...
*hash all_options
combined creation and column options
Definition: Schema.qm.dox.h:427
*hash< auto > getInsertOnlyReferenceData()
returns a hash of "create-only reference data", describing data that will only be inserted if missing...
*hash< auto > getSequences()
returns sequence definitions
string name
the name of the schema
Definition: Schema.qm.dox.h:413
*hash< auto > getSequencesImpl()
returns sequence definitions
SchemaCallbackHelper alignIntern(bool force=False, int verbose=0, bool do_msgs=True)
executes a schema alignment action on the database with the current schema template
drop(bool force=False, int verbose=0, bool do_msgs=True)
executes a schema drop operation in the database
*hash< auto > getStrictReferenceDataHashImpl()
returns a hash of "strict reference data", describing the only data that can appear in the target tab...
*hash< auto > getStrictReferenceDataHash()
returns a hash of "strict reference data", describing the only data that can appear in the target tab...
logProgress(string str)
outputs a log message without any newline
bool checkUpdateSchema(bool force, reference< hash< auto > > initial_schema_info)
this method returns True if the schema can be updated
log(string fmt)
outputs a log message
this class extends Schema::AbstractSchema by providing version logic based on a schema version string...
Definition: Schema.qm.dox.h:883
bool checkDowngrade(string current_version)
this method is called if the current schema version is greater than the target version; returns True ...
string version_column
the name of the column containing the version string
Definition: Schema.qm.dox.h:890
string getVersionTable()
returns the name of the table holding the schema version string by calling getVersionTableImpl()
abstract hash getVersionWhereImpl()
returns the where clause hash defining the row where the schema version string is located
bool checkUpdateSchema(bool force, reference< hash< auto > > initial_schema_info)
this method returns True if the schema can be updated
abstract string getVersionColumnImpl()
returns the name of the column holding the schema version string
string getVersionColumn()
returns the name of the column holding the schema version string by calling getVersionColumnImpl()
*softstring getSchemaVersion()
returns the existing schema version or NOTHING if not present
hash getVersionWhere()
returns the where clause hash defining the row where the schema version string is located by calling ...
bool checkUpgrade(string current_version)
this method is called if the current schema version is less than the target version; returns True if ...
hash version_where
a where clause hash defining the row where the schema version string is located
Definition: Schema.qm.dox.h:892
abstract string getVersionTableImpl()
returns the name of the table holding the schema version string
constructor(Qore::SQL::AbstractDatasource ds, *string dts, *string its, *hash opts)
creates the object based on the arguments giving the location of the schema
bool checkDropSchema(bool force)
this method returns True if the schema can be dropped
string version_table
the name of the table containing the version string
Definition: Schema.qm.dox.h:888
this class provides callback support for schema operations
Definition: Schema.qm.dox.h:306
const CreateActionMap
Map of create actions.
Definition: Schema.qm.dox.h:329
infoCallback(string str, int ac, *string type, *string name, *string table, *string new_name, *string info)
this is the informational callback method for schema operations
bool created
Set to True if only creations / additions were made.
Definition: Schema.qm.dox.h:326
constructor(AbstractSchema sc, int v=0)
creates the callback object from the given arguments
nothing sqlForceCallback(string str)
this is the SQL callback method for forced schema operations
sqlCallback(string str)
this is the SQL callback method for schema operations
hash< string, int > change_map
Change map; action code -> count.
Definition: Schema.qm.dox.h:318
hash< SchemaAlignmentInfo > getInfo()
Returns information about schema changes made.
hash< auto > getCallbacks(bool force=False)
returns a callback option hash usable with SqlUtil schema operations
hash< string, int > data_change_map
Summary map for data changes; upsert action code -> count.
Definition: Schema.qm.dox.h:321
this namespace contains all public definitions in the Schema module
Definition: Schema.qm.dox.h:113
hash< GenericColumnInfo > c_blob(bool notnull=False, *string comment)
returns a column hash for a BLOB column
hash< GenericColumnInfo > c_date(bool notnull=False, *string comment)
returns a column hash for a DATE column
hash< GenericColumnInfo > c_clob(bool notnull=False, *string comment)
returns a column hash for a CLOB column
hash< GenericColumnInfo > c_number(bool notnull=False, *string comment)
returns a column hash for a NUMBER or NUMERIC column
hash< GenericColumnInfo > c_timestamp(bool notnull=False, *string comment)
returns a column hash for a TIMESTAMP column
hash< GenericColumnInfo > c_varchar(int size, bool notnull=False, *string comment)
returns a column hash for a VARCHAR column
hash< GenericColumnInfo > c_char(int size, bool notnull=False, *string comment)
returns a column hash for a CHAR column
hash< GenericColumnInfo > c_int(bool notnull=False, *string comment)
returns a column hash for an INT column
const C_NULL
Helper constant for column hash functions with "NULL" constraint for better readability.
Definition: Schema.qm.dox.h:115
const C_NOT_NULL
Helper constant for column hash functions with "NOT NULL" constraint for better readability.
Definition: Schema.qm.dox.h:117
Provides information on schema changes.
Definition: Schema.qm.dox.h:289
bool created
Set to True if only creations / additions were made.
Definition: Schema.qm.dox.h:293
*hash< string, int > change_map
Change map; action code -> count.
Definition: Schema.qm.dox.h:299
int num_changes
The total number of changes made.
Definition: Schema.qm.dox.h:296
*hash< string, int > data_change_map
Summary map for data changes; upsert action code -> count.
Definition: Schema.qm.dox.h:302
Schema option hash definitions.
Definition: Schema.qm.dox.h:364
*string data_ts
explicit data tablespace name
Definition: Schema.qm.dox.h:366
*hash< auto > db_opts
options for SqlUtil::Database::constructor()
Definition: Schema.qm.dox.h:372
*string index_ts
explicit index tablespace name
Definition: Schema.qm.dox.h:369