blob: e23c8da7ec772f886357e2c14ec25ed3dd52a217 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
from orator.migrations import Migration
class CreateAddressesMessagesTable(Migration):
def up(self):
"""
Run the migrations.
"""
with self.schema.create('addresses_messages') as table:
table.integer('message_id').unsigned().references('id').on('messages')
table.integer('address_id').unsigned().references('id').on('addresses')
table.enum('type', ['to', 'from', 'cc'])
table.primary(['message_id', 'address_id', 'type'])
def down(self):
"""
Revert the migrations.
"""
self.schema.drop('addresses_messages')
|