initial commit
This commit is contained in:
17
db/migrate/20250717162159_create_clients.rb
Normal file
17
db/migrate/20250717162159_create_clients.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class CreateClients < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :clients do |t|
|
||||
t.string :company_name
|
||||
t.string :firstname
|
||||
t.string :lastname
|
||||
t.string :streetname
|
||||
t.string :zipcode
|
||||
t.string :city
|
||||
t.string :country
|
||||
t.string :email
|
||||
t.string :phone
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
9
db/migrate/20250717162211_create_projects.rb
Normal file
9
db/migrate/20250717162211_create_projects.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class CreateProjects < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :projects do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
22
db/migrate/20250717162220_create_subprojects.rb
Normal file
22
db/migrate/20250717162220_create_subprojects.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
class CreateSubprojects < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :subprojects do |t|
|
||||
t.string :subproject_name
|
||||
t.references :project, null: false, foreign_key: true
|
||||
|
||||
# client references
|
||||
t.bigint :client_id, null: false
|
||||
t.bigint :owner_id, null: false
|
||||
t.bigint :builder_id, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_foreign_key :subprojects, :clients, column: :client_id
|
||||
add_foreign_key :subprojects, :clients, column: :owner_id
|
||||
add_foreign_key :subprojects, :clients, column: :builder_id
|
||||
add_index :subprojects, :client_id
|
||||
add_index :subprojects, :owner_id
|
||||
add_index :subprojects, :builder_id
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user