Permalink
Browse files

use strings where appropriate. will tighten this down a bit more late…

…r on.
  • Loading branch information...
1 parent 45ea23b commit 40d68de513055f7a1775800f267f5438d9722a4b @obfuscurity committed Dec 27, 2010
View
12 db/migrate/002_create_users_table.rb
@@ -4,13 +4,13 @@ def self.up
CREATE TABLE users(
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
role_id INTEGER,
- username TEXT,
- password TEXT,
- firstname TEXT,
- lastname TEXT,
- email TEXT,
+ username VARCHAR(255),
+ password VARCHAR(255),
+ firstname VARCHAR(255),
+ lastname VARCHAR(255),
+ email VARCHAR(255),
url TEXT,
- tz TEXT,
+ tz VARCHAR(255),
reputation INTEGER,
FOREIGN KEY(role_id) REFERENCES roles(id)
);
View
2 db/migrate/003_create_revisions_table.rb
@@ -10,7 +10,7 @@ def self.up
dept TEXT,
content TEXT,
description TEXT,
- format TEXT,
+ format VARCHAR(255),
FOREIGN KEY(article_id) REFERENCES articles(id),
FOREIGN KEY(user_id) REFERENCES users(id)
);
View
2 db/migrate/005_create_articles_table.rb
@@ -5,7 +5,7 @@ def self.up
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
revision_id INTEGER,
topic_id INTEGER,
- status TEXT,
+ status VARCHAR(255),
FOREIGN KEY(revision_id) REFERENCES revisions(id),
FOREIGN KEY(topic_id) REFERENCES topics(id)
);
View
16 db/site.sql
@@ -2,13 +2,13 @@ PRAGMA foreign_keys = ON;
CREATE TABLE users(
id INTEGER PRIMARY KEY,
role_id INTEGER,
- username TEXT,
- password TEXT,
- firstname TEXT,
- lastname TEXT,
- email TEXT,
+ username VARCHAR(255),
+ password VARCHAR(255),
+ firstname VARCHAR(255),
+ lastname VARCHAR(255),
+ email VARCHAR(255),
url TEXT,
- tz TEXT,
+ tz VARCHAR(255),
reputation INTEGER,
FOREIGN KEY(role_id) REFERENCES roles(id)
);
@@ -30,7 +30,7 @@ CREATE TABLE articles(
id INTEGER PRIMARY KEY,
revision_id INTEGER,
topic_id INTEGER,
- status TEXT,
+ status VARCHAR(255),
FOREIGN KEY(revision_id) REFERENCES revisions(id),
FOREIGN KEY(topic_id) REFERENCES topics(id)
);
@@ -43,7 +43,7 @@ CREATE TABLE revisions(
dept TEXT,
content TEXT,
description TEXT,
- format TEXT,
+ format VARCHAR(255),
FOREIGN KEY(article_id) REFERENCES articles(id),
FOREIGN KEY(user_id) REFERENCES users(id)
);
View
1 models/role.rb
@@ -1,2 +1,3 @@
class Role < ActiveRecord::Base
+ validates_uniqueness_of :name
end

0 comments on commit 40d68de

Please sign in to comment.