Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model作成 #38

Open
pyar6329 opened this issue Oct 16, 2014 · 11 comments
Open

model作成 #38

pyar6329 opened this issue Oct 16, 2014 · 11 comments

Comments

@pyar6329
Copy link
Member

ER図

pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
…omplete:boolean year:integer season:references
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
…nces broadcast:references size:references extension:references genre:references bitcasa_time:references
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
…ferences bitcasa_time:references size:references
pyar6329 added a commit that referenced this issue Oct 17, 2014
…nces broadcast:references size:references extension:references genre:references bitcasa_time:references
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
…ferences bitcasa_time:references size:references broadcast:references
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
@pyar6329
Copy link
Member Author

間違えてたので全部作り直し。

以下のコマンドで作成。

rails g model season name:string broadcast:references --no-timestamps
rails g model path parent:string current:string depth:integer bitcasa_file:references bitcasa_folder:references
rails g model size size:integer high:boolean blu_ray:boolean bitcasa_file:references bitcasa_folder:references --no-timestamps
rails g model bitcasa_time created_at:datetime modified_at:datetime changed_at:datetime bitcasa_file:references bitcasa_folder:references --no-timestamps
rails g model media name:string category:references extension:references --no-timestamps
rails g model broadcast onair:boolean movie:boolean ova:boolean complete:boolean year:integer bitcasa_file:references bitcasa_folder:references --no-timestamps
rails g model extension name:string bitcasa_file:references --no-timestamps
rails g model category name:string genre:references --no-timestamps
rails g model genre name:string bitcasa_file:references bitcasa_folder:references --no-timestamps
rails g model bitcasa_folder name:string
rails g model bitcasa_file name:string file_id:string play:references bookmark:references
rails g model play count:integer played_at:datetime --no-timestamps
rails g model bookmark count:integer flag:boolean
rails g model tag name:string
rails g model bitcasa_file_tag bitcasa_file:references tag:references
rails g model bitcasa_folder_tag bitcasa_folder:references tag:references

pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 17, 2014
pyar6329 added a commit that referenced this issue Oct 18, 2014
@pyar6329
Copy link
Member Author

作り直しもう一回

以下のコマンドで作成

rails g model season name:string --no-timestamps
rails g model year year:integer --no-timestamps
rails g model broadcast onair:boolean movie:boolean ova:boolean complete:boolean year:references season:references bitcasa_file:references bitcasa_folder:references --no-timestamps
rails g model path parent:string current:string depth:integer bitcasa_file:references bitcasa_folder:references
rails g model size size:integer high:boolean blu_ray:boolean bitcasa_file:references bitcasa_folder:references --no-timestamps
rails g model bitcasa_time created_at:datetime modified_at:datetime changed_at:datetime bitcasa_file:references bitcasa_folder:references --no-timestamps
rails g model tag name:string
rails g model bitcasa_file_tag bitcasa_file:references tag:references
rails g model bitcasa_folder_tag bitcasa_folder:references tag:references
rails g model bitcasa_folder name:string genre:references
rails g model bitcasa_file name:string file_id:string genre:references extension:references
rails g model genre name:string category:references --no-timestamps
rails g model category name:string media:references --no-timestamps
rails g model extension name:string media:references --no-timestamps
rails g model media name:string --no-timestamps
rails g model play count:integer played_at:datetime user:references bitcasa_file:references --no-timestamps
rails g model bookmark count:integer flag:boolean user:references bitcasa_file:references

pyar6329 added a commit that referenced this issue Oct 18, 2014
@pyar6329
Copy link
Member Author

更に作り直し

rails g model year year:integer --no-timestamps
rails g model season name:string --no-timestamps
rails g model tag name:string
rails g model bitcasa_file_tag bitcasa_file:references tag:references
rails g model bitcasa_folder_tag bitcasa_folder:references tag:references
rails g model play count:integer played_at:datetime user:references bitcasa_file:references --no-timestamps
rails g model bookmark count:integer flag:boolean user:references bitcasa_file:references
rails g model genre name:string --no-timestamps
rails g model category name:string --no-timestamps
rails g model extension name:string --no-timestamps
rails g model media name:string --no-timestamps
rails g model extension_media extension:references media:references --no-timestamps
rails g model category_media category:references media:references --no-timestamps
rails g model category_genre category:references genre:references --no-timestamps
rails g model bitcasa_folder name:string category:references media:references genre:references
rails g model bitcasa_file name:string file_id:string extension:references category:references media:references genre:references
rails g model detail parent_path:string current_path:string depth:integer bitcasa_created_at:datetime bitcasa_modified_at:datetime bitcasa_changed_at:datetime size:integer high_definition:boolean blu_ray:boolean onair:boolean movie:boolean ova:boolean complete:boolean year:references season:references bitcasa_file:references bitcasa_folder:references

pyar6329 added a commit that referenced this issue Oct 18, 2014
pyar6329 added a commit that referenced this issue Oct 18, 2014
@pyar6329
Copy link
Member Author

mimetypeを追加した

rails g model year year:integer --no-timestamps
rails g model season name:string --no-timestamps
rails g model tag name:string
rails g model bitcasa_file_tag bitcasa_file:references tag:references
rails g model bitcasa_folder_tag bitcasa_folder:references tag:references
rails g model play count:integer played_at:datetime user:references bitcasa_file:references --no-timestamps
rails g model bookmark count:integer flag:boolean user:references bitcasa_file:references
rails g model genre name:string --no-timestamps
rails g model category name:string --no-timestamps
rails g model extension name:string --no-timestamps
rails g model media name:string --no-timestamps
rails g model category_media category:references media:references --no-timestamps
rails g model category_genre category:references genre:references --no-timestamps
rails g model bitcasa_folder name:string category:references media:references genre:references
rails g model detail parent_path:string current_path:string depth:integer bitcasa_created_at:datetime bitcasa_modified_at:datetime bitcasa_changed_at:datetime size:integer high_definition:boolean blu_ray:boolean onair:boolean movie:boolean ova:boolean complete:boolean year:references season:references bitcasa_file:references bitcasa_folder:references
rails g model mimetype name:string --no-timestamps
rails g model bitcasa_file name:string file_id:string mimetype:references extension:references category:references media:references genre:references
rails g model extension_media mimetype:references extension:references media:references --no-timestamps

pyar6329 added a commit that referenced this issue Oct 18, 2014
pyar6329 added a commit that referenced this issue Oct 19, 2014
@pyar6329
Copy link
Member Author

SQLアンチパターン込で再設計、作り直し。

rails g model year year:integer --no-timestamps
rails g model season name:string --no-timestamps
rails g model tag name:string
rails g model play count:integer played_at:datetime user:references bitcasa_file:references --no-timestamps
rails g model bookmark count:integer flag:boolean user:references bitcasa_file:references
rails g model media name:string --no-timestamps
rails g model extension name:string media:references --no-timestamps
rails g model mimetype name:string media:references --no-timestamps
rails g model category name:string media:references --no-timestamps
rails g model genre name:string category:references --no-timestamps
rails g model bitcasa_file name:string file_id:string mimetype:references extension:references detail:references --no-timestamps
rails g model bitcasa_folder name:string detail:references --no-timestamps
rails g model detail path:string bitcasa_created_at:datetime bitcasa_modified_at:datetime bitcasa_changed_at:datetime size:integer high_definition:boolean blu_ray:boolean onair:boolean movie:boolean ova:boolean complete:boolean year:references season:references category:references media:references genre:references
rails g model detail_tag detail:references tag:references
rails g model detail_closure depth:integer detail:references --no-timestamps

pyar6329 added a commit that referenced this issue Oct 21, 2014
@pyar6329
Copy link
Member Author

mediaの単数形がmediumだったので修正

rails g model year year:integer --no-timestamps
rails g model season name:string --no-timestamps
rails g model tag name:string
rails g model play count:integer played_at:datetime user:references bitcasa_file:references --no-timestamps
rails g model bookmark count:integer flag:boolean user:references bitcasa_file:references
rails g model genre name:string category:references --no-timestamps
rails g model bitcasa_file name:string file_id:string mimetype:references extension:references detail:references --no-timestamps
rails g model bitcasa_folder name:string detail:references --no-timestamps
rails g model detail path:string bitcasa_created_at:datetime bitcasa_modified_at:datetime bitcasa_changed_at:datetime size:integer high_definition:boolean blu_ray:boolean onair:boolean movie:boolean ova:boolean complete:boolean year:references season:references category:references media:references genre:references
rails g model detail_tag detail:references tag:references
rails g model detail_closure depth:integer detail:references --no-timestamps
rails g model medium name:string --no-timestamps
rails g model extension name:string medium:references --no-timestamps
rails g model mimetype name:string medium:references --no-timestamps
rails g model category name:string medium:references --no-timestamps
rails g model detail path:string bitcasa_created_at:datetime bitcasa_modified_at:datetime bitcasa_changed_at:datetime size:integer high_definition:boolean blu_ray:boolean onair:boolean movie:boolean ova:boolean complete:boolean year:references season:references category:references medium:references genre:references

@pyar6329
Copy link
Member Author

  • 外部キー制約ができないので、sqliteからpostgreSQLに変更

pyar6329 added a commit that referenced this issue Oct 21, 2014
@pyar6329
Copy link
Member Author

一度テーブルを作ってからじゃないと外部キー制約追加できなかった。
のでmigrationした。

rails g migration AddForeignKeyToPlays
rails g migration AddForeignKeyToBookmarks
rails g migration AddForeignKeyToGenres
rails g migration AddForeignKeyToBitcasaFiles
rails g migration AddForeignKeyToBitcasaFolders
rails g migration AddForeignKeyToDetailTags
rails g migration AddForeignKeyToDetailClosures
rails g migration AddForeignKeyToExtensions
rails g migration AddForeignKeyToMimetypes
rails g migration AddForeignKeyToCategories
rails g migration AddForeignKeyToDetails

pyar6329 added a commit that referenced this issue Oct 22, 2014
@pyar6329
Copy link
Member Author

外部キー(forienger)は無効化した。
理由としては、

  • model側で制御すればいい
  • ActiveRecord依存のdestroyが上手く動作しない
  • いろいろ操作が厄介
  • postgresqlに依存してしまう

@pyar6329
Copy link
Member Author

外部キー(forienger)追加したmigrationデータはforeign-key-plusブランチへ移動した

pyar6329 added a commit that referenced this issue Oct 22, 2014
pyar6329 added a commit that referenced this issue Oct 23, 2014
pyar6329 added a commit that referenced this issue Oct 24, 2014
@pyar6329
Copy link
Member Author

Dropbox用に修正

rails g model year year:integer --no-timestamps
rails g model season name:string --no-timestamps
rails g model tag name:string
rails g model genre name:string category:references --no-timestamps
rails g model detail_tag detail:references tag:references
rails g model detail_closure depth:integer detail:references --no-timestamps
rails g model medium name:string --no-timestamps
rails g model extension name:string medium:references --no-timestamps
rails g model mimetype name:string medium:references --no-timestamps
rails g model category name:string medium:references --no-timestamps
rails g model detail_file name:string file_modified_at:datetime mimetype:references extension:references detail:references --no-timestamps
rails g model detail_folder name:string hash:string detail:references --no-timestamps
rails g model detail path:string is_dir:boolean dropbox_modified_at:datetime size:integer high_definition:boolean blu_ray:boolean onair:boolean movie:boolean ova:boolean complete:boolean year:references season:references category:references medium:references genre:references
rails g model play count:integer played_at:datetime user:references detail_file:references --no-timestamps
rails g model bookmark count:integer flag:boolean user:references detail_file:references

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant