| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\Framework\Migrations\Contracts; |
| 4 |
|
| 5 |
use Give\Framework\Exceptions\Primitives\RuntimeException; |
| 6 |
|
| 7 |
/** |
| 8 |
* Base Migration class |
| 9 |
* |
| 10 |
* @since 4.0.0 |
| 11 |
*/ |
| 12 |
abstract class BaseMigration |
| 13 |
{ |
| 14 |
/** |
| 15 |
* Return a unique identifier for the migration |
| 16 |
* |
| 17 |
* @return string |
| 18 |
*/ |
| 19 |
public static function id() |
| 20 |
{ |
| 21 |
throw new RuntimeException('A unique ID must be provided for the migration'); |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Return a Unix Timestamp for when the migration was created |
| 26 |
* |
| 27 |
* Example: strtotime( '2020-09-16 12:30:00') |
| 28 |
* |
| 29 |
* @since 2.9.0 |
| 30 |
* |
| 31 |
* @return int Unix timestamp for when the migration was created |
| 32 |
*/ |
| 33 |
public static function timestamp() |
| 34 |
{ |
| 35 |
throw new RuntimeException('This method must be overridden to return a valid unix timestamp'); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Return migration title |
| 40 |
* |
| 41 |
* @since 2.10.0 |
| 42 |
* |
| 43 |
* @return string |
| 44 |
*/ |
| 45 |
public static function title() |
| 46 |
{ |
| 47 |
return static::id(); |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Return migration source |
| 52 |
* |
| 53 |
* @since 2.10.0 |
| 54 |
* |
| 55 |
* @return string |
| 56 |
*/ |
| 57 |
public static function source() |
| 58 |
{ |
| 59 |
return esc_html__('GiveWP Core', 'give'); |
| 60 |
} |
| 61 |
} |
| 62 |
|