Added missed fun interface for upgrading table
This commit is contained in:
parent
a13a9858fb
commit
1c9eca6b5c
@ -2,7 +2,6 @@ package ru.landgrafhomyak.db.serdha0.api.module
|
|||||||
|
|
||||||
import ru.landgrafhomyak.db.serdha0.api.table.Table
|
import ru.landgrafhomyak.db.serdha0.api.table.Table
|
||||||
import ru.landgrafhomyak.db.serdha0.api.table.TableConstructor
|
import ru.landgrafhomyak.db.serdha0.api.table.TableConstructor
|
||||||
import ru.landgrafhomyak.db.serdha0.api.table.UpdateTableScope
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scope methods for upgrading [module template][ModuleTemplate].
|
* Scope methods for upgrading [module template][ModuleTemplate].
|
||||||
@ -39,7 +38,7 @@ public interface UpgradeModuleScope<omUE : Any> : CreateModuleScope {
|
|||||||
* @see UpgradeModuleScope.upgradeAndRenameTable
|
* @see UpgradeModuleScope.upgradeAndRenameTable
|
||||||
* @see UpgradeModuleScope.CreateTable
|
* @see UpgradeModuleScope.CreateTable
|
||||||
*/
|
*/
|
||||||
public fun upgradeTable(oldTable: Table<toUE, *>, upgrader: UpdateTableScope<tnUE, toUE>): tnUE
|
public fun upgradeTable(oldTable: Table<toUE, *>, upgrade: TableUpgrade<tnUE, toUE>): tnUE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ import ru.landgrafhomyak.db.serdha0.api.misc.DatabaseType
|
|||||||
import ru.landgrafhomyak.db.serdha0.api.misc.RowExpression
|
import ru.landgrafhomyak.db.serdha0.api.misc.RowExpression
|
||||||
|
|
||||||
|
|
||||||
public interface TableConstructor<TableUserExtension : Any> {
|
public interface TableConstructor<tUE : Any> {
|
||||||
public fun createTable(context: Scope<TableUserExtension>): TableUserExtension
|
public fun createTable(context: Scope<tUE>): tUE
|
||||||
|
|
||||||
|
|
||||||
public interface Scope<tUE : Any> {
|
public interface Scope<tUE : Any> {
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
package ru.landgrafhomyak.db.serdha0.api.table
|
||||||
|
|
||||||
|
import ru.landgrafhomyak.db.serdha0.api.misc.Column
|
||||||
|
import ru.landgrafhomyak.db.serdha0.api.misc.DatabaseType
|
||||||
|
|
||||||
|
|
||||||
|
public interface TableUpgrade<tnUE : Any, toUE : Any> {
|
||||||
|
public fun upgradeTable(context: Scope<tnUE, toUE>): tnUE
|
||||||
|
|
||||||
|
public interface Scope<tnUE : Any, toUE : Any> : TableConstructor.Scope<tnUE> {
|
||||||
|
public fun <RT, DT : DatabaseType<RT>> keepColumn(c: Column<RT, DT, toUE>): Column<RT, DT, tnUE>
|
||||||
|
public fun <RT, DT : DatabaseType<RT>> keepColumnUntilUpgraded(c: Column<RT, DT, toUE>): Column<RT, DT, tnUE>
|
||||||
|
public fun <RT, DT : DatabaseType<RT>> renameAndKeepColumn(c: Column<RT, DT, toUE>, newName: String): Column<RT, DT, tnUE>
|
||||||
|
public fun deleteColumn(c: Column<*, *, toUE>)
|
||||||
|
|
||||||
|
public fun keepIndex(i: Index<toUE>): Index<tnUE>
|
||||||
|
public fun renameAndKeepIndex(i: Index<toUE>, newName: String): Index<tnUE>
|
||||||
|
public fun deleteIndex(i: Index<toUE>)
|
||||||
|
|
||||||
|
public fun keepCheck(i: CheckConstraint<toUE>): CheckConstraint<tnUE>
|
||||||
|
public fun renameAndKeepCheck(i: CheckConstraint<toUE>, newName: String): CheckConstraint<tnUE>
|
||||||
|
public fun deleteCheck(i: CheckConstraint<toUE>)
|
||||||
|
|
||||||
|
public fun keepUniqueIndex(i: UniqueIndex<toUE>): UniqueIndex<tnUE>
|
||||||
|
public fun renameAndKeepUniqueIndex(i: UniqueIndex<toUE>, newName: String): UniqueIndex<tnUE>
|
||||||
|
public fun deleteUniqueIndex(i: UniqueIndex<toUE>)
|
||||||
|
|
||||||
|
public fun <RT, DT : DatabaseType<RT>> keepDefaultValue(c: Column<RT, DT, tnUE>, d: ColumnDefaultValue<toUE, RT>): ColumnDefaultValue<tnUE, RT>
|
||||||
|
public fun <RT, DT : DatabaseType<RT>> changeDefaultValue(c: Column<RT, DT, tnUE>, d: ColumnDefaultValue<toUE, RT>): ColumnDefaultValue<tnUE, RT>
|
||||||
|
public fun deleteDefaultValue(i: ColumnDefaultValue<toUE, *>)
|
||||||
|
|
||||||
|
public fun <ttUE : Any, RT, DT : DatabaseType<RT>> keepForeignRowReference(
|
||||||
|
frr: ForeignRowReference<toUE, ttUE, RT, DT>,
|
||||||
|
onDelete: ForeignRowReference.OnDelete? = null
|
||||||
|
): ForeignRowReference<toUE, ttUE, RT, DT>
|
||||||
|
|
||||||
|
public fun <ttoUE : Any, oRT, oDT : DatabaseType<oRT>, ttnUE : Any, nRT, nDT : DatabaseType<nRT>> keepForeignRowReferenceToUpdatedTable(
|
||||||
|
frr: ForeignRowReference<toUE, ttoUE, oRT, oDT>,
|
||||||
|
updatedType: nDT,
|
||||||
|
updatedTable: Table<ttnUE, ttoUE>,
|
||||||
|
onDelete: ForeignRowReference.OnDelete? = null
|
||||||
|
): ForeignRowReference<tnUE, ttnUE, nRT, nDT>
|
||||||
|
|
||||||
|
public fun <ttUE : Any, RT, DT : DatabaseType<RT>> renameAndKeepForeignRowReference(
|
||||||
|
frr: ForeignRowReference<toUE, ttUE, RT, DT>,
|
||||||
|
onDelete: ForeignRowReference.OnDelete? = null
|
||||||
|
): ForeignRowReference<tnUE, ttUE, RT, DT>
|
||||||
|
|
||||||
|
public fun <ttoUE : Any, oRT, oDT : DatabaseType<oRT>, ttnUE : Any, nRT, nDT : DatabaseType<nRT>> renameAndKeepForeignRowReferenceToUpdatedTable(
|
||||||
|
frr: ForeignRowReference<toUE, ttoUE, oRT, oDT>,
|
||||||
|
updatedType: nDT,
|
||||||
|
updatedTable: Table<ttnUE, ttoUE>,
|
||||||
|
onDelete: ForeignRowReference.OnDelete? = null
|
||||||
|
): ForeignRowReference<tnUE, ttnUE, nRT, nDT>
|
||||||
|
|
||||||
|
public fun deleteForeignRowReference(frr: ForeignRowReference<toUE, *, *, *>)
|
||||||
|
|
||||||
|
public fun <ttUE : Any, RT, DT : DatabaseType<RT>> keepForeignRowReferenceUntilUpgraded(
|
||||||
|
frr: ForeignRowReference<toUE, ttUE, RT, DT>,
|
||||||
|
onDelete: ForeignRowReference.OnDelete? = null
|
||||||
|
): ForeignRowReference<tnUE, ttUE, RT, DT>
|
||||||
|
|
||||||
|
public fun <ttoUE : Any, oRT, oDT : DatabaseType<oRT>, ttnUE : Any, nRT, nDT : DatabaseType<nRT>> keepForeignRowReferenceToUpdatedTableUntilUpgraded(
|
||||||
|
frr: ForeignRowReference<toUE, ttoUE, oRT, oDT>,
|
||||||
|
updatedType: nDT,
|
||||||
|
updatedTable: Table<ttnUE, ttoUE>,
|
||||||
|
onDelete: ForeignRowReference.OnDelete? = null
|
||||||
|
): ForeignRowReference<tnUE, ttnUE, nRT, nDT>
|
||||||
|
}
|
||||||
|
}
|
@ -1,67 +0,0 @@
|
|||||||
package ru.landgrafhomyak.db.serdha0.api.table
|
|
||||||
|
|
||||||
import ru.landgrafhomyak.db.serdha0.api.misc.Column
|
|
||||||
import ru.landgrafhomyak.db.serdha0.api.misc.DatabaseType
|
|
||||||
|
|
||||||
|
|
||||||
public interface UpdateTableScope<tnUE : Any, toUE : Any> : TableConstructor.Scope<tnUE> {
|
|
||||||
public fun <RT, DT : DatabaseType<RT>> keepColumn(c: Column<RT, DT, toUE>): Column<RT, DT, tnUE>
|
|
||||||
public fun <RT, DT : DatabaseType<RT>> keepColumnUntilUpgraded(c: Column<RT, DT, toUE>): Column<RT, DT, tnUE>
|
|
||||||
public fun <RT, DT : DatabaseType<RT>> renameAndKeepColumn(c: Column<RT, DT, toUE>, newName: String): Column<RT, DT, tnUE>
|
|
||||||
public fun deleteColumn(c: Column<*, *, toUE>)
|
|
||||||
|
|
||||||
public fun keepIndex(i: Index<toUE>): Index<tnUE>
|
|
||||||
public fun renameAndKeepIndex(i: Index<toUE>, newName: String): Index<tnUE>
|
|
||||||
public fun deleteIndex(i: Index<toUE>)
|
|
||||||
|
|
||||||
public fun keepCheck(i: CheckConstraint<toUE>): CheckConstraint<tnUE>
|
|
||||||
public fun renameAndKeepCheck(i: CheckConstraint<toUE>, newName: String): CheckConstraint<tnUE>
|
|
||||||
public fun deleteCheck(i: CheckConstraint<toUE>)
|
|
||||||
|
|
||||||
public fun keepUniqueIndex(i: UniqueIndex<toUE>): UniqueIndex<tnUE>
|
|
||||||
public fun renameAndKeepUniqueIndex(i: UniqueIndex<toUE>, newName: String): UniqueIndex<tnUE>
|
|
||||||
public fun deleteUniqueIndex(i: UniqueIndex<toUE>)
|
|
||||||
|
|
||||||
public fun <RT, DT : DatabaseType<RT>> keepDefaultValue(c: Column<RT, DT, tnUE>, d: ColumnDefaultValue<toUE, RT>): ColumnDefaultValue<tnUE, RT>
|
|
||||||
public fun <RT, DT : DatabaseType<RT>> changeDefaultValue(c: Column<RT, DT, tnUE>, d: ColumnDefaultValue<toUE, RT>): ColumnDefaultValue<tnUE, RT>
|
|
||||||
public fun deleteDefaultValue(i: ColumnDefaultValue<toUE, *>)
|
|
||||||
|
|
||||||
public fun <ttUE : Any, RT, DT : DatabaseType<RT>> keepForeignRowReference(
|
|
||||||
frr: ForeignRowReference<toUE, ttUE, RT, DT>,
|
|
||||||
onDelete: ForeignRowReference.OnDelete? = null
|
|
||||||
): ForeignRowReference<toUE, ttUE, RT, DT>
|
|
||||||
|
|
||||||
public fun <ttoUE : Any, oRT, oDT : DatabaseType<oRT>, ttnUE : Any, nRT, nDT : DatabaseType<nRT>> keepForeignRowReferenceToUpdatedTable(
|
|
||||||
frr: ForeignRowReference<toUE, ttoUE, oRT, oDT>,
|
|
||||||
updatedType: nDT,
|
|
||||||
updatedTable: Table<ttnUE, ttoUE>,
|
|
||||||
onDelete: ForeignRowReference.OnDelete? = null
|
|
||||||
): ForeignRowReference<tnUE, ttnUE, nRT, nDT>
|
|
||||||
|
|
||||||
public fun <ttUE : Any, RT, DT : DatabaseType<RT>> renameAndKeepForeignRowReference(
|
|
||||||
frr: ForeignRowReference<toUE, ttUE, RT, DT>,
|
|
||||||
onDelete: ForeignRowReference.OnDelete? = null
|
|
||||||
): ForeignRowReference<tnUE, ttUE, RT, DT>
|
|
||||||
|
|
||||||
public fun <ttoUE : Any, oRT, oDT : DatabaseType<oRT>, ttnUE : Any, nRT, nDT : DatabaseType<nRT>> renameAndKeepForeignRowReferenceToUpdatedTable(
|
|
||||||
frr: ForeignRowReference<toUE, ttoUE, oRT, oDT>,
|
|
||||||
updatedType: nDT,
|
|
||||||
updatedTable: Table<ttnUE, ttoUE>,
|
|
||||||
onDelete: ForeignRowReference.OnDelete? = null
|
|
||||||
): ForeignRowReference<tnUE, ttnUE, nRT, nDT>
|
|
||||||
|
|
||||||
public fun deleteForeignRowReference(frr: ForeignRowReference<toUE, *, *, *>)
|
|
||||||
|
|
||||||
public fun <ttUE : Any, RT, DT : DatabaseType<RT>> keepForeignRowReferenceUntilUpgraded(
|
|
||||||
frr: ForeignRowReference<toUE, ttUE, RT, DT>,
|
|
||||||
onDelete: ForeignRowReference.OnDelete? = null
|
|
||||||
): ForeignRowReference<tnUE, ttUE, RT, DT>
|
|
||||||
|
|
||||||
public fun <ttoUE : Any, oRT, oDT : DatabaseType<oRT>, ttnUE : Any, nRT, nDT : DatabaseType<nRT>> keepForeignRowReferenceToUpdatedTableUntilUpgraded(
|
|
||||||
frr: ForeignRowReference<toUE, ttoUE, oRT, oDT>,
|
|
||||||
updatedType: nDT,
|
|
||||||
updatedTable: Table<ttnUE, ttoUE>,
|
|
||||||
onDelete: ForeignRowReference.OnDelete? = null
|
|
||||||
): ForeignRowReference<tnUE, ttnUE, nRT, nDT>
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user