Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#3009] Add dashboard table migration script
- Loading branch information
Sean Hammond
committed
Nov 6, 2012
1 parent
af1e3fc
commit 7202c92
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from sqlalchemy import * | ||
from migrate import * | ||
|
||
def upgrade(migrate_engine): | ||
metadata = MetaData() | ||
metadata.bind = migrate_engine | ||
migrate_engine.execute(''' | ||
CREATE TABLE dashboard ( | ||
user_id text NOT NULL, | ||
activity_stream_last_viewed timestamp without time zone NOT NULL | ||
); | ||
ALTER TABLE dashboard | ||
ADD CONSTRAINT dashboard_pkey PRIMARY KEY (user_id); | ||
ALTER TABLE dashboard | ||
ADD CONSTRAINT dashboard_user_id_fkey FOREIGN KEY (user_id) REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE; | ||
''') |