mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
suggested changes
This commit is contained in:
parent
ac85bad9b3
commit
3fb316482c
10 changed files with 176 additions and 110 deletions
|
|
@ -1,7 +1,7 @@
|
|||
class CreateOrganizations < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :organizations do |t|
|
||||
t.string :name
|
||||
t.string :name, null: false
|
||||
t.text :description
|
||||
t.string :picture
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,14 +8,15 @@ class MoveConferencesToOrganizations < ActiveRecord::Migration
|
|||
end
|
||||
|
||||
def change
|
||||
add_reference :conferences, :organization, index: true
|
||||
add_foreign_key :conferences, :organizations, dependent: :delete
|
||||
add_reference :conferences, :organization, index: true, foreign_key: true
|
||||
|
||||
TempConference.reset_column_information
|
||||
organization = TempOrganization.create(name: 'organization', description: 'Default organization to migrate old conferences to the new version of OSEM')
|
||||
TempConference.all.each do |conference|
|
||||
conference.organization_id = organization.id
|
||||
conference.save!
|
||||
if TempConference.count != 0
|
||||
organization = TempOrganization.create(name: 'organization', description: 'Default organization')
|
||||
TempConference.all.each do |conference|
|
||||
conference.organization_id = organization.id
|
||||
conference.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ ActiveRecord::Schema.define(version: 20170531094819) do
|
|||
end
|
||||
|
||||
create_table "organizations", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "name", null: false
|
||||
t.text "description"
|
||||
t.string "picture"
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue