2023-07-20 04:15:12 +07:00
|
|
|
module CreateTableGroups
|
|
|
|
|
|
|
|
import SearchLight.Migrations: create_table, column, primary_key, add_index, drop_table
|
|
|
|
|
2023-08-01 19:56:41 +07:00
|
|
|
include("../../lib/DatabaseSupport.jl")
|
|
|
|
import .DatabaseSupport: add_foreign_key, add_index
|
|
|
|
|
2023-07-20 04:15:12 +07:00
|
|
|
function up()
|
|
|
|
create_table(:groups) do
|
|
|
|
[
|
|
|
|
primary_key()
|
|
|
|
column(:country, :string)
|
|
|
|
column(:state, :string)
|
|
|
|
column(:town, :string)
|
|
|
|
column(:contact, :string)
|
|
|
|
column(:latitude, :float)
|
|
|
|
column(:longitude, :float)
|
|
|
|
column(:members, :int)
|
2023-07-30 17:04:15 +07:00
|
|
|
column(:user_id, :int)
|
2023-07-20 04:15:12 +07:00
|
|
|
]
|
|
|
|
end
|
2023-07-30 17:04:15 +07:00
|
|
|
|
|
|
|
add_foreign_key(:groups,:user_id,:users,:id)
|
|
|
|
add_index(:groups, :user_id)
|
2023-07-20 04:15:12 +07:00
|
|
|
end
|
|
|
|
|
|
|
|
function down()
|
|
|
|
drop_table(:groups)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|