site-libsoc/Server/db/migrations/16_create_table_trade_union...

38 lines
1.0 KiB
Julia
Raw Normal View History

2023-08-17 16:01:26 +07:00
module CreateTableTradeUnionsRequests
2023-07-22 17:22:35 +07:00
import SearchLight.Migrations: create_table, column, primary_key, add_index, drop_table
include("../../lib/DatabaseSupport.jl")
using .DatabaseSupport
2023-08-01 20:31:23 +07:00
import .DatabaseSupport: add_foreign_key, set_default
2023-07-22 17:22:35 +07:00
function up()
2023-08-17 16:01:26 +07:00
create_table(:trade_unions_requests) do
2023-07-22 17:22:35 +07:00
[
primary_key()
2023-07-30 17:04:15 +07:00
column(:group_id, :integer)
column(:user_id, :integer)
2023-07-22 17:22:35 +07:00
column(:country, :string)
column(:state, :string)
column(:town, :string)
column(:contact, :string)
column(:latitude, :float)
column(:longitude, :float)
2023-08-01 19:56:41 +07:00
column(:members,:integer)
2023-08-17 16:01:26 +07:00
column(:name,:string)
column(:status,:integer)
2023-07-22 17:22:35 +07:00
]
end
2023-08-17 16:01:26 +07:00
add_foreign_key(:trade_unions_requests,:user_id,:users,:id)
add_foreign_key(:trade_unions_requests,:group_id,:trade_unions,:id)
2023-07-30 17:04:15 +07:00
2023-08-17 16:01:26 +07:00
add_index(:trade_unions_requests, :user_id)
2023-07-30 17:04:15 +07:00
2023-07-22 17:22:35 +07:00
end
function down()
2023-08-17 16:01:26 +07:00
drop_table(:trade_unions_requests)
2023-07-22 17:22:35 +07:00
end
end