Ticket #3525: many-to-many-schema.yml
| File many-to-many-schema.yml, 0.9 kB (added by thomas.s, 8 months ago) |
|---|
| Line | |
|---|---|
| 1 | User: |
| 2 | columns: |
| 3 | id: |
| 4 | type: integer(4) |
| 5 | primary: true |
| 6 | autoincrement: true |
| 7 | username: |
| 8 | type: string(255) |
| 9 | options: |
| 10 | type: INNODB |
| 11 | collate: utf8_unicode_ci |
| 12 | charset: utf8 |
| 13 | |
| 14 | Group: |
| 15 | # group is a sql keyword |
| 16 | tableName: group_table |
| 17 | columns: |
| 18 | id: |
| 19 | type: integer(4) |
| 20 | primary: true |
| 21 | autoincrement: true |
| 22 | name: |
| 23 | type: string(255) |
| 24 | relations: |
| 25 | # n:m |
| 26 | Users: |
| 27 | foreignAlias: Groups |
| 28 | class: User |
| 29 | refClass: GroupUser |
| 30 | options: |
| 31 | type: INNODB |
| 32 | collate: utf8_unicode_ci |
| 33 | charset: utf8 |
| 34 | |
| 35 | GroupUser: |
| 36 | columns: |
| 37 | user_id: |
| 38 | type: integer(4) |
| 39 | primary: true |
| 40 | group_id: |
| 41 | type: integer(4) |
| 42 | primary: true |
| 43 | relations: |
| 44 | User: |
| 45 | local: user_id |
| 46 | foreignType: one |
| 47 | onDelete: CASCADE |
| 48 | Group: |
| 49 | local: group_id |
| 50 | foreignType: one |
| 51 | onDelete: CASCADE |
| 52 | options: |
| 53 | type: INNODB |
| 54 | collate: utf8_unicode_ci |
| 55 | charset: utf8 |