Skip to content

Commit

Permalink
fix schema migration NS
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Oct 1, 2021
1 parent 78abebb commit d7e518d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ three steps involved:
3. If needed - Use [Agile API](https://github.com/atk4/api) to provide API access for your Mobile/React app or IoT devices.

Agile Data allows you to define models, fields, relations, formulas, aggregates, expressions, user action and
access control rules. Both Agile UI and Agile API will follow those rules.
access control rules. Both Agile UI and Agile API will follow those rules.

### Integrations and Apps using Agile UI

Expand Down Expand Up @@ -256,7 +256,6 @@ Add-ons:
- [Charts add-on](https://github.com/atk4/chart) - Modern looking and free charts with [chartJS](https://www.chartjs.org/)
- [Audit for Models](https://github.com/atk4/audit) - Record all DB operations with Undo/Redo support for Agile Data
- [Data for Reports](https://github.com/atk4/report) - Implement data aggregation and union models for Agile Data
- [Schema and Migration](https://github.com/atk4/schema) - Tools to migrate your database structure

Integrations:

Expand Down
15 changes: 8 additions & 7 deletions demos/_demo-data/create-sqlite-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Atk4\Ui\Demos;

use Atk4\Data\Model;
use \Atk4\Data\Schema\Migration;

require_once __DIR__ . '/../init-autoloader.php';

Expand Down Expand Up @@ -52,7 +53,7 @@ public function import(array $rowsMulti)
$model->addField('name', ['type' => 'string']);
$model->addField('addresses', ['type' => 'text']);
$model->addField('accounts', ['type' => 'text']);
(new \Atk4\Schema\Migration($model))->dropIfExists()->create();
(new Migration($model))->dropIfExists()->create();
$model->import([
['id' => 1, 'name' => 'John', 'addresses' => null, 'accounts' => null],
['id' => 2, 'name' => 'Jane', 'addresses' => null, 'accounts' => null],
Expand All @@ -65,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 \Atk4\Schema\Migration($model))->dropIfExists()->create();
(new Migration($model))->dropIfExists()->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 @@ -327,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 \Atk4\Schema\Migration($model))->dropIfExists()->create();
(new Migration($model))->dropIfExists()->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 @@ -417,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 \Atk4\Schema\Migration($model))->dropIfExists()->create();
(new Migration($model))->dropIfExists()->create();
$model->import([
['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 @@ -427,7 +428,7 @@ public function import(array $rowsMulti)

$model = new ImportModelWithPrefixedFields($persistence, ['table' => 'product_category']);
$model->addField('name', ['type' => 'string']);
(new \Atk4\Schema\Migration($model))->dropIfExists()->create();
(new Migration($model))->dropIfExists()->create();
$model->import([
['id' => 1, 'name' => 'Condiments and Gravies'],
['id' => 2, 'name' => 'Beverages'],
Expand All @@ -437,7 +438,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 \Atk4\Schema\Migration($model))->dropIfExists()->create();
(new Migration($model))->dropIfExists()->create();
$model->import([
['id' => 1, 'name' => 'Gravie', 'product_category_id' => 1],
['id' => 2, 'name' => 'Spread', 'product_category_id' => 1],
Expand All @@ -455,7 +456,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 \Atk4\Schema\Migration($model))->dropIfExists()->create();
(new Migration($model))->dropIfExists()->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 d7e518d

Please sign in to comment.