Skip to content

Commit

Permalink
do not try to drop tables
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Oct 7, 2021
1 parent 9f0226f commit b106c48
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions demos/_demo-data/create-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function import(array $rowsMulti)
$model->addField('name', ['type' => 'string']);
$model->addField('addresses', ['type' => 'text']);
$model->addField('accounts', ['type' => 'text']);
(new Migration($model))->dropIfExists()->create();
(new Migration($model))->create();
$model->import([
['id' => 1, 'name' => 'John', 'addresses' => null, 'accounts' => null],
['id' => 2, 'name' => 'Jane', 'addresses' => null, 'accounts' => null],
Expand All @@ -66,7 +66,7 @@ public function import(array $rowsMulti)
$model->addField('iso3', ['type' => 'string']); // should be CHAR(3) NOT NULL
$model->addField('numcode', ['type' => 'smallint']);
$model->addField('phonecode', ['type' => 'integer']);
(new Migration($model))->dropIfExists()->create();
(new Migration($model))->create();
$model->import([
['id' => 1, 'iso' => 'AF', 'name' => 'AFGHANISTAN', 'nicename' => 'Afghanistan', 'iso3' => 'AFG', 'numcode' => 4, 'phonecode' => 93],
['id' => 2, 'iso' => 'AL', 'name' => 'ALBANIA', 'nicename' => 'Albania', 'iso3' => 'ALB', 'numcode' => 8, 'phonecode' => 355],
Expand Down Expand Up @@ -328,7 +328,7 @@ public function import(array $rowsMulti)
$model->addField('is_folder', ['type' => 'boolean']);
$model->addField('parent_folder_id', ['type' => 'bigint']);
// KEY `fk_file_file_idx` (`parent_folder_id`)
(new Migration($model))->dropIfExists()->create();
(new Migration($model))->create();
$model->import([
['id' => 1, 'name' => 'phpunit.xml', 'type' => 'xml', 'is_folder' => 0, 'parent_folder_id' => null],
['id' => 2, 'name' => 'LICENSE', 'type' => '', 'is_folder' => 0, 'parent_folder_id' => null],
Expand Down Expand Up @@ -418,7 +418,7 @@ public function import(array $rowsMulti)
$model->addField('finish_time', ['type' => 'time']);
$model->addField('created', ['type' => 'datetime']);
$model->addField('updated', ['type' => 'datetime']);
(new Migration($model))->dropIfExists()->create();
(new Migration($model))->create();
$data = [
['id' => 1, 'project_name' => 'Agile DSQL', 'project_code' => 'at01', 'description' => 'DSQL is a composable SQL query builder. You can write multi-vendor queries in PHP profiting from better security, clean syntax and avoid human errors.', 'client_name' => 'Agile Toolkit', 'client_address' => 'Some Street,' . "\n" . 'Garden City' . "\n" . 'UK', 'client_country_iso' => 'GB', 'is_commercial' => 0, 'currency' => 'GBP', 'is_completed' => 1, 'project_budget' => 7000, 'project_invoiced' => 0, 'project_paid' => 0, 'project_hour_cost' => 0, 'project_hours_est' => 150, 'project_hours_reported' => 125, 'project_expenses_est' => 50, 'project_expenses' => 0, 'project_mgmt_cost_pct' => 0.1, 'project_qa_cost_pct' => 0.2, 'start_date' => '2016-01-26', 'finish_date' => '2016-06-23', 'finish_time' => '12:50:00', 'created' => '2017-04-06 10:34:34', 'updated' => '2017-04-06 10:35:04'],
['id' => 2, 'project_name' => 'Agile Core', 'project_code' => 'at02', 'description' => 'Collection of PHP Traits for designing object-oriented frameworks.', 'client_name' => 'Agile Toolkit', 'client_address' => 'Some Street,' . "\n" . 'Garden City' . "\n" . 'UK', 'client_country_iso' => 'GB', 'is_commercial' => 0, 'currency' => 'GBP', 'is_completed' => 1, 'project_budget' => 3000, 'project_invoiced' => 0, 'project_paid' => 0, 'project_hour_cost' => 0, 'project_hours_est' => 70, 'project_hours_reported' => 56, 'project_expenses_est' => 50, 'project_expenses' => 0, 'project_mgmt_cost_pct' => 0.1, 'project_qa_cost_pct' => 0.2, 'start_date' => '2016-04-27', 'finish_date' => '2016-05-21', 'finish_time' => '18:41:00', 'created' => '2017-04-06 10:21:50', 'updated' => '2017-04-06 10:35:04'],
Expand All @@ -434,7 +434,7 @@ public function import(array $rowsMulti)

$model = new ImportModelWithPrefixedFields($persistence, ['table' => 'product_category']);
$model->addField('name', ['type' => 'string']);
(new Migration($model))->dropIfExists()->create();
(new Migration($model))->create();
$model->import([
['id' => 1, 'name' => 'Condiments and Gravies'],
['id' => 2, 'name' => 'Beverages'],
Expand All @@ -444,7 +444,7 @@ public function import(array $rowsMulti)
$model = new ImportModelWithPrefixedFields($persistence, ['table' => 'product_sub_category']);
$model->addField('name', ['type' => 'string']);
$model->addField('product_category_id', ['type' => 'bigint']);
(new Migration($model))->dropIfExists()->create();
(new Migration($model))->create();
$model->import([
['id' => 1, 'name' => 'Gravie', 'product_category_id' => 1],
['id' => 2, 'name' => 'Spread', 'product_category_id' => 1],
Expand All @@ -462,7 +462,7 @@ public function import(array $rowsMulti)
$model->addField('brand', ['type' => 'string']);
$model->addField('product_category_id', ['type' => 'bigint']);
$model->addField('product_sub_category_id', ['type' => 'bigint']);
(new Migration($model))->dropIfExists()->create();
(new Migration($model))->create();
$model->import([
['id' => 1, 'name' => 'Mustard', 'brand' => 'Condiment Corp.', 'product_category_id' => 1, 'product_sub_category_id' => 2],
['id' => 2, 'name' => 'Ketchup', 'brand' => 'Condiment Corp.', 'product_category_id' => 1, 'product_sub_category_id' => 2],
Expand Down

0 comments on commit b106c48

Please sign in to comment.