1- using System ;
1+ using System ;
22using System . Data ;
33using System . Globalization ;
4+ using DbUp . Engine ;
45using DbUp . Engine . Output ;
56using DbUp . Engine . Transactions ;
67using DbUp . Support ;
78
89namespace DbUp . Oracle
910{
11+ /// <summary>
12+ /// An implementation of the <see cref="IJournal"/> interface which tracks version numbers for an
13+ /// Oracle database using a table called SchemaVersions.
14+ /// </summary>
1015 public class OracleTableJournal : TableJournal
1116 {
1217 bool journalExists ;
@@ -22,8 +27,12 @@ public OracleTableJournal(Func<IConnectionManager> connectionManager, Func<IUpgr
2227 {
2328 }
2429
30+ /// <summary>
31+ /// English culture info used for formatting.
32+ /// </summary>
2533 public static CultureInfo English = new CultureInfo ( "en-US" , false ) ;
2634
35+ /// <inheritdoc/>
2736 protected override string CreateSchemaTableSql ( string quotedPrimaryKeyName )
2837 {
2938 var fqSchemaTableName = UnquotedSchemaTableName ;
@@ -37,12 +46,20 @@ scriptname VARCHAR2(255) NOT NULL,
3746 )" ;
3847 }
3948
49+ /// <summary>
50+ /// Creates the SQL for the sequence used by the schema table.
51+ /// </summary>
52+ /// <returns>The SQL statement to create the sequence.</returns>
4053 protected string CreateSchemaTableSequenceSql ( )
4154 {
4255 var fqSchemaTableName = UnquotedSchemaTableName ;
4356 return $@ " CREATE SEQUENCE { fqSchemaTableName } _sequence";
4457 }
4558
59+ /// <summary>
60+ /// Creates the SQL for the trigger used by the schema table.
61+ /// </summary>
62+ /// <returns>The SQL statement to create the trigger.</returns>
4663 protected string CreateSchemaTableTriggerSql ( )
4764 {
4865 var fqSchemaTableName = UnquotedSchemaTableName ;
@@ -57,24 +74,32 @@ FOR EACH ROW
5774 " ;
5875 }
5976
77+ /// <inheritdoc/>
6078 protected override string GetInsertJournalEntrySql ( string scriptName , string applied )
6179 {
6280 var unquotedSchemaTableName = UnquotedSchemaTableName . ToUpper ( English ) ;
6381 return $ "insert into { unquotedSchemaTableName } (ScriptName, Applied) values (:" + scriptName . Replace ( "@" , "" ) + ",:" + applied . Replace ( "@" , "" ) + ")" ;
6482 }
6583
84+ /// <inheritdoc/>
6685 protected override string GetJournalEntriesSql ( )
6786 {
6887 var unquotedSchemaTableName = UnquotedSchemaTableName . ToUpper ( English ) ;
6988 return $ "select scriptname from { unquotedSchemaTableName } order by scriptname";
7089 }
7190
91+ /// <inheritdoc/>
7292 protected override string DoesTableExistSql ( )
7393 {
7494 var unquotedSchemaTableName = UnquotedSchemaTableName . ToUpper ( English ) ;
7595 return $ "select 1 from user_tables where table_name = '{ unquotedSchemaTableName } '";
7696 }
7797
98+ /// <summary>
99+ /// Gets the command to create the sequence for the schema table.
100+ /// </summary>
101+ /// <param name="dbCommandFactory">Factory to create database commands.</param>
102+ /// <returns>A command to create the sequence.</returns>
78103 protected IDbCommand GetCreateTableSequence ( Func < IDbCommand > dbCommandFactory )
79104 {
80105 var command = dbCommandFactory ( ) ;
@@ -83,6 +108,11 @@ protected IDbCommand GetCreateTableSequence(Func<IDbCommand> dbCommandFactory)
83108 return command ;
84109 }
85110
111+ /// <summary>
112+ /// Gets the command to create the trigger for the schema table.
113+ /// </summary>
114+ /// <param name="dbCommandFactory">Factory to create database commands.</param>
115+ /// <returns>A command to create the trigger.</returns>
86116 protected IDbCommand GetCreateTableTrigger ( Func < IDbCommand > dbCommandFactory )
87117 {
88118 var command = dbCommandFactory ( ) ;
@@ -91,6 +121,7 @@ protected IDbCommand GetCreateTableTrigger(Func<IDbCommand> dbCommandFactory)
91121 return command ;
92122 }
93123
124+ /// <inheritdoc/>
94125 public override void EnsureTableExistsAndIsLatestVersion ( Func < IDbCommand > dbCommandFactory )
95126 {
96127 if ( ! journalExists && ! DoesTableExist ( dbCommandFactory ) )
0 commit comments