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.
|
# Default server configuration.
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
mongo_db: mongodb://localhost:27017/angel
|
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.
|
# Development-only server configuration.
|
||||||
port: 3000
|
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:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:angel_configuration/angel_configuration.dart';
|
import 'package:angel_configuration/angel_configuration.dart';
|
||||||
|
@ -10,7 +8,7 @@ import 'package:sqljocky/sqljocky.dart';
|
||||||
Future<ConnectionPool> createPool() async {
|
Future<ConnectionPool> createPool() async {
|
||||||
var app = new Angel();
|
var app = new Angel();
|
||||||
await app.configure(loadConfigurationFile());
|
await app.configure(loadConfigurationFile());
|
||||||
Map config = app.properties["furlong"];
|
Map config = app.properties["db"]["migrate"];
|
||||||
|
|
||||||
if (config == null)
|
if (config == null)
|
||||||
throw new Exception(
|
throw new Exception(
|
|
@ -12,8 +12,7 @@ dependencies:
|
||||||
angel_mongo: ^1.0.0-dev
|
angel_mongo: ^1.0.0-dev
|
||||||
angel_mustache: ^1.0.0-dev
|
angel_mustache: ^1.0.0-dev
|
||||||
angel_static: ^1.0.0
|
angel_static: ^1.0.0
|
||||||
furlong:
|
furlong: ^1.0.0-dev
|
||||||
path: /Users/tobe/Source/Dart/furlong
|
|
||||||
json_god: ^2.0.0-beta
|
json_god: ^2.0.0-beta
|
||||||
validate: ^1.5.2
|
validate: ^1.5.2
|
||||||
dev_dependencies:
|
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:furlong/furlong.dart';
|
||||||
import 'package:grinder/grinder.dart';
|
import 'package:grinder/grinder.dart';
|
||||||
|
|
||||||
final List<Migration> migrations = [
|
final List<Migration> migrations = [
|
||||||
// Your migrations here!
|
// Your migrations here!
|
||||||
|
new UsersMigration()
|
||||||
];
|
];
|
||||||
|
|
||||||
main(args) => grind(args);
|
main(args) => grind(args);
|
||||||
|
|
Loading…
Reference in a new issue