site-libsoc/Server/db/migrations/21_create_table_users_group...

27 lines
638 B
Julia
Raw Normal View History

2023-08-01 19:56:41 +07:00
module CreateTableUsersGroups
import SearchLight.Migrations: create_table, column, primary_key, add_index, drop_table
include("../../lib/DatabaseSupport.jl")
import .DatabaseSupport: add_foreign_key, add_index
function up()
create_table(:users_groups) do
[
primary_key()
column(:user_id, :int)
column(:group_id, :int)
]
end
add_foreign_key(:users_groups,:user_id,:users,:id)
add_foreign_key(:users_groups,:group_id,:groups,:id)
add_index(:users_groups, :user_id)
add_index(:users_groups, :group_id)
end
function down()
drop_table(:users_groups)
end
end