DDL

DDL API in my ORM

  1. TableManipulationInterface

Method:

  • alterTable:

    • tableName: The name of the table to be altered (string).

    • getQueryString: Boolean value indicating whether to get the query string (boolean).

    • Returns: AlterTableResultInterface, which includes various methods for table manipulation.

  1. AlterTableResultInterface

Methods:

  1. addColumn:

    • parameters: An object with parameters for adding a column, including columnName and options (depending on the database).

  2. deleteColumn:

    • parameters: An object with parameters for deleting a column, including columnName (depending on the database).

  3. addDefaultValue:

    • parameters: An object with parameters for adding a default value, including columnName and value.

  4. dropDefaultValue:

    • parameters: An object with parameters for removing a default value, including columnName.

  5. changeDataTypeOfColumn:

    • parameters: An object with parameters for changing the data type of a column, including columnName, dataType, length, precision, scale.

  6. addNotNullToColumn:

    • parameters: An object with parameters for adding a NOT NULL constraint, including columnName.

  7. dropNotNullFromColumn:

    • parameters: An object with parameters for removing a NOT NULL constraint, including columnName.

  8. addUniqueToColumn:

    • parameters: An object with parameters for adding a unique constraint, including columnName and optional constraintName (depending on the database).

  9. renameColumn:

    • parameters: An object with parameters for renaming a column, including columnName and futureColumnName.

  10. renameTable:

    • parameters: An object with parameters for renaming a table, including tableName.

  11. addCheckConstraintToColumn:

    • parameters: An object with parameters for adding a check constraint, including columnName, check, and optional nameOfCheckConstraint.

  12. deleteCheckConstraintOfColumn:

    • parameters: An object with parameters for deleting a check constraint, including columnName.

  13. dropConstraint:

    • parameters: An object with parameters for removing a constraint, including constraintName.

  14. deleteUniqueFromColumn:

    • parameters: An object with parameters for removing a unique constraint, including columnName.

  15. addPrimaryGeneratedColumn:

    • parameters: An object with parameters for adding an auto-generated column, including columnName, type, and optional additional parameters (depending on the database).

  16. addForeignKey:

    • parameters: An object with parameters for adding a foreign key, including foreignKey, referencedTable, referencedColumn.

  17. addComputedColumn:

    • parameters: An object with parameters for adding a computed column, including dataType, calculate, and optional additional parameters (depending on the database).

  18. dropTable:

    • parameters: An object with parameters for removing a table, including optional drop type and existence check parameters (depending on the database).

  19. Method Parameters

  20. AddColumnInterface

    • columnName: The name of the column (string).

    • options: Column options, such as data type, length, uniqueness, etc. (depends on the database).

  21. ColumnOptionsInterface

    • Postgres: dataType, nullable, length, check, nameOfCheckConstraint, defaultValue, unique, nullsNotDistinct.

    • MySQL: dataType, nullable, length, check, nameOfCheckConstraint, defaultValue, unique, displayWidth, isUnsigned, isZerofill, isAutoIncrement, values, scale, precision.

  22. DeleteColumnInterface

    • Postgres: columnName, optional isCascade.

    • MySQL: columnName.

  23. AddDefaultValueInterface

    • columnName: The name of the column (string).

    • value: The default value (string, number, or boolean).

  24. DropDefaultValueInterface

    • columnName: The name of the column (string).

  25. ChangeColumnDatatypeInterface

    • columnName: The name of the column (string).

    • dataType: The new data type (string).

    • length, precision, scale: Additional data type parameters (strings).

  26. AddNotNullToColumnInterface

    • columnName: The name of the column (string).

  27. DropNotNullFromColumnInterface

    • columnName: The name of the column (string).

  28. AddUniqueToColumnInterface

    • Postgres: columnName, optional constraintName.

    • MySQL: columnName.

  29. RenameColumnInterface

    • columnName: The name of the existing column (string).

    • futureColumnName: The new name of the column (string).

  30. RenameTableInterface

    • tableName: The name of the table (string).

  31. AddCheckConstraintToColumnInterface

    • columnName: The name of the column (string).

    • check: The check expression (string).

    • nameOfCheckConstraint: The name of the constraint (optional, string).

  32. DeleteCheckConstraintOfColumnInterface

    • columnName: The name of the column (string).

  33. DropConstraintInterface

    • constraintName: The name of the constraint (string).

  34. DeleteUniqueFromColumnInterface

    • columnName: The name of the column (string).

  35. AddPrimaryGeneratedColumnInterface

    • Postgres: columnName, type, optional startWith, incrementBy, minValue, maxValue, isCycle, cache, ownedBy, restartWith, noOrder.

    • MySQL: columnName, type, optional startWith, incrementBy, minValue, maxValue, isCycle, cache, ownedBy.

  36. AddForeignKeyInterface

    • foreignKey: The name of the foreign key (string).

    • referencedTable: The name of the table referenced by the key (string).

    • referencedColumn: The name of the column referenced by the key (string).

  37. AddComputedColumnInterface

    • Postgres: dataType, calculate.

    • MySQL: dataType, calculate, optional stored.

  38. DropTableInterface

    • Postgres: Optional type (CASCADE or RESTRICT) and ifExist.

    • MySQL: Optional ifExist.

Last updated