Your First Rest Project
Version 8.1 by Pascal Robert on 2011/12/27 11:18
Introduction
In the first part of the Blog tutorial, you will learn:
- How to create a EOModel for the database (we will use H2)
- How to use migrations to create the database tables
- How to use ERRest to create blog posts with JSON format and how to display the blog posts in HTML for readers
Create the database model
We will build a small database model for the blog. The database will have two tables: BlogEntry and Author.
BlogEntry will have the following columns:
| Column name | Type | Constraints |
|---|---|---|
| id | integer | primary key |
| title | string(255) | |
| content | string(4000) | |
| lastModified | timestamp | |
| creationDate | timestamp | |
| author | integer | relation with Author |
Author will have the following columns:
| Column name | Type | Constraints |
|---|---|---|
| id | integer | primary key |
| firstName | string(100) | |
| lastName | string(100) | |
| string(150) | unique | |
| passwd | string(16) |
To create the database, we will first create a EOModel and use migrations to build the database on the file system (H2 will take care of creating the database file).