Skip to content

Instantly share code, notes, and snippets.

@graphicbeacon
Last active May 22, 2018 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graphicbeacon/231cdbb4ff29a96ef34579d4b8ae6caf to your computer and use it in GitHub Desktop.
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)
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