Wiki source code of Your First Rest Project

Version 7.1 by Pascal Robert on 2011/12/27 10:23

Show last authors
1 = Introduction =
2
3 In the first part of the Blog tutorial, you will learn:
4
5 * How to create a EOModel for the database (we will use H2)
6 * How to use migrations to create the database tables
7 * How to use ERRest to create blog posts with JSON format and how to display the blog posts in HTML for readers
8
9 = Create the database model =
10
11 We will build a small database model for the blog. The database will have two tables: BlogEntry and Author.
12
13 BlogEntry will have the following columns:
14
15 |=Column name|=Type|=Constraints
16 |id|integer|primary key
17 |title|string(255)|
18 |content|string(4000)|
19 |lastModified|timestamp|
20 |creationDate|timestamp|
21 |author|integer|relation with Author
22
23 Author will have the following columns:
24
25 |=Column name|=Type|=Constraints
26 |id|integer|primary key
27 |firstName|string(100)|
28 |lastName|string(100)|
29 |email|string(150)|unique
30 |passwd|string(16|
31
32 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).