title: SQLAlchemy Add A Table To An Already Existing Database
body: <p>I'm attempting to add a table to an already existing Database in SQLAlchemy. My app.db is already compiled and populated with data. I'm just trying to add a new table to the database titled song_points. (The Database tracks songs over time)
  <br><br>My Models:</p>
  
  <pre><code>from app import db
  
  class songs (db.Model):
      SongID = db.Column(db.Integer,primary_key=True, autoincrement=False)
      Artist = db.Column(db.String(120), primary_key=True)
      Title = db.Column(db.String(120), primary_key = True)
      def __repr__(self):
              return "%s, %s, %d\n" %(self.Artist, self.Title, self.SongID)
  
  class points(db.Model):
      SongID = db.Column(db.Integer, db.ForeignKey("songs.SongID"), nullable= False, primary_key=True)
      Genre = db.Column(db.String(25), primary_key=True)
      Points = db.Column(db.Integer)
      Date = db.Column(db.Date, primary_key=True)
      Rank = db.Column(db.Integer)
      def __repr__self(self):
              return "%d, %s, %d\n" %(self.SongID, self.Genre, self.Points)
  class artist_points(db.Model):
      Artist = db.Column(db.String(120), primary_key=True)
      Points = db.Column(db.Integer)
      def __repr__self(self):
          return "%s, %d\n" %(self.Artist, self.Points)
  
  class graphs(db.Model): 
      SongID = db.Column(db.String(120), db.ForeignKey("songs.SongID"), nullable = False, primary_key = True)
      URL = db.Column(db.String(120), primary_key=True)
      def __repr__self(self):
          return "%s, %s\n" %(self.SongID, self.URL)
  </code></pre>
  
  <p>And here was my db creation script:
  <br></p>
  
  <pre><code>from migrate.versioning import api
  from config import SQLALCHEMY_DATABASE_URI
  from config import SQLALCHEMY_MIGRATE_REPO
  from app import db
  import os.path
  db.create_all()
  if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
      api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
      api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
  else:
      api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
  </code></pre>
  
  <p>This is the table I'm attempting to add:</p>
  
  <pre><code>class song_points(db.Model):
      SongID = db.Column(db.Integer,db.ForeignKey("songs.SongID"), nullable = False, primary_key = True)
      Genre = db.Column(db.String(25), db.ForeignKey("points.Genre"), nullable = False, primary_key = True)
      Points = db.Column(db.Integer)
  </code></pre>