1
0
Fork 0
mirror of synced 2024-06-13 00:04:47 +12:00
appwrite/src/Appwrite/Migration/Migration.php

42 lines
791 B
PHP
Raw Normal View History

2021-01-14 05:51:02 +13:00
<?php
namespace Appwrite\Migration;
use Appwrite\Database\Document;
use Appwrite\Database\Database;
abstract class Migration
{
protected \PDO $db;
protected int $limit = 30;
protected int $sum = 30;
protected int $offset = 0;
protected Document $project;
protected Database $projectDB;
/**
* Migration constructor.
*/
public function __construct(\PDO $db)
{
$this->db = $db;
}
/**
* Set project for migration.
*/
2021-01-14 05:58:01 +13:00
public function setProject(Document $project, Database $projectDB): Migration
2021-01-14 05:51:02 +13:00
{
$this->project = $project;
$this->projectDB = $projectDB;
$this->projectDB->setNamespace('app_'.$project->getId());
return $this;
}
/**
* Executes migration for set project.
*/
abstract public function execute(): void;
}