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

32 lines
788 B
Julia
Raw Normal View History

2023-08-17 16:01:26 +07:00
module CreateTableTradeUnions
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()
2023-08-17 16:01:26 +07:00
create_table(:trade_unions) do
[
primary_key()
column(:country, :string)
column(:state, :string)
column(:town, :string)
column(:contact, :string)
column(:latitude, :float)
column(:longitude, :float)
2023-08-17 16:01:26 +07:00
column(:name, :string)
column(:members, :int)
2023-07-30 17:04:15 +07:00
column(:user_id, :int)
]
end
2023-07-30 17:04:15 +07:00
2023-08-17 16:01:26 +07:00
add_foreign_key(:trade_unions,:user_id,:users,:id)
add_index(:trade_unions, :user_id)
end
function down()
2023-08-17 16:01:26 +07:00
drop_table(:trade_unions)
end
end