title: Flask-Sqlalchemy taking non unique values for a 'unique' integer
body: <p>Consider the following code:</p>
  
  <pre><code>class User(db.Model):
      id=db.Column(db.Integer,primary_key=True)
      email=db.Column(db.String,unique=True)
      name=db.Column(db.String)
      password=db.Column(db.String)
      registration_num=db.Column(db.Integer,unique=True)
  
      def __repr__(self):
            return "&lt;Name %r&gt;, &lt;id %r&gt;" %(self.name,self.id)
  </code></pre>
  
  <p>Here I am trying to create a user with unique email id (later to be used as login id) and unique registration number (later to be used as folder name to save user submitted data). 
  While email column rejects non unique values, registration_num does not raise any flag no matter how many users i create with same registration number.</p>
  
  <p>Given below is the decorator used for registration page:</p>
  
  <pre><code>@app.route('/register', methods=['GET','POST'])
  def register():
      if request.method == 'POST':
          userpass=request.form["password"]
          usermail=request.form["username"]
          nameofuser=request.form["name"]
          reg_num=int(request.form["r_num"])
          u=models.User(email=usermail,name=nameofuser,password=userpass,registration_num=reg_num)
          db.session.add(u)
          db.session.commit()
          return redirect(url_for('login'))
  
      return render_template('register_form.html')
  </code></pre>
  
  <p>What am i doing wrong here?</p>