In Firstname i don't want to insert special character and in email only insert valid email id

<table name="feedback" resource="default" engine="innodb" comment="mage2 tv example brand table" charset="utf8" collation="utf8_general_ci">
    <column name="feedback_id" xsi:type="int" padding="11" unsigned="true" identity="true" comment="Feedback Id" nullable="false"/>
    <column name="firstname" xsi:type="varchar" nullable="false" length="100" comment="First Name"/>
    <column name="lastname" xsi:type="varchar" nullable="false" length="100" comment="Last Name"/>

    <column name="description" xsi:type="text" nullable="true" comment="Brand Description"/>
    <column name="is_enabled" xsi:type="boolean" nullable="false" default="0" comment="Is the brand enabled?"/>
    <column name="weighting_factor" xsi:type="decimal" precision="5" scale="4" default="1" unsigned="false" nullable="false" comment="Search weighing factor"/>

    <column name="created_at" xsi:type="timestamp" default="CURRENT_TIMESTAMP"/>
    <column name="updated_at" xsi:type="timestamp" default="CURRENT_TIMESTAMP" on_update="true" nullable="false"/>

    <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
            comment="Website Id"/>

    <constraint xsi:type="foreign" referenceId="MAGE2TV_DEMO_JS_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID" column="website_id" referenceTable="store_website"
                referenceColumn="website_id" onDelete="CASCADE"/>

    <constraint xsi:type="primary" referenceId="PRIMARY">
        <column name="id"/>

    <constraint xsi:type="unique" referenceId="MAGE2TV_DEMO_JS_NAME">
        <column name="name"/>


  • 1
    You have to implement your validation at model & service contact layer not at database layer
    – Amit Bera
    Dec 10, 2019 at 7:45
  • Actually i m confused how to implement it. can you please explain what should be procedure.
    – Vivek
    Dec 10, 2019 at 8:30


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.