OSDN Git Service

fix db
authoryasushiito <yas@pen-chan.jp>
Sun, 15 Jan 2012 07:57:54 +0000 (16:57 +0900)
committeryasushiito <yas@pen-chan.jp>
Sun, 15 Jan 2012 07:57:54 +0000 (16:57 +0900)
app/controllers/system_controller.rb
db/migrate/20111206095746_create_artists.rb
db/migrate/20111206112042_create_original_pictures.rb
db/migrate/20111206112949_create_resource_pictures.rb

index a466600..528bd6a 100644 (file)
@@ -4,19 +4,6 @@ class SystemController < ApplicationController
   #layout :system
   
   def start
-    OriginalPicture.all.each do |a|
-      a.lisence_id = 1 if a.lisence_id.blank?
-      a.save
-    end
-    ResourcePicture.all.each do |a|
-      a.lisence_id = 1 if a.lisence_id.blank?
-      a.artist_id = 1 if a.artist_id.blank?
-      a.save
-    end
-    Artist.all.each do |a|
-      a.default_lisence_id = 1 if a.default_lisence_id.blank?
-      a.save
-    end
   end
   
   def index
index 1d5e26e..be91372 100644 (file)
@@ -5,7 +5,7 @@ class CreateArtists < ActiveRecord::Migration
       t.string :name\r
       t.string :homepage_url\r
       t.string :api_url\r
-      t.integer :default_lisence_id\r
+      t.integer :default_lisence_id, :null => false, :default => 0\r
       t.timestamp :crowled_at\r
 
       t.timestamps
index b1bf18f..8c193e3 100644 (file)
@@ -5,8 +5,8 @@ class CreateOriginalPictures < ActiveRecord::Migration
       t.integer :width, :null => false
       t.integer :height, :null => false
       t.integer :filesize, :null => false
-      t.integer :artist_id#, :null => false
-      t.integer :lisence_id#, :null => false
+      t.integer :artist_id, :null => false, :default => 0
+      t.integer :lisence_id, :null => false, :default => 0
 
       t.timestamps
     end
index 7ed414c..3dfa27e 100644 (file)
@@ -5,8 +5,8 @@ class CreateResourcePictures < ActiveRecord::Migration
       t.integer :width, :null => false
       t.integer :height, :null => false
       t.integer :filesize, :null => false
-      t.integer :artist_id#, :null => false
-      t.integer :lisence_id#, :null => false
+      t.integer :artist_id, :null => false, :default => 0
+      t.integer :lisence_id, :null => false, :default => 0
       t.integer :original_picture_id, :null => false
 
       t.timestamps