Updated temporal mapping
This commit is contained in:
parent
572a134c9c
commit
aff68b2f07
11 changed files with 40 additions and 16 deletions
packages/orm
angel_migration
angel_migration_runner
angel_orm_mysql
angel_orm_postgres
|
@ -5,10 +5,20 @@
|
||||||
[](https://gitter.im/angel_dart/discussion)
|
[](https://gitter.im/angel_dart/discussion)
|
||||||
[](https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration/LICENSE)
|
[](https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration/LICENSE)
|
||||||
|
|
||||||
A database migration framework built for Angel3 ORM.
|
A basic database migration framework built for Angel3 ORM.
|
||||||
|
|
||||||
## Supported database
|
## Supported database
|
||||||
|
|
||||||
* PostgreSQL version 10 or later
|
* PostgreSQL version 10 or later
|
||||||
* MariaDB 10.2.x
|
* MariaDB 10.2.x or later
|
||||||
* MySQL 8.x
|
* MySQL 8.x or later
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
* Create tables based on ORM models
|
||||||
|
* Drop tables based on ORM models
|
||||||
|
* Add new tables based ORM models
|
||||||
|
|
||||||
|
## Limitation
|
||||||
|
|
||||||
|
* Alter table/fields based on updated ORM models not supported
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
## 6.0.2
|
## 6.1.0
|
||||||
|
|
||||||
* Upgraded to `lints` 2.x.x
|
* Upgraded to `lints` 2.x.x
|
||||||
* Fixed issue #70. Incorrectly generated SQL for `defaultsTo('Default Value')`
|
* Fixed issue #70. Incorrectly generated SQL for `defaultsTo('Default Value')`
|
||||||
|
* Mapped timestamp to datetime for MySQL and MariaDB
|
||||||
|
|
||||||
## 6.0.1
|
## 6.0.1
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
[](https://gitter.im/angel_dart/discussion)
|
[](https://gitter.im/angel_dart/discussion)
|
||||||
[](https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration_runner/LICENSE)
|
[](https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration_runner/LICENSE)
|
||||||
|
|
||||||
Command-line based database migration runner for Angel3 ORM.
|
Database migration runner for Angel3 ORM.
|
||||||
|
|
||||||
Supported database:
|
Supported database:
|
||||||
|
|
||||||
|
@ -15,10 +15,8 @@ Supported database:
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
* For PostgreSQL, use `PostgresMigrationRunner` to perform the database migration.
|
* Use `PostgresMigrationRunner` to perform the database migration for PostgreSQL.
|
||||||
|
|
||||||
* For MariaDB, use `MariaDbMigrationRunner` to perform the database migration.
|
* Use `MySqlMigrationRunner` to perform the database migration for MySQL and MariaDB. This is implemented with [`mysql_client`](https://pub.dev/packages?q=mysql_client) driver.
|
||||||
|
|
||||||
* For MySQL, use `MySqlMigrationRunner` to perform the database migration.
|
* Use `MariaDbMigrationRunner` to perform the database migration for MariaDB. [`mysql1`](https://pub.dev/packages?q=mysql1).
|
||||||
|
|
||||||
**Important Notes** For MariaDB and MySQL, both migration runner are using different drivers. MariaDB is using `mysql1` driver while MySQL is using `mysql_client` driver. This is necessary as neither driver works correctly over both MariaDB and MySQL. Based on testing, `mysql1` driver works seamlessly with MariaDB 10.2.x while `mysql_client` works well with MySQL 8.x.
|
|
||||||
|
|
|
@ -6,6 +6,11 @@ import 'package:charcode/ascii.dart';
|
||||||
abstract class MariaDbGenerator {
|
abstract class MariaDbGenerator {
|
||||||
static String columnType(MigrationColumn column) {
|
static String columnType(MigrationColumn column) {
|
||||||
var str = column.type.name;
|
var str = column.type.name;
|
||||||
|
|
||||||
|
// Map timestamp time to datetime
|
||||||
|
if (column.type == ColumnType.timeStamp) {
|
||||||
|
str = ColumnType.dateTime.name;
|
||||||
|
}
|
||||||
if (column.type.hasLength) {
|
if (column.type.hasLength) {
|
||||||
return '$str(${column.length})';
|
return '$str(${column.length})';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6,6 +6,10 @@ import 'package:charcode/ascii.dart';
|
||||||
abstract class MySqlGenerator {
|
abstract class MySqlGenerator {
|
||||||
static String columnType(MigrationColumn column) {
|
static String columnType(MigrationColumn column) {
|
||||||
var str = column.type.name;
|
var str = column.type.name;
|
||||||
|
// Map timestamp time to datetime
|
||||||
|
if (column.type == ColumnType.timeStamp) {
|
||||||
|
str = ColumnType.dateTime.name;
|
||||||
|
}
|
||||||
if (column.type.hasLength) {
|
if (column.type.hasLength) {
|
||||||
return '$str(${column.length})';
|
return '$str(${column.length})';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel3_migration_runner
|
name: angel3_migration_runner
|
||||||
version: 6.0.2
|
version: 6.1.0
|
||||||
description: Command-line based database migration runner for Angel3's ORM.
|
description: Command-line based database migration runner for Angel3's ORM.
|
||||||
homepage: https://angel3-framework.web.app/
|
homepage: https://angel3-framework.web.app/
|
||||||
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration_runner
|
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration_runner
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## 6.0.0
|
||||||
|
|
||||||
|
* Fixed temporal data type
|
||||||
|
* Fixed `MariaDbExcutor` transaction
|
||||||
|
* Updated to `lints` 2.0.0
|
||||||
|
|
||||||
## 6.0.0-beta.3
|
## 6.0.0-beta.3
|
||||||
|
|
||||||
* Fixed transaction for `MariaDbExecutor`
|
* Fixed transaction for `MariaDbExecutor`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel3_orm_mysql
|
name: angel3_orm_mysql
|
||||||
version: 6.0.0-beta.3
|
version: 6.0.0
|
||||||
description: MySQL support for Angel3 ORM. Includes functionality for querying and transactions.
|
description: MySQL support for Angel3 ORM. Includes functionality for querying and transactions.
|
||||||
homepage: https://angel3-framework.web.app/
|
homepage: https://angel3-framework.web.app/
|
||||||
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_mysql
|
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_mysql
|
||||||
|
@ -16,7 +16,7 @@ dev_dependencies:
|
||||||
angel3_orm_test: ^6.0.0
|
angel3_orm_test: ^6.0.0
|
||||||
build_runner: ^2.0.1
|
build_runner: ^2.0.1
|
||||||
test: ^1.21.0
|
test: ^1.21.0
|
||||||
lints: ^1.0.0
|
lints: ^2.0.0
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
# angel3_serialize:
|
# angel3_serialize:
|
||||||
# path: ../../serialize/angel_serialize
|
# path: ../../serialize/angel_serialize
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
## 6.0.1
|
## 6.1.0
|
||||||
|
|
||||||
* Upgraded to `lints` 2.x.x
|
* Upgraded to `lints` 2.x.x
|
||||||
* Fixed #71. Create a new database connection and retry.
|
* Fixed #71. Restablish broken connection automatically.
|
||||||
|
|
||||||
## 6.0.0
|
## 6.0.0
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel3_orm_postgres
|
name: angel3_orm_postgres
|
||||||
version: 6.0.1
|
version: 6.1.0
|
||||||
description: PostgreSQL support for Angel3 ORM. Includes functionality for querying and transactions.
|
description: PostgreSQL support for Angel3 ORM. Includes functionality for querying and transactions.
|
||||||
homepage: https://angel3-framework.web.app/
|
homepage: https://angel3-framework.web.app/
|
||||||
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_postgres
|
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_postgres
|
||||||
|
|
Loading…
Reference in a new issue