Export = new SchemaExport(config);
schemaExport.create(true, true);
}
}
运行程式之後,将会有以下的结果:
Creating tables...
10:39:10,203 DEBUG SchemaExport:143 - drop table if exists user
create table user (
id integer not null auto_increment,
name varchar(255),
age integer,
primary key (id)
)
10:39:10,203 DEBUG SchemaExport:161 - create table user (
id integer not null auto_increment,
name varchar(255),
age integer,
primary key (id)
)
10:39:10,359 INFO SchemaExport:173 - schema export complete
生成的资料表如下:
+--------+-----------------+------+------+----------+---------------------+
| Field | Type | Null | Key | Default | Extra |
+--------+-----------------+------+------+----------+---------------------+
| id | int(11) | | PRI | NULL | auto_increment |
| name | varchar(255) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
+--------+-----------------+------+------+----------+---------------------+
3 rows in set (0.00 sec)
|