Permalink
Browse files

Schema creation script for sqlite.

  • Loading branch information...
1 parent 9bd616f commit 694d32c72b0cf7789480ad01bb4847c6e684a672 @dustin committed May 6, 2009
Showing with 30 additions and 13 deletions.
  1. +0 −13 etc/create_tables.py
  2. +30 −0 etc/schema.sql
View
@@ -1,13 +0,0 @@
-#!/usr/bin/env python
-"""
-
-Copyright (c) 2008 Dustin Sallings <dustin@spy.net>
-"""
-
-import sys
-sys.path.append('lib')
-sys.path.append('../lib')
-
-import models
-
-models._metadata.create_all(models._engine)
View
@@ -0,0 +1,30 @@
+CREATE TABLE tracks (
+ id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ query VARCHAR(50) NOT NULL,
+ max_seen INTEGER);
+
+CREATE TABLE "user_tracks" (
+ id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ user_id INTEGER NOT NULL,
+ track_id INTEGER NOT NULL,
+ created_at DATETIME);
+
+CREATE TABLE "users" (
+ id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ jid VARCHAR(128) NOT NULL,
+ service_jid VARCHAR(128) NULL,
+ username VARCHAR(50),
+ password VARCHAR(50),
+ active BOOLEAN NOT NULL DEFAULT 't',
+ status VARCHAR(50),
+ min_id INTEGER NOT NULL DEFAULT 0,
+ language VARCHAR(2),
+ auto_post BOOLEAN NOT NULL DEFAULT 'f',
+ friend_timeline_id integer,
+ direct_message_id integer,
+ created_at timestamp);
+
+CREATE UNIQUE INDEX unique_index_user_tracks_id ON user_tracks (id);
+CREATE UNIQUE INDEX unique_index_user_tracks_idx_ut_ut ON user_tracks (user_id, track_id);
+CREATE UNIQUE INDEX unique_index_users_id ON users (id);
+CREATE UNIQUE INDEX unique_index_users_jid ON users (jid);

0 comments on commit 694d32c

Please sign in to comment.