OpenSim
|
Public Member Functions | |
Migration () | |
Have the parameterless constructor just so we can specify it as a generic parameter with the new() constraint. Currently this is only used in the tests. A Migration instance created this way must be then initialized with Initialize(). Regular creation should be through the parameterized constructors. More... | |
Migration (DbConnection conn, Assembly assem, string subtype, string type) | |
Migration (DbConnection conn, Assembly assem, string type) | |
void | Initialize (DbConnection conn, Assembly assem, string type, string subtype) |
Must be called after creating with the parameterless constructor. NOTE that the Migration class now doesn't access database in any way during initialization. Specifically, it won't check if the [migrations] table exists. Such checks are done later: automatically on Update(), or you can explicitly call InitMigrationsTable(). More... | |
void | InitMigrationsTable () |
void | Update () |
Protected Member Functions | |
virtual void | ExecuteScript (DbConnection conn, string[] script) |
Executes a script, possibly in a database-specific way. It can be redefined for a specific DBMS, if necessary. Specifically, to avoid problems with proc definitions in MySQL, we must use MySqlScript class instead of just DbCommand. We don't want to bring MySQL references here, so instead define a MySQLMigration class in OpenSim.Data.MySQL More... | |
void | ExecuteScript (DbConnection conn, string sql) |
void | ExecuteScript (string sql) |
void | ExecuteScript (string[] script) |
virtual int | FindVersion (DbConnection conn, string type) |
Protected Attributes | |
string | _type |
DbConnection | _conn |
Assembly | _assem |
Properties | |
int | Version [get, set] |
The Migration theory is based on the ruby on rails concept. Each database driver is going to be allowed to have files in Resources that specify the database migrations. They will be of the form:
001_Users.sql 002_Users.sql 003_Users.sql 001_Prims.sql 002_Prims.sql ...etc...
When a database driver starts up, it specifies a resource that needs to be brought up to the current revision. For instance:
Migration um = new Migration(DbConnection, Assembly, "Users"); um.Update();
This works out which version Users is at, and applies all the revisions past it to it. If there is no users table, all revisions are applied in order. Consider each future migration to be an incremental roll forward of the tables in question.
Assembly must be specifically passed in because otherwise you get the assembly that Migration.cs is part of, and what you really want is the assembly of your database class.
Definition at line 70 of file Migration.cs.
|
inline |
Have the parameterless constructor just so we can specify it as a generic parameter with the new() constraint. Currently this is only used in the tests. A Migration instance created this way must be then initialized with Initialize(). Regular creation should be through the parameterized constructors.
Definition at line 85 of file Migration.cs.
|
inline |
Definition at line 89 of file Migration.cs.
|
inline |
Definition at line 94 of file Migration.cs.
|
inlineprotectedvirtual |
Executes a script, possibly in a database-specific way. It can be redefined for a specific DBMS, if necessary. Specifically, to avoid problems with proc definitions in MySQL, we must use MySqlScript class instead of just DbCommand. We don't want to bring MySQL references here, so instead define a MySQLMigration class in OpenSim.Data.MySQL
conn | |
script | Array of strings, one-per-batch (often just one) |
Reimplemented in OpenSim.Data.PGSQL.PGSQLMigration, and OpenSim.Data.MySQL.MySqlMigration.
Definition at line 140 of file Migration.cs.
|
inlineprotected |
Definition at line 160 of file Migration.cs.
|
inlineprotected |
Definition at line 165 of file Migration.cs.
|
inlineprotected |
Definition at line 170 of file Migration.cs.
|
inlineprotectedvirtual |
Reimplemented in OpenSim.Data.PGSQL.PGSQLMigration.
Definition at line 238 of file Migration.cs.
|
inline |
Must be called after creating with the parameterless constructor. NOTE that the Migration class now doesn't access database in any way during initialization. Specifically, it won't check if the [migrations] table exists. Such checks are done later: automatically on Update(), or you can explicitly call InitMigrationsTable().
conn | |
assem | |
subtype | |
type |
Definition at line 108 of file Migration.cs.
|
inline |
Definition at line 118 of file Migration.cs.
|
inline |
Definition at line 175 of file Migration.cs.
|
protected |
Definition at line 76 of file Migration.cs.
|
protected |
Definition at line 75 of file Migration.cs.
|
protected |
Definition at line 74 of file Migration.cs.
|
getset |
Definition at line 224 of file Migration.cs.