60 lines
2.2 KiB
PHP
60 lines
2.2 KiB
PHP
|
<?php
|
||
|
namespace DatabaseHelper\interfaces;
|
||
|
|
||
|
interface Database
|
||
|
{
|
||
|
/**
|
||
|
* 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.
|
||
|
* @return Table Generated Table instance.
|
||
|
*/
|
||
|
public static function makeTable(string $tableName): Table;
|
||
|
|
||
|
/**
|
||
|
* Initializes a Migration instance for managing database migrations for the specified table.
|
||
|
*
|
||
|
* @param Table $table The table for which the migration is being created.
|
||
|
* @return Migration Generated Migration instance.
|
||
|
*/
|
||
|
public static function makeMigration(Table $table): Migration;
|
||
|
|
||
|
/**
|
||
|
* Initializes a Query instance to perform operations on the specified tables.
|
||
|
* When multiple tables are provided, they will be joined automatically for the query.
|
||
|
*
|
||
|
* @param Table ...$tables One or more Table instances.
|
||
|
* @return Query Generated Query instance.
|
||
|
*/
|
||
|
public static function makeQuery(Table ...$tables): Query;
|
||
|
|
||
|
/**
|
||
|
* 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.
|
||
|
*
|
||
|
* @param Table ...$tables One or more Table instances.
|
||
|
* @return Query Generated Query instance.
|
||
|
*/
|
||
|
public static function makeInsertion(Table ...$tables): Query;
|
||
|
|
||
|
/**
|
||
|
* Initializes an Update instance to perform updates on the specified tables.
|
||
|
* When multiple tables are provided, they will be joined automatically.
|
||
|
*
|
||
|
* @param Table ...$tables One or more Table instances.
|
||
|
* @return Update Generated Update instance.
|
||
|
*/
|
||
|
public static function makeUpdate(Table ...$tables): Update;
|
||
|
|
||
|
/**
|
||
|
* 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.
|
||
|
*/
|
||
|
public static function standardizeTableNames(string &...$tableName): string;
|
||
|
|
||
|
}
|