Skip to content

Commit

Permalink
Added syntax highlighting to README
Browse files Browse the repository at this point in the history
  • Loading branch information
bulatb committed Feb 10, 2015
1 parent 8fdb37c commit 8cef3eb
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,28 @@ Example

This is an example application that handles database migrations through Flask-Migrate:

from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
```python
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db'
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db'

db = SQLAlchemy(app)
migrate = Migrate(app, db)
db = SQLAlchemy(app)
migrate = Migrate(app, db)

manager = Manager(app)
manager.add_command('db', MigrateCommand)
manager = Manager(app)
manager.add_command('db', MigrateCommand)

class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(128))
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(128))

if __name__ == '__main__':
manager.run()
if __name__ == '__main__':
manager.run()
```

With the above application you can create the database or enable migrations if the database already exists with the following command:

Expand Down

0 comments on commit 8cef3eb

Please sign in to comment.