0
votes

Below is my schema.yml

CmsFooter:
  actAs:
    I18n:
      fields: [title,description]
    Timestampable:
  columns:
    id:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true
    is_default:
      type: enum(1)
      values: [Y, N]
      default: N
      notnull: true
      autoincrement: false
    title:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    description:
      type: string()
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
LanguageMaster:
  actAs:
    Timestampable:
  columns:
    id:
      type: integer(11)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true  
    name:
      type: string(50)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    culture:
      type: string(4)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    is_active:
      type: enum(1)
      fixed: false
      unsigned: false
      values:
        - Y
        - N
      primary: false
      default: N
      notnull: true
      autoincrement: false
    is_default:
      type: enum(1)
      fixed: false
      unsigned: false
      values:
        - Y
        - N
      primary: false
      default: N
      notnull: true
      autoincrement: false
    file_name:
      type: string(50)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
  relations:
    CmsFooterTranslation:
      local: culture
      foreign: lang
      type: many
      onDelete: CASCADE
      onUpdate: CASCADE

I'm generating schema -> DB.

when i'm running this schema it's NOT providing relationship in database table

table name :- cms_footer_translation field :- lang

in relationship i need it should show language_master.culture ondelete cascade & onupdate cascade

any help??

1
Just as a tip: When defining a boolean (like is_default in your case) simply use: is_default: {type: boolean, notnull: true, default: 0}. It can save you a lot of work. Detailed explanation hereflu
Can you please clarify which relation between which tables you're trying to acomplish? I really can't get that out of your question.flu

1 Answers

0
votes

An example of a working relationship that I have defined is:

  relations:
    Testimony:
      class: Testimony
      local: testimony_id
      foreign: id
      foreignAlias: HomePage
      onDelete: cascade
      onUpdate: cascade
      foreignType: one
      owningSide: true
  indexes:
    fk_home_page_testimony1:
      fields: [testimony_id]

I'd take another read of the documentation and compare what you have to theirs.