site-libsoc/Server/db/migrations/2022026611846565_create_tab...

31 lines
724 B
Julia
Raw Normal View History

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")
2023-08-01 20:31:23 +07:00
import .DatabaseSupport: add_foreign_key
2023-08-01 19:56:41 +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)
]
end
2023-07-30 17:04:15 +07:00
add_foreign_key(:groups,:user_id,:users,:id)
add_index(:groups, :user_id)
end
function down()
drop_table(:groups)
end
end