mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
database structure for organizations
This commit is contained in:
parent
bd54ad8158
commit
ccc1eaf3a0
4
app/models/organization.rb
Normal file
4
app/models/organization.rb
Normal file
@ -0,0 +1,4 @@
|
||||
class Organization < ActiveRecord::Base
|
||||
has_one :address, as: :placeable, dependent: :destroy
|
||||
accepts_nested_attributes_for :address, allow_destroy: true
|
||||
end
|
9
db/migrate/20160801145502_create_organizations.rb
Normal file
9
db/migrate/20160801145502_create_organizations.rb
Normal file
@ -0,0 +1,9 @@
|
||||
class CreateOrganizations < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :organizations do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
5
db/migrate/20160801153454_add_organization_to_profile.rb
Normal file
5
db/migrate/20160801153454_add_organization_to_profile.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddOrganizationToProfile < ActiveRecord::Migration
|
||||
def change
|
||||
add_reference :profiles, :organization, index: true, foreign_key: true
|
||||
end
|
||||
end
|
11
db/schema.rb
11
db/schema.rb
@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20160728095026) do
|
||||
ActiveRecord::Schema.define(version: 20160801153454) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@ -324,6 +324,12 @@ ActiveRecord::Schema.define(version: 20160728095026) do
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "organizations", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "plans", force: :cascade do |t|
|
||||
t.string "name", limit: 255
|
||||
t.integer "amount"
|
||||
@ -384,8 +390,10 @@ ActiveRecord::Schema.define(version: 20160728095026) do
|
||||
t.string "lastfm"
|
||||
t.string "flickr"
|
||||
t.string "job"
|
||||
t.integer "organization_id"
|
||||
end
|
||||
|
||||
add_index "profiles", ["organization_id"], name: "index_profiles_on_organization_id", using: :btree
|
||||
add_index "profiles", ["user_id"], name: "index_profiles_on_user_id", using: :btree
|
||||
|
||||
create_table "project_steps", force: :cascade do |t|
|
||||
@ -751,6 +759,7 @@ ActiveRecord::Schema.define(version: 20160728095026) do
|
||||
add_foreign_key "open_api_calls_count_tracings", "open_api_clients"
|
||||
add_foreign_key "prices", "groups"
|
||||
add_foreign_key "prices", "plans"
|
||||
add_foreign_key "profiles", "organizations"
|
||||
add_foreign_key "user_tags", "tags"
|
||||
add_foreign_key "user_tags", "users"
|
||||
add_foreign_key "wallet_transactions", "users"
|
||||
|
7
test/fixtures/organizations.yml
vendored
Normal file
7
test/fixtures/organizations.yml
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
|
||||
two:
|
||||
name: MyString
|
7
test/models/organization_test.rb
Normal file
7
test/models/organization_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class OrganizationTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user