Last active
May 22, 2018 20:19
-
-
Save graphicbeacon/231cdbb4ff29a96ef34579d4b8ae6caf to your computer and use it in GitHub Desktop.
Sample code for "Building RESTful Web APIs with Dart, Aqueduct and PostgreSQL (Part 3)" post on Medium (3)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FaveReadsSink extends RequestSink { | |
//... | |
//... | |
//... | |
Future createDatabaseSchema(ManagedContext context) async { | |
var builder = new SchemaBuilder.toSchema( | |
context.persistentStore, | |
new Schema.fromDataModel(context.dataModel), | |
isTemporary: false); // Set to false to persist our data | |
for (var cmd in builder.commands) { | |
await context.persistentStore.execute(cmd); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment