kwatable 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +46 -0
- data/MIT-LICENSE +20 -0
- data/README.txt +4 -2
- data/bin/kwatable +4 -4
- data/examples/ex1/Makefile +40 -14
- data/examples/ex1/{example1.yaml → tabledef.yaml} +42 -11
- data/examples/ex2/Makefile +41 -14
- data/examples/ex2/{example2.yaml → tabledef.yaml} +45 -30
- data/examples/ex3/Makefile +52 -0
- data/examples/ex3/tabledef.yaml +136 -0
- data/kwatable.gemspec +11 -10
- data/lib/kwatable.rb +24 -18
- data/lib/kwatable/kwatable.schema.yaml +95 -5
- data/lib/kwatable/main.rb +331 -0
- data/lib/kwatable/manipulator.rb +320 -192
- data/lib/kwatable/messages.rb +59 -0
- data/lib/kwatable/template/ddl-mysql.eruby +202 -0
- data/lib/kwatable/{templates → template}/ddl-postgresql.eruby +71 -45
- data/lib/kwatable/{templates → template}/defaults.yaml +2 -2
- data/lib/kwatable/template/dictionary.en.yaml +70 -0
- data/lib/kwatable/template/dictionary.ja.yaml +165 -0
- data/lib/kwatable/template/dto-java.eruby +77 -0
- data/lib/kwatable/template/dto-java.sub.eruby +259 -0
- data/lib/kwatable/template/dto-ruby.eruby +63 -0
- data/lib/kwatable/template/dto-ruby.sub.eruby +213 -0
- data/lib/kwatable/template/helper/column.rb +70 -0
- data/lib/kwatable/template/helper/common.rb +151 -0
- data/lib/kwatable/template/helper/java.rb +83 -0
- data/lib/kwatable/template/helper/label.rb +90 -0
- data/lib/kwatable/template/helper/ruby.rb +36 -0
- data/lib/kwatable/template/helper/table.rb +62 -0
- data/lib/kwatable/template/hibernate.eruby +139 -0
- data/lib/kwatable/template/rails-controller.eruby +66 -0
- data/lib/kwatable/template/rails-controller.sub.eruby +114 -0
- data/lib/kwatable/template/rails-kwartz.eruby +164 -0
- data/lib/kwatable/template/rails-kwartz/_attr.plogic.eruby +56 -0
- data/lib/kwatable/template/rails-kwartz/_form.plogic.eruby +81 -0
- data/lib/kwatable/template/rails-kwartz/_link.plogic.eruby +36 -0
- data/lib/kwatable/template/rails-kwartz/edit.cfg.yaml.eruby +16 -0
- data/lib/kwatable/template/rails-kwartz/edit.html.eruby +46 -0
- data/lib/kwatable/template/rails-kwartz/edit.plogic.eruby +20 -0
- data/lib/kwatable/template/rails-kwartz/layout.html.eruby +39 -0
- data/lib/kwatable/template/rails-kwartz/layout.plogic.eruby +32 -0
- data/lib/kwatable/template/rails-kwartz/list.html.eruby +94 -0
- data/lib/kwatable/template/rails-kwartz/list.plogic.eruby +41 -0
- data/lib/kwatable/template/rails-kwartz/new.html.eruby +100 -0
- data/lib/kwatable/template/rails-kwartz/new.plogic.eruby +26 -0
- data/lib/kwatable/template/rails-kwartz/show.html.eruby +51 -0
- data/lib/kwatable/template/rails-kwartz/show.plogic.eruby +9 -0
- data/lib/kwatable/template/rails-model.eruby +35 -0
- data/lib/kwatable/template/rails-model.sub.eruby +136 -0
- data/lib/kwatable/{templates → template}/validator-ruby.eruby +18 -11
- data/lib/kwatable/util.rb +133 -0
- data/lib/kwatable/util/assert-text-equal.rb +47 -0
- data/lib/kwatable/util/assertion.rb +115 -0
- data/lib/kwatable/validator.rb +50 -0
- data/test/assert-diff.rb +1 -1
- data/test/test-ex.rb +306 -0
- data/test/test.rb +37 -127
- metadata +66 -17
- data/COPYING +0 -340
- data/ChangeLog.txt +0 -65
- data/lib/kwatable/error-msg.rb +0 -38
- data/lib/kwatable/main-program.rb +0 -216
- data/lib/kwatable/templates/ddl-mysql.eruby +0 -172
- data/lib/kwatable/templates/dto-java.eruby +0 -260
- data/lib/kwatable/templates/dto-ruby.eruby +0 -185
data/ChangeLog
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
release: 0.2.0
|
3
|
+
date: 2006-09-27
|
4
|
+
|
5
|
+
enhancements:
|
6
|
+
- template/hibernate.eruby: add new template
|
7
|
+
- template/dto-java.eruby: support '--collection' property
|
8
|
+
- rails-controller.eruby: added
|
9
|
+
- template/*.eruby: add <template-help>
|
10
|
+
- add 'examples/ex3'
|
11
|
+
- add 'rails-model.eruby'
|
12
|
+
- add new option '-c' (check only)
|
13
|
+
- add new option '-u' (uncheck)
|
14
|
+
- add new option '-T' (not untabify)
|
15
|
+
- add validator.rb and validate datafiles in main.rb
|
16
|
+
- support multiple datafile
|
17
|
+
- property '--droptable' supported in ddl-{mysql,postgresql}.eruby
|
18
|
+
- command-line option '-hf template' shows template info
|
19
|
+
- command-line option '-hf template' shows available templates
|
20
|
+
- add new template 'rails-kwartz.eruby'
|
21
|
+
- template suffix '.eruby' is omittable
|
22
|
+
|
23
|
+
changes:
|
24
|
+
- main.rb: command-line option '-m' is removed
|
25
|
+
- dto-{java,ruby}.eruby: splitted into sub template
|
26
|
+
- main.rb: command-line option '-m' is now obsolete
|
27
|
+
- ddl-mysql: change to print 'references' clause.
|
28
|
+
- ddl-mysql, ddl-postgresql: to add 'default' constraint
|
29
|
+
- populate() is improved in dto-java and dto-ruby
|
30
|
+
- use setter method to set values in dto-java and dto-ruby
|
31
|
+
- rename 'FooBarBaz.rb' to 'foo_bar_baz.rb' in dto-ruby.rb
|
32
|
+
- rename 'kwartz/templates/' to 'kwartz/template'
|
33
|
+
|
34
|
+
bugfixes:
|
35
|
+
- template/dto-*.eruby: support command-line option '-d'
|
36
|
+
- main.rb: show available template names
|
37
|
+
- ex?/tabledef.yaml: column name 'modified_{on|at}' is changed to 'updated_{on|at}'
|
38
|
+
- add 'import java.util.List;' in dto-java
|
39
|
+
- add default constructor in dto-java
|
40
|
+
- manipulator class now detect type of column which refers forward column
|
41
|
+
- don't print column 'id' and '{created|modified}_{at|on}'
|
42
|
+
- now displays column of foreign key
|
43
|
+
- wrong argument passed to Kwatable.msg() in Manipulaotr#_error()
|
44
|
+
- fixed on dto-java.eruby
|
45
|
+
- fixed on dto-ruby.eruby
|
46
|
+
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
copyright(c) 2005 kuwata-lab.com all rights reserved.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
.=title: README
|
2
|
-
.?release: $Release: 0.
|
2
|
+
.?release: $Release: 0.3.0 $
|
3
3
|
|
4
4
|
|
5
5
|
.$ About
|
@@ -8,6 +8,8 @@ Kwatable is a command to generate SQL script which create tables from
|
|
8
8
|
table definition file (*.yaml).
|
9
9
|
See `examples' for details.
|
10
10
|
|
11
|
+
NOTICE: Kwatable is now alpha version. Spec may change in the future.
|
12
|
+
|
11
13
|
|
12
14
|
|
13
15
|
.$ Installation
|
@@ -78,4 +80,4 @@ copyright(c) 2005 kuwata-lab.com all rights reserved.
|
|
78
80
|
|
79
81
|
.$ License
|
80
82
|
|
81
|
-
|
83
|
+
MIT-LICENSE
|
data/bin/kwatable
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
### kwatable - create table, dto class, or other from table definition
|
5
5
|
###
|
6
6
|
### copyright(c) 2005 kuwata-lab.com all rights reserved.
|
7
|
-
### $Release: 0.
|
8
|
-
### $Rev:
|
7
|
+
### $Release: 0.3.0 $
|
8
|
+
### $Rev: 25 $
|
9
9
|
###
|
10
10
|
|
11
11
|
require 'kwatable'
|
12
|
-
require 'kwatable/main
|
12
|
+
require 'kwatable/main'
|
13
13
|
|
14
|
-
Kwatable::
|
14
|
+
Kwatable::Main.main(ARGV)
|
data/examples/ex1/Makefile
CHANGED
@@ -1,26 +1,52 @@
|
|
1
1
|
###
|
2
|
+
### $Rev: 45 $
|
3
|
+
### $Release: 0.3.0 $
|
2
4
|
### copyright(c) 2005 kuwata-lab.com all rights reserved.
|
3
|
-
### $Release: 0.2.0 $
|
4
|
-
### $Rev: 17 $
|
5
5
|
###
|
6
6
|
|
7
|
-
DATAFILE =
|
8
|
-
|
9
|
-
|
7
|
+
DATAFILE = tabledef.yaml
|
8
|
+
|
9
|
+
OPTS_DDL = --droptable
|
10
|
+
OPTS_DTO_JAVA = --package=my.example --parent=Object --populate --constructor --collection=set
|
11
|
+
OPTS_DTO_RUBY = --module=Example --parent=Object --reqpath=lib --populate --symbolkey
|
12
|
+
OPTS_RAILS_KWARTZ = --lang=ja --charset=UTF8 --stylesheet=site,local --session-token
|
13
|
+
OPTS_RAILS_MODEL = --lang=ja --encoding=UTF8
|
14
|
+
OPTS_RAILS_CONTROLLER = --lang=ja --encoding=UTF8 --session-token
|
15
|
+
OPTS_HIBERNATE = --collection=set --package=my.example
|
16
|
+
|
17
|
+
RAILS_DIR = rails
|
18
|
+
VIEWS_DIR = $(RAILS_DIR)/views
|
19
|
+
MODELS_DIR = $(RAILS_DIR)/models
|
20
|
+
CONTROLLERS_DIR = $(RAILS_DIR)/controllers
|
10
21
|
|
11
22
|
|
12
23
|
all:
|
13
|
-
kwatable
|
14
|
-
kwatable
|
15
|
-
kwatable -
|
16
|
-
kwatable -
|
24
|
+
kwatable -t ddl-mysql $(DATAFILE) > ddl-mysql.sql
|
25
|
+
kwatable -t ddl-postgresql $(DATAFILE) > ddl-postgresql.sql
|
26
|
+
kwatable -t dto-java $(DATAFILE)
|
27
|
+
kwatable -t dto-ruby $(DATAFILE)
|
28
|
+
kwatable -t hibernate $(DATAFILE) > hibernate.hbm.xml
|
29
|
+
mkdir -p $(VIEWS_DIR)
|
30
|
+
kwatable -t rails-kwartz -d $(VIEWS_DIR) $(DATAFILE)
|
31
|
+
mkdir -p $(MODELS_DIR)
|
32
|
+
kwatable -t rails-model -d $(MODELS_DIR) $(DATAFILE)
|
33
|
+
mkdir -p $(CONTROLLERS_DIR)
|
34
|
+
kwatable -t rails-controller -d $(CONTROLLERS_DIR) $(DATAFILE)
|
17
35
|
|
18
36
|
all2:
|
19
|
-
kwatable -
|
20
|
-
kwatable -
|
21
|
-
kwatable
|
22
|
-
kwatable
|
37
|
+
kwatable -t ddl-mysql $(OPTS_DDL) $(DATAFILE) > ddl-mysql.sql
|
38
|
+
kwatable -t ddl-postgresql $(OPTS_DDL) $(DATAFILE) > ddl-postgresql.sql
|
39
|
+
kwatable -t dto-java $(OPTS_DTO_JAVA) $(DATAFILE)
|
40
|
+
kwatable -t dto-ruby $(OPTS_DTO_RUBY) $(DATAFILE)
|
41
|
+
kwatable -t hibernate $(OPTS_HIBERNATE) $(DATAFILE) > hibernate.hbm.xml
|
42
|
+
mkdir -p $(VIEWS_DIR)
|
43
|
+
kwatable -t rails-kwartz -d $(VIEWS_DIR) $(OPTS_RAILS_KWARTZ) $(DATAFILE)
|
44
|
+
mkdir -p $(MODELS_DIR)
|
45
|
+
kwatable -t rails-model -d $(MODELS_DIR) $(OPTS_RAILS_MODEL) $(DATAFILE)
|
46
|
+
mkdir -p $(CONTROLLERS_DIR)
|
47
|
+
kwatable -t rails-controller -d $(CONTROLLERS_DIR) $(OPTS_RAILS_CONTROLLER) $(DATAFILE)
|
48
|
+
|
23
49
|
|
24
50
|
clean:
|
25
|
-
rm -
|
51
|
+
rm -rf *.sql *.java *.rb *.class *.xml $(RAILS_DIR)
|
26
52
|
|
@@ -2,8 +2,8 @@
|
|
2
2
|
## example data file for kwatable
|
3
3
|
##
|
4
4
|
## copyright(c) 2005 kuwata-lab.com all rights reserved.
|
5
|
-
## $Release: 0.
|
6
|
-
## $Rev:
|
5
|
+
## $Release: 0.3.0 $
|
6
|
+
## $Rev: 39 $
|
7
7
|
##
|
8
8
|
|
9
9
|
columns:
|
@@ -15,14 +15,14 @@ columns:
|
|
15
15
|
- name: name
|
16
16
|
type: string
|
17
17
|
required: yes
|
18
|
-
width:
|
18
|
+
width: 60
|
19
19
|
|
20
20
|
- name: desc
|
21
21
|
type: string
|
22
22
|
|
23
23
|
- name: email
|
24
24
|
type: string
|
25
|
-
width:
|
25
|
+
width: 60
|
26
26
|
|
27
27
|
- name: status
|
28
28
|
type: string
|
@@ -30,11 +30,11 @@ columns:
|
|
30
30
|
|
31
31
|
- name: username
|
32
32
|
type: string
|
33
|
-
width:
|
33
|
+
width: 30
|
34
34
|
|
35
35
|
- name: password
|
36
36
|
type: string
|
37
|
-
width:
|
37
|
+
width: 30
|
38
38
|
|
39
39
|
- name: memo
|
40
40
|
type: text
|
@@ -48,15 +48,41 @@ columns:
|
|
48
48
|
- name: age
|
49
49
|
type: integer
|
50
50
|
|
51
|
-
- name: last_update
|
52
|
-
type: timestamp
|
53
|
-
|
54
51
|
- name: gender
|
55
52
|
type: char
|
56
53
|
enum:
|
57
54
|
- M
|
58
55
|
- F
|
59
56
|
|
57
|
+
- name: last_update
|
58
|
+
type: timestamp
|
59
|
+
required: yes
|
60
|
+
|
61
|
+
- name: created_on
|
62
|
+
desc: created date
|
63
|
+
type: date
|
64
|
+
default: current_date
|
65
|
+
required: yes
|
66
|
+
|
67
|
+
- name: created_at
|
68
|
+
desc: created timestamp
|
69
|
+
type: timestamp
|
70
|
+
default: current_timestamp
|
71
|
+
required: yes
|
72
|
+
|
73
|
+
- name: updated_on
|
74
|
+
desc: last modified date
|
75
|
+
type: date
|
76
|
+
default: current_date
|
77
|
+
required: yes
|
78
|
+
|
79
|
+
- name: updated_at
|
80
|
+
desc: last modified timestamp
|
81
|
+
type: timestamp
|
82
|
+
default: current_timestamp
|
83
|
+
required: yes
|
84
|
+
|
85
|
+
|
60
86
|
tables:
|
61
87
|
- name: groups
|
62
88
|
class: Group
|
@@ -71,9 +97,12 @@ tables:
|
|
71
97
|
- name: case
|
72
98
|
type: string
|
73
99
|
enum: [ normal, debug, emergency ]
|
74
|
-
- name:
|
100
|
+
- name: active
|
75
101
|
desc: is active?
|
76
102
|
type: boolean
|
103
|
+
default: true
|
104
|
+
- name: created_on
|
105
|
+
- name: updated_on
|
77
106
|
|
78
107
|
- name: users
|
79
108
|
class: User
|
@@ -92,8 +121,10 @@ tables:
|
|
92
121
|
desc: group id to which user belongs
|
93
122
|
- name: account
|
94
123
|
type: string
|
95
|
-
width:
|
124
|
+
width: 30
|
96
125
|
required: yes
|
97
126
|
- name: password
|
98
127
|
required: yes
|
128
|
+
- name: created_at
|
129
|
+
- name: updated_at
|
99
130
|
|
data/examples/ex2/Makefile
CHANGED
@@ -1,25 +1,52 @@
|
|
1
1
|
###
|
2
|
+
### $Rev: 45 $
|
3
|
+
### $Release: 0.3.0 $
|
2
4
|
### copyright(c) 2005 kuwata-lab.com all rights reserved.
|
3
|
-
### $Release: 0.2.0 $
|
4
|
-
### $Rev: 17 $
|
5
5
|
###
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
DATAFILE = tabledef.yaml
|
8
|
+
|
9
|
+
OPTS_DDL = --droptable
|
10
|
+
OPTS_DTO_JAVA = --package=my.example --parent=Object --populate --constructor --collection=set
|
11
|
+
OPTS_DTO_RUBY = --module=Example --parent=Object --reqpath=lib --populate --symbolkey
|
12
|
+
OPTS_RAILS_KWARTZ = --lang=ja --charset=UTF8 --stylesheet=site,local --session-token
|
13
|
+
OPTS_RAILS_MODEL = --lang=ja --encoding=UTF8
|
14
|
+
OPTS_RAILS_CONTROLLER = --lang=ja --encoding=UTF8 --session-token
|
15
|
+
OPTS_HIBERNATE = --collection=set --package=my.example
|
16
|
+
|
17
|
+
RAILS_DIR = rails
|
18
|
+
VIEWS_DIR = $(RAILS_DIR)/views
|
19
|
+
MODELS_DIR = $(RAILS_DIR)/models
|
20
|
+
CONTROLLERS_DIR = $(RAILS_DIR)/controllers
|
21
|
+
|
10
22
|
|
11
23
|
all:
|
12
|
-
kwatable
|
13
|
-
kwatable
|
14
|
-
kwatable -
|
15
|
-
kwatable -
|
24
|
+
kwatable -t ddl-mysql $(DATAFILE) > ddl-mysql.sql
|
25
|
+
kwatable -t ddl-postgresql $(DATAFILE) > ddl-postgresql.sql
|
26
|
+
kwatable -t dto-java $(DATAFILE)
|
27
|
+
kwatable -t dto-ruby $(DATAFILE)
|
28
|
+
kwatable -t hibernate $(DATAFILE) > hibernate.hbm.xml
|
29
|
+
mkdir -p $(VIEWS_DIR)
|
30
|
+
kwatable -t rails-kwartz -d $(VIEWS_DIR) $(DATAFILE)
|
31
|
+
mkdir -p $(MODELS_DIR)
|
32
|
+
kwatable -t rails-model -d $(MODELS_DIR) $(DATAFILE)
|
33
|
+
mkdir -p $(CONTROLLERS_DIR)
|
34
|
+
kwatable -t rails-controller -d $(CONTROLLERS_DIR) $(DATAFILE)
|
16
35
|
|
17
36
|
all2:
|
18
|
-
kwatable -
|
19
|
-
kwatable -
|
20
|
-
kwatable
|
21
|
-
kwatable
|
37
|
+
kwatable -t ddl-mysql $(OPTS_DDL) $(DATAFILE) > ddl-mysql.sql
|
38
|
+
kwatable -t ddl-postgresql $(OPTS_DDL) $(DATAFILE) > ddl-postgresql.sql
|
39
|
+
kwatable -t dto-java $(OPTS_DTO_JAVA) $(DATAFILE)
|
40
|
+
kwatable -t dto-ruby $(OPTS_DTO_RUBY) $(DATAFILE)
|
41
|
+
kwatable -t hibernate $(OPTS_HIBERNATE) $(DATAFILE) > hibernate.hbm.xml
|
42
|
+
mkdir -p $(VIEWS_DIR)
|
43
|
+
kwatable -t rails-kwartz -d $(VIEWS_DIR) $(OPTS_RAILS_KWARTZ) $(DATAFILE)
|
44
|
+
mkdir -p $(MODELS_DIR)
|
45
|
+
kwatable -t rails-model -d $(MODELS_DIR) $(OPTS_RAILS_MODEL) $(DATAFILE)
|
46
|
+
mkdir -p $(CONTROLLERS_DIR)
|
47
|
+
kwatable -t rails-controller -d $(CONTROLLERS_DIR) $(OPTS_RAILS_CONTROLLER) $(DATAFILE)
|
48
|
+
|
22
49
|
|
23
50
|
clean:
|
24
|
-
rm -
|
51
|
+
rm -rf *.sql *.java *.rb *.class *.xml $(RAILS_DIR)
|
25
52
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
columns:
|
2
2
|
- name: id
|
3
3
|
type: int
|
4
|
-
|
4
|
+
ident: yes
|
5
5
|
serial: yes
|
6
6
|
|
7
7
|
- name: name
|
8
8
|
type: str
|
9
|
-
|
9
|
+
required: yes
|
10
10
|
|
11
11
|
- name: desc
|
12
12
|
type: str
|
@@ -14,22 +14,6 @@ columns:
|
|
14
14
|
|
15
15
|
tables:
|
16
16
|
|
17
|
-
- name: addresses
|
18
|
-
class: Address
|
19
|
-
desc: Address master table
|
20
|
-
columns:
|
21
|
-
- name: id
|
22
|
-
- name: zipcode
|
23
|
-
type: str
|
24
|
-
width: 8
|
25
|
-
pattern: /^\d+-\d+$/
|
26
|
-
- name: addr1
|
27
|
-
type: str
|
28
|
-
- name: addr2
|
29
|
-
type: str
|
30
|
-
- name: addr3
|
31
|
-
type: str
|
32
|
-
|
33
17
|
- name: customers
|
34
18
|
class: Customer
|
35
19
|
desc: Customer master table
|
@@ -40,9 +24,35 @@ tables:
|
|
40
24
|
type: str
|
41
25
|
- name: email
|
42
26
|
type: str
|
43
|
-
- name:
|
44
|
-
|
45
|
-
|
27
|
+
- name: zip
|
28
|
+
type: str
|
29
|
+
width: 8
|
30
|
+
pattern: /^\d\d\d-\d\d\d\d$/
|
31
|
+
- name: address
|
32
|
+
type: str
|
33
|
+
# - name: address_id
|
34
|
+
# ref: addresses.id
|
35
|
+
# required: yes
|
36
|
+
# cascade: yes
|
37
|
+
relations:
|
38
|
+
- kind: '1:n'
|
39
|
+
referrer: sales_orders.customer_id
|
40
|
+
|
41
|
+
# - name: addresses
|
42
|
+
# class: Address
|
43
|
+
# desc: Address master table
|
44
|
+
# columns:
|
45
|
+
# - name: id
|
46
|
+
# - name: zipcode
|
47
|
+
# type: str
|
48
|
+
# width: 8
|
49
|
+
# pattern: /^\d+-\d+$/
|
50
|
+
# - name: addr1
|
51
|
+
# type: str
|
52
|
+
# - name: addr2
|
53
|
+
# type: str
|
54
|
+
# - name: addr3
|
55
|
+
# type: str
|
46
56
|
|
47
57
|
- name: items
|
48
58
|
class: Item
|
@@ -53,7 +63,7 @@ tables:
|
|
53
63
|
- name: desc
|
54
64
|
- name: price
|
55
65
|
type: money
|
56
|
-
|
66
|
+
required: yes
|
57
67
|
|
58
68
|
- name: sales_orders
|
59
69
|
class: SalesOrder
|
@@ -62,33 +72,38 @@ tables:
|
|
62
72
|
- name: id
|
63
73
|
- name: customer_id
|
64
74
|
ref: customers.id
|
65
|
-
|
75
|
+
required: yes
|
66
76
|
- name: ordered_date
|
67
77
|
type: date
|
68
|
-
|
78
|
+
required: yes
|
69
79
|
- name: delivery_date
|
70
80
|
type: date
|
71
81
|
- name: amount
|
72
82
|
type: money
|
83
|
+
relations:
|
84
|
+
- kind: '1:n'
|
85
|
+
referrer: sales_order_lines(order_id)
|
86
|
+
order-by: num
|
87
|
+
cascade: yes
|
73
88
|
|
74
89
|
- name: sales_order_lines
|
75
90
|
class: SalesOrderLine
|
76
91
|
desc: Sales Order detail lines
|
77
92
|
columns:
|
93
|
+
- name: id
|
78
94
|
- name: num
|
79
95
|
type: int
|
80
|
-
|
96
|
+
required: yes
|
81
97
|
- name: order_id
|
82
98
|
ref: sales_orders.id
|
83
|
-
|
99
|
+
required: yes
|
84
100
|
- name: item_id
|
85
101
|
ref: items.id
|
86
|
-
|
102
|
+
required: yes
|
87
103
|
- name: price
|
88
104
|
type: money
|
89
|
-
|
105
|
+
required: yes
|
90
106
|
- name: quantity
|
91
107
|
type: int
|
92
|
-
|
93
|
-
primary-keys: [ order_id, item_id ]
|
108
|
+
required: yes
|
94
109
|
|