2025-01-24 13:26:48 +01:00
|
|
|
<?php
|
|
|
|
namespace DatabaseHelper\interfaces;
|
|
|
|
|
2025-01-27 19:35:17 +01:00
|
|
|
interface DatabaseHelper
|
2025-01-24 13:26:48 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Initializes a Table instance to represent a database table.
|
|
|
|
* This instance can be used to define and finalĺy create database tables.
|
|
|
|
*
|
|
|
|
* @param string $tableName The name of the table.
|
2025-01-27 19:35:17 +01:00
|
|
|
* @return TableBlueprint Generated Table instance.
|
2025-01-24 13:26:48 +01:00
|
|
|
*/
|
2025-01-27 19:35:17 +01:00
|
|
|
public static function makeTable(string $tableName): TableBlueprint;
|
2025-01-24 13:26:48 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes a Migration instance for managing database migrations for the specified table.
|
|
|
|
*
|
2025-01-27 19:35:17 +01:00
|
|
|
* @param TableBlueprint $table The table for which the migration is being created.
|
|
|
|
* @return MigrationBlueprint Generated Migration instance.
|
2025-01-24 13:26:48 +01:00
|
|
|
*/
|
2025-01-27 19:35:17 +01:00
|
|
|
public static function makeMigration(TableBlueprint $table): MigrationBlueprint;
|
2025-01-24 13:26:48 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes a Query instance to perform operations on the specified tables.
|
|
|
|
* When multiple tables are provided, they will be joined automatically for the query.
|
|
|
|
*
|
2025-01-27 19:35:17 +01:00
|
|
|
* @param TableBlueprint ...$tables One or more Table instances.
|
|
|
|
* @return QueryBuilder Generated Query instance.
|
2025-01-24 13:26:48 +01:00
|
|
|
*/
|
2025-01-27 19:35:17 +01:00
|
|
|
public static function makeQuery(TableBlueprint ...$tables): QueryBuilder;
|
2025-01-24 13:26:48 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes a Query instance specifically for inserting data into the specified tables.
|
|
|
|
* When multiple tables are provided, they will be joined automatically for the insertion.
|
|
|
|
*
|
2025-01-27 19:35:17 +01:00
|
|
|
* @param TableBlueprint ...$tables One or more Table instances.
|
2025-01-28 16:53:37 +01:00
|
|
|
* @return InsertionBuilder Generated Query instance.
|
|
|
|
*/
|
|
|
|
public static function makeInsertion(TableBlueprint ...$tables): InsertionBuilder;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes a Deletion instance to delete records from the specified tables.
|
|
|
|
* When multiple tables are provided, they will be joined automatically.
|
|
|
|
*
|
|
|
|
* @param TableBlueprint ...$tables One or more Table instances.
|
|
|
|
* @return DeletionBuilder Generated Deletion instance.
|
2025-01-24 13:26:48 +01:00
|
|
|
*/
|
2025-01-28 16:53:37 +01:00
|
|
|
public static function makeDeletion(TableBlueprint ...$tables): DeletionBuilder;
|
2025-01-24 13:26:48 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes an Update instance to perform updates on the specified tables.
|
|
|
|
* When multiple tables are provided, they will be joined automatically.
|
|
|
|
*
|
2025-01-27 19:35:17 +01:00
|
|
|
* @param TableBlueprint ...$tables One or more Table instances.
|
|
|
|
* @return UpdateBuilder Generated Update instance.
|
2025-01-24 13:26:48 +01:00
|
|
|
*/
|
2025-01-27 19:35:17 +01:00
|
|
|
public static function makeUpdate(TableBlueprint ...$tables): UpdateBuilder;
|
2025-01-24 13:26:48 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Standardizes table names by ensuring they include the WordPress database prefix.
|
|
|
|
* If the prefix is not already present, it will be added.
|
|
|
|
* The provided name(s) are passed by reference and will be modified directly.
|
|
|
|
*
|
|
|
|
* @param string &...$tableName The table names to standardize.
|
|
|
|
*/
|
2025-01-27 19:35:17 +01:00
|
|
|
public static function standardizeTableNames(string &...$tableName): void;
|
2025-01-24 13:26:48 +01:00
|
|
|
}
|