aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/079_add_profile_photo.rb20
-rw-r--r--db/schema.rb8
2 files changed, 27 insertions, 1 deletions
diff --git a/db/migrate/079_add_profile_photo.rb b/db/migrate/079_add_profile_photo.rb
new file mode 100644
index 000000000..a6c031d89
--- /dev/null
+++ b/db/migrate/079_add_profile_photo.rb
@@ -0,0 +1,20 @@
+class AddProfilePhoto < ActiveRecord::Migration
+ def self.up
+ create_table :profile_photos do |t|
+ t.column :data, :binary, :null => false
+ t.column :user_id, :integer, :null => false
+ end
+
+ add_column :users, :profile_photo_id, :integer, :null => true
+
+ if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
+ execute "ALTER TABLE profile_photos ADD CONSTRAINT fk_profile_photos_user FOREIGN KEY (user_id) REFERENCES users(id)"
+ execute "ALTER TABLE users ADD CONSTRAINT fk_users_profile_photo FOREIGN KEY (profile_photo_id) REFERENCES profile_photos(id)"
+ end
+ end
+
+ def self.down
+ remove_column :users, :profile_photo_id
+ drop_table :profile_photos
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 7055727eb..78f0ed992 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 78) do
+ActiveRecord::Schema.define(:version => 79) do
create_table "acts_as_xapian_jobs", :force => true do |t|
t.string "model", :null => false
@@ -142,6 +142,11 @@ ActiveRecord::Schema.define(:version => 78) do
add_index "post_redirects", ["token"], :name => "index_post_redirects_on_token"
add_index "post_redirects", ["updated_at"], :name => "index_post_redirects_on_updated_at"
+ create_table "profile_photos", :force => true do |t|
+ t.binary "data", :null => false
+ t.integer "user_id", :null => false
+ end
+
create_table "public_bodies", :force => true do |t|
t.text "name", :null => false
t.text "short_name", :null => false
@@ -236,6 +241,7 @@ ActiveRecord::Schema.define(:version => 78) do
t.datetime "last_daily_track_email", :default => '2000-01-01 00:00:00'
t.string "admin_level", :default => "none", :null => false
t.text "ban_text", :default => "", :null => false
+ t.integer "profile_photo_id"
end
add_index "users", ["url_name"], :name => "index_users_on_url_name", :unique => true