Going to replace MongoDB with Furlong

This commit is contained in:
thosakwe 2016-09-20 01:04:51 -04:00
parent 06e24d2ac0
commit d60462a23a
7 changed files with 43 additions and 12 deletions

View file

@ -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

View file

@ -1,6 +1,2 @@
# Development-only server configuration.
port: 3000
furlong:
database: angel
username: root
password: password

View file

@ -0,0 +1,4 @@
library angel.migrations;
export 'util.dart';
export 'schemas/user.dart';

View 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"]);
}
}

View file

@ -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(

View file

@ -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:

View file

@ -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);