Going to replace MongoDB with Furlong
This commit is contained in:
parent
06e24d2ac0
commit
d60462a23a
7 changed files with 43 additions and 12 deletions
|
@ -1,3 +1,12 @@
|
|||
# Default server configuration.
|
||||
host: 127.0.0.1
|
||||
mongo_db: mongodb://localhost:27017/angel
|
||||
db:
|
||||
migrate:
|
||||
database: angel
|
||||
username: root
|
||||
password: password
|
||||
web:
|
||||
database: angel
|
||||
username: username
|
||||
password: password
|
|
@ -1,6 +1,2 @@
|
|||
# Development-only server configuration.
|
||||
port: 3000
|
||||
furlong:
|
||||
database: angel
|
||||
username: root
|
||||
password: password
|
4
lib/src/migrations/migrations.dart
Normal file
4
lib/src/migrations/migrations.dart
Normal file
|
@ -0,0 +1,4 @@
|
|||
library angel.migrations;
|
||||
|
||||
export 'util.dart';
|
||||
export 'schemas/user.dart';
|
24
lib/src/migrations/schemas/user.dart
Normal file
24
lib/src/migrations/schemas/user.dart
Normal file
|
@ -0,0 +1,24 @@
|
|||
import 'dart:async';
|
||||
import 'package:furlong/furlong.dart';
|
||||
|
||||
class UsersMigration extends Migration {
|
||||
@override
|
||||
String get name => "Users table";
|
||||
|
||||
@override
|
||||
Future create(Migrator migrator) async {
|
||||
migrator.create("users", (table) {
|
||||
table.id();
|
||||
table.string("username");
|
||||
table.string("email");
|
||||
table.string("password");
|
||||
table.dateTime("created_at");
|
||||
table.dateTime("updated_at").nullable = true;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Future destroy(Migrator migrator) async {
|
||||
migrator.drop(["users"]);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
library angel.migrations;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'package:angel_configuration/angel_configuration.dart';
|
||||
|
@ -10,7 +8,7 @@ import 'package:sqljocky/sqljocky.dart';
|
|||
Future<ConnectionPool> createPool() async {
|
||||
var app = new Angel();
|
||||
await app.configure(loadConfigurationFile());
|
||||
Map config = app.properties["furlong"];
|
||||
Map config = app.properties["db"]["migrate"];
|
||||
|
||||
if (config == null)
|
||||
throw new Exception(
|
|
@ -12,8 +12,7 @@ dependencies:
|
|||
angel_mongo: ^1.0.0-dev
|
||||
angel_mustache: ^1.0.0-dev
|
||||
angel_static: ^1.0.0
|
||||
furlong:
|
||||
path: /Users/tobe/Source/Dart/furlong
|
||||
furlong: ^1.0.0-dev
|
||||
json_god: ^2.0.0-beta
|
||||
validate: ^1.5.2
|
||||
dev_dependencies:
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import 'package:angel/migrations/migrations.dart';
|
||||
import 'package:angel/src/migrations/migrations.dart';
|
||||
import 'package:furlong/furlong.dart';
|
||||
import 'package:grinder/grinder.dart';
|
||||
|
||||
final List<Migration> migrations = [
|
||||
// Your migrations here!
|
||||
new UsersMigration()
|
||||
];
|
||||
|
||||
main(args) => grind(args);
|
||||
|
|
Loading…
Reference in a new issue