Realciones
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
class CreateRuta < ActiveRecord::Migration[7.2]
|
class CreateRuta < ActiveRecord::Migration[7.2]
|
||||||
def change
|
def change
|
||||||
create_table :ruta do |t|
|
create_table :ruta do |t|
|
||||||
|
t.has_many :viajes
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
class CreateViajes < ActiveRecord::Migration[7.2]
|
class CreateViajes < ActiveRecord::Migration[7.2]
|
||||||
def change
|
def change
|
||||||
create_table :viajes do |t|
|
create_table :viajes do |t|
|
||||||
|
t.belongs_to :ruta
|
||||||
|
t.has_many :entregas
|
||||||
|
t.has_many :retiros
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
class CreateEntregas < ActiveRecord::Migration[7.2]
|
class CreateEntregas < ActiveRecord::Migration[7.2]
|
||||||
def change
|
def change
|
||||||
create_table :entregas do |t|
|
create_table :entregas do |t|
|
||||||
|
t.belongs_to :viaje
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
class CreateRetiros < ActiveRecord::Migration[7.2]
|
class CreateRetiros < ActiveRecord::Migration[7.2]
|
||||||
def change
|
def change
|
||||||
create_table :retiros do |t|
|
create_table :retiros do |t|
|
||||||
|
t.belongs_to :viaje
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user