Publish migration
This commit is contained in:
parent
eb9f79ab85
commit
ebdb634a95
9 changed files with 32 additions and 28 deletions
|
@ -1,4 +1,4 @@
|
||||||
# 4.0.0
|
# 4.0.0-beta.1
|
||||||
* Migrated to support Dart SDK 2.12.x NNBD
|
* Migrated to support Dart SDK 2.12.x NNBD
|
||||||
|
|
||||||
# 3.0.0
|
# 3.0.0
|
||||||
|
|
|
@ -1,2 +1,8 @@
|
||||||
# migration
|
# angel3_migration
|
||||||
|
[![version](https://img.shields.io/badge/pub-v4.0.0-brightgreen)](https://pub.dartlang.org/packages/angel3_migration)
|
||||||
|
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
|
||||||
|
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
|
||||||
|
|
||||||
|
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_migration/LICENSE)
|
||||||
|
|
||||||
A PostgreSQL database migration framework built on Angel's ORM.
|
A PostgreSQL database migration framework built on Angel's ORM.
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
include: package:pedantic/analysis_options.yaml
|
||||||
analyzer:
|
analyzer:
|
||||||
strong-mode:
|
strong-mode:
|
||||||
implicit-casts: false
|
implicit-casts: false
|
|
@ -1,9 +1,9 @@
|
||||||
/// These are straightforward migrations.
|
/// These are straightforward migrations.
|
||||||
///
|
///
|
||||||
/// You will likely never have to actually write these yourself.
|
/// You will likely never have to actually write these yourself.
|
||||||
library angel_migration.example.todo;
|
library angel3_migration.example.todo;
|
||||||
|
|
||||||
import 'package:angel_migration/angel_migration.dart';
|
import 'package:angel3_migration/angel3_migration.dart';
|
||||||
|
|
||||||
class UserMigration implements Migration {
|
class UserMigration implements Migration {
|
||||||
@override
|
@override
|
||||||
|
|
0
packages/orm/angel_migration/lib/angel_migration.dart → packages/orm/angel_migration/lib/angel3_migration.dart
Executable file → Normal file
0
packages/orm/angel_migration/lib/angel_migration.dart → packages/orm/angel_migration/lib/angel3_migration.dart
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
import 'package:angel_orm/angel_orm.dart';
|
import 'package:angel3_orm/angel3_orm.dart';
|
||||||
|
|
||||||
class MigrationColumn extends Column {
|
class MigrationColumn extends Column {
|
||||||
final List<MigrationColumnReference> _references = [];
|
final List<MigrationColumnReference> _references = [];
|
||||||
|
@ -12,10 +12,10 @@ class MigrationColumn extends Column {
|
||||||
@override
|
@override
|
||||||
IndexType get indexType => _index!;
|
IndexType get indexType => _index!;
|
||||||
|
|
||||||
get defaultValue => _defaultValue;
|
dynamic get defaultValue => _defaultValue;
|
||||||
|
|
||||||
List<MigrationColumnReference> get externalReferences =>
|
List<MigrationColumnReference> get externalReferences =>
|
||||||
new List<MigrationColumnReference>.unmodifiable(_references);
|
List<MigrationColumnReference>.unmodifiable(_references);
|
||||||
|
|
||||||
MigrationColumn(ColumnType? type,
|
MigrationColumn(ColumnType? type,
|
||||||
{bool isNullable: true, int? length, IndexType? indexType, defaultValue})
|
{bool isNullable: true, int? length, IndexType? indexType, defaultValue})
|
||||||
|
@ -27,7 +27,7 @@ class MigrationColumn extends Column {
|
||||||
|
|
||||||
factory MigrationColumn.from(Column column) => column is MigrationColumn
|
factory MigrationColumn.from(Column column) => column is MigrationColumn
|
||||||
? column
|
? column
|
||||||
: new MigrationColumn(column.type,
|
: MigrationColumn(column.type,
|
||||||
isNullable: column.isNullable,
|
isNullable: column.isNullable,
|
||||||
length: column.length,
|
length: column.length,
|
||||||
indexType: column.indexType);
|
indexType: column.indexType);
|
||||||
|
@ -41,7 +41,7 @@ class MigrationColumn extends Column {
|
||||||
MigrationColumn primaryKey() => this.._index = IndexType.primaryKey;
|
MigrationColumn primaryKey() => this.._index = IndexType.primaryKey;
|
||||||
|
|
||||||
MigrationColumnReference references(String foreignTable, String foreignKey) {
|
MigrationColumnReference references(String foreignTable, String foreignKey) {
|
||||||
var ref = new MigrationColumnReference._(foreignTable, foreignKey);
|
var ref = MigrationColumnReference._(foreignTable, foreignKey);
|
||||||
_references.add(ref);
|
_references.add(ref);
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ class MigrationColumnReference {
|
||||||
String? get behavior => _behavior;
|
String? get behavior => _behavior;
|
||||||
|
|
||||||
StateError _locked() =>
|
StateError _locked() =>
|
||||||
new StateError('Cannot override existing "$_behavior" behavior.');
|
StateError('Cannot override existing "$_behavior" behavior.');
|
||||||
|
|
||||||
void onDeleteCascade() {
|
void onDeleteCascade() {
|
||||||
if (_behavior != null) throw _locked();
|
if (_behavior != null) throw _locked();
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import 'table.dart';
|
import 'table.dart';
|
||||||
|
|
||||||
abstract class Schema {
|
abstract class Schema {
|
||||||
void drop(String tableName, {bool cascade: false});
|
void drop(String tableName, {bool cascade = false});
|
||||||
|
|
||||||
void dropAll(Iterable<String> tableNames, {bool cascade: false}) {
|
void dropAll(Iterable<String> tableNames, {bool cascade = false}) {
|
||||||
tableNames.forEach((n) => drop(n, cascade: cascade));
|
tableNames.forEach((n) => drop(n, cascade: cascade));
|
||||||
}
|
}
|
||||||
|
|
||||||
void create(String tableName, void callback(Table table));
|
void create(String tableName, void Function(Table table) callback);
|
||||||
|
|
||||||
void createIfNotExists(String tableName, void callback(Table table));
|
void createIfNotExists(String tableName, void Function(Table table) callback);
|
||||||
|
|
||||||
void alter(String tableName, void callback(MutableTable table));
|
void alter(String tableName, void Function(MutableTable table) callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import 'package:angel_orm/angel_orm.dart';
|
import 'package:angel3_orm/angel3_orm.dart';
|
||||||
import 'column.dart';
|
import 'column.dart';
|
||||||
|
|
||||||
abstract class Table {
|
abstract class Table {
|
||||||
MigrationColumn declareColumn(String name, Column column);
|
MigrationColumn declareColumn(String name, Column column);
|
||||||
|
|
||||||
MigrationColumn declare(String name, ColumnType type) =>
|
MigrationColumn declare(String name, ColumnType type) =>
|
||||||
declareColumn(name, new MigrationColumn(type));
|
declareColumn(name, MigrationColumn(type));
|
||||||
|
|
||||||
MigrationColumn serial(String name) => declare(name, ColumnType.serial);
|
MigrationColumn serial(String name) => declare(name, ColumnType.serial);
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ abstract class Table {
|
||||||
@deprecated
|
@deprecated
|
||||||
MigrationColumn dateTime(String name) => timeStamp(name, timezone: true);
|
MigrationColumn dateTime(String name) => timeStamp(name, timezone: true);
|
||||||
|
|
||||||
MigrationColumn timeStamp(String name, {bool timezone: false}) {
|
MigrationColumn timeStamp(String name, {bool timezone = false}) {
|
||||||
if (timezone != true) return declare(name, ColumnType.timeStamp);
|
if (timezone != true) return declare(name, ColumnType.timeStamp);
|
||||||
return declare(name, ColumnType.timeStampWithTimeZone);
|
return declare(name, ColumnType.timeStampWithTimeZone);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ abstract class Table {
|
||||||
MigrationColumn varChar(String name, {int? length}) {
|
MigrationColumn varChar(String name, {int? length}) {
|
||||||
if (length == null) return declare(name, ColumnType.varChar);
|
if (length == null) return declare(name, ColumnType.varChar);
|
||||||
return declareColumn(
|
return declareColumn(
|
||||||
name, new Column(type: ColumnType.varChar, length: length));
|
name, Column(type: ColumnType.varChar, length: length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
name: angel_migration
|
name: angel3_migration
|
||||||
version: 4.0.0
|
version: 4.0.0-beta.1
|
||||||
description: Database migration runtime for Angel's ORM. Use this package to define schemas.
|
description: Database migration runtime for Angel's ORM. Use this package to define schemas.
|
||||||
homepage: https://github.com/dukefirehawk/angel
|
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_migration
|
||||||
publish_to: none
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_orm:
|
angel3_orm: ^4.0.0-beta.1
|
||||||
git:
|
dev_dependencies:
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
pedantic: ^1.11.0
|
||||||
ref: sdk-2.12.x_nnbd
|
|
||||||
path: packages/orm/angel_orm
|
|
||||||
|
|
Loading…
Reference in a new issue