forked from dkeskar/airdb
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPost.as
More file actions
29 lines (27 loc) · 852 Bytes
/
Post.as
File metadata and controls
29 lines (27 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package example
{
import com.memamsa.airdb.DB;
import com.memamsa.airdb.Migrator;
import com.memamsa.airdb.Modeler;
[Association(type="has_and_belongs_to_many", name="comments", className="example.Comment")]
dynamic public class Post extends Modeler
{
private static const migrations:Migrator = new Migrator(
Post,
{id: true},
[
function(my:Migrator):void {
my.createTable(function():void {
my.column('title', DB.Field.VarChar, {limit: 128});
my.column('author', DB.Field.VarChar, {limit: 40});
my.columnTimestamps();
});
},
// Here is how you add a new migration directive as an element of the array
function(my:Migrator):void {
my.joinTable(Comment);
}
]);
// other class methods and properties
}
}